Skip to content
Latchkey

CI workflow (primer/octicons)

The CI workflow from primer/octicons, explained and optimized by Latchkey.

F

CI health: F - at risk

Point runs-on at Latchkey and get caching, run de-duplication, job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: primer/octicons.github/workflows/ci.ymlLicense MITView source

What it does

This is the CI workflow from the primer/octicons repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
name: CI
on:
  push:
    branches:
      - main
  pull_request:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: 20
      - run: yarn
      - name: Building
        run: yarn build
      - run: cp -r icons lib/build/svg
      - uses: actions/upload-artifact@v4
        with:
          name: octicons-build
          path: ./lib/build

  main:
    name: Main project
    needs: build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: 20
      - uses: actions/download-artifact@v4
        with:
          name: octicons-build
          path: ./lib/build
      - run: yarn
      - name: Lint
        run: yarn lint
      - name: Test
        run: yarn test

  octicons_node:
    name: 'npm:@primer/octicons'
    needs: build
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: ./lib/octicons_node
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: 20
      - uses: actions/download-artifact@v4
        with:
          name: octicons-build
          path: ./lib/build
      - run: yarn
      - name: Building
        run: yarn build
      - name: Lint
        run: yarn lint
      - name: Test
        run: yarn test

  octicons_react:
    name: 'npm:@primer/octicons-react'
    needs: build
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: ./lib/octicons_react
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: 20
      - uses: actions/download-artifact@v4
        with:
          name: octicons-build
          path: ./lib/build
      - run: yarn
      - name: Building
        run: yarn build
      - name: Lint
        run: yarn lint
      - name: Test
        run: yarn test
      - name: Types
        run: |
          # Run @arethetypeswrong/cli
          npx -p fflate@0.8.2 -p @arethetypeswrong/cli@0.18.2 attw --pack .

          # Run publint
          npx publint@0.2.12 . --strict

  octicons_gem:
    name: 'gem:octicons'
    needs: build
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: ./lib/octicons_gem
    steps:
      - uses: actions/checkout@v3
      - name: Setup Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: 3.3
          bundler-cache: true
      - uses: actions/download-artifact@v4
        with:
          name: octicons-build
          path: ./lib/octicons_gem/lib/build
      - run: bundle install
      - name: Linting
        run: bundle exec rake lint
      - name: Testing
        run: bundle exec rake test
      - name: Build
        run: bundle exec rake build
      - uses: actions/upload-artifact@v4
        with:
          name: octicons-gem
          path: ./lib/octicons_gem/pkg

  octicons_helper:
    name: 'gem:octicons_helper'
    needs: octicons_gem
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: ./lib/octicons_helper
    steps:
      - uses: actions/checkout@v3
      - name: Setup Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: 3.3
          bundler-cache: true
      - uses: actions/download-artifact@v4
        with:
          name: octicons-gem
          path: ./lib/octicons_helper/vendor/cache
      - name: Run bundle install
        run: bundle config set --local disable_checksum_validation true && bundle install
      - name: Linting
        run: bundle exec rake lint
      - name: Testing
        run: bundle exec rake test

  octicons_jekyll:
    name: 'gem:octicons_jekyll'
    needs: octicons_gem
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: ./lib/octicons_jekyll
    steps:
      - uses: actions/checkout@v3
      - name: Setup Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: 3.3
          bundler-cache: true
      - uses: actions/download-artifact@v4
        with:
          name: octicons-gem
          path: ./lib/octicons_jekyll/vendor/cache
      - name: Run bundle install
        run: bundle config set --local disable_checksum_validation true && bundle install
      - name: Linting
        run: bundle exec rake lint
      - name: Testing
        run: bundle exec rake test

The same workflow, on Latchkey

Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.

name: CI
on:
  push:
    branches:
      - main
  pull_request:
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  build:
    timeout-minutes: 30
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          cache: 'npm'
          node-version: 20
      - run: yarn
      - name: Building
        run: yarn build
      - run: cp -r icons lib/build/svg
      - uses: actions/upload-artifact@v4
        with:
          name: octicons-build
          path: ./lib/build
 
  main:
    timeout-minutes: 30
    name: Main project
    needs: build
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          cache: 'npm'
          node-version: 20
      - uses: actions/download-artifact@v4
        with:
          name: octicons-build
          path: ./lib/build
      - run: yarn
      - name: Lint
        run: yarn lint
      - name: Test
        run: yarn test
 
  octicons_node:
    timeout-minutes: 30
    name: 'npm:@primer/octicons'
    needs: build
    runs-on: latchkey-small
    defaults:
      run:
        working-directory: ./lib/octicons_node
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          cache: 'npm'
          node-version: 20
      - uses: actions/download-artifact@v4
        with:
          name: octicons-build
          path: ./lib/build
      - run: yarn
      - name: Building
        run: yarn build
      - name: Lint
        run: yarn lint
      - name: Test
        run: yarn test
 
  octicons_react:
    timeout-minutes: 30
    name: 'npm:@primer/octicons-react'
    needs: build
    runs-on: latchkey-small
    defaults:
      run:
        working-directory: ./lib/octicons_react
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          cache: 'npm'
          node-version: 20
      - uses: actions/download-artifact@v4
        with:
          name: octicons-build
          path: ./lib/build
      - run: yarn
      - name: Building
        run: yarn build
      - name: Lint
        run: yarn lint
      - name: Test
        run: yarn test
      - name: Types
        run: |
          # Run @arethetypeswrong/cli
          npx -p fflate@0.8.2 -p @arethetypeswrong/cli@0.18.2 attw --pack .
 
          # Run publint
          npx publint@0.2.12 . --strict
 
  octicons_gem:
    timeout-minutes: 30
    name: 'gem:octicons'
    needs: build
    runs-on: latchkey-small
    defaults:
      run:
        working-directory: ./lib/octicons_gem
    steps:
      - uses: actions/checkout@v3
      - name: Setup Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: 3.3
          bundler-cache: true
      - uses: actions/download-artifact@v4
        with:
          name: octicons-build
          path: ./lib/octicons_gem/lib/build
      - run: bundle install
      - name: Linting
        run: bundle exec rake lint
      - name: Testing
        run: bundle exec rake test
      - name: Build
        run: bundle exec rake build
      - uses: actions/upload-artifact@v4
        with:
          name: octicons-gem
          path: ./lib/octicons_gem/pkg
 
  octicons_helper:
    timeout-minutes: 30
    name: 'gem:octicons_helper'
    needs: octicons_gem
    runs-on: latchkey-small
    defaults:
      run:
        working-directory: ./lib/octicons_helper
    steps:
      - uses: actions/checkout@v3
      - name: Setup Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: 3.3
          bundler-cache: true
      - uses: actions/download-artifact@v4
        with:
          name: octicons-gem
          path: ./lib/octicons_helper/vendor/cache
      - name: Run bundle install
        run: bundle config set --local disable_checksum_validation true && bundle install
      - name: Linting
        run: bundle exec rake lint
      - name: Testing
        run: bundle exec rake test
 
  octicons_jekyll:
    timeout-minutes: 30
    name: 'gem:octicons_jekyll'
    needs: octicons_gem
    runs-on: latchkey-small
    defaults:
      run:
        working-directory: ./lib/octicons_jekyll
    steps:
      - uses: actions/checkout@v3
      - name: Setup Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: 3.3
          bundler-cache: true
      - uses: actions/download-artifact@v4
        with:
          name: octicons-gem
          path: ./lib/octicons_jekyll/vendor/cache
      - name: Run bundle install
        run: bundle config set --local disable_checksum_validation true && bundle install
      - name: Linting
        run: bundle exec rake lint
      - name: Testing
        run: bundle exec rake test
 

What changed

1 third-party action is referenced by a movable tag. Pin it to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.

What Latchkey heals here

This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:

This workflow runs 7 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow