Skip to content
Latchkey

CI workflow (emotion-js/emotion)

The CI workflow from emotion-js/emotion, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get 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: emotion-js/emotion.github/workflows/main.ymlLicense MITView source

What it does

This is the CI workflow from the emotion-js/emotion 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
      - ts-migration
  pull_request:

permissions:
  contents: read # to fetch code (actions/checkout)

jobs:
  test:
    name: 'Tests on ${{matrix.platform}}'
    strategy:
      fail-fast: false
      matrix:
        platform:
          - ubuntu-latest
          - windows-latest
    runs-on: ${{matrix.platform}}
    steps:
      - uses: actions/checkout@v3
      - uses: ./.github/actions/ci-setup

      - name: Run Tests
        run: yarn test:ci --color

      - name: Upload coverage to Codecov
        uses: codecov/codecov-action@v1
        if: ${{ matrix.platform == 'ubuntu-latest' && always() }}

  typescript:
    name: TypeScript
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: ./.github/actions/ci-setup

      - name: Check Types
        run: yarn tsc:all

  test_react18:
    name: Test React 18
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: ./.github/actions/ci-setup

      - name: Run Tests with React 18
        run: yarn test:react18:ci

  test_prod:
    name: Test Prod
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: ./.github/actions/ci-setup

      - name: Prod Tests
        run: yarn test:prod

  test_dist:
    name: Test Dist
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: ./.github/actions/ci-setup

      - name: Dist Tests
        run: yarn test:dist

  linting:
    name: Linting
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: ./.github/actions/ci-setup

      - name: ESLint
        run: yarn lint:check

  dtslint:
    name: dtslint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: ./.github/actions/ci-setup

      - name: build
        run: yarn build

      - name: dtslint
        run: yarn test:typescript

The same workflow, on Latchkey

Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.

name: CI
 
on:
  push:
    branches:
      - main
      - ts-migration
  pull_request:
 
permissions:
  contents: read # to fetch code (actions/checkout)
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  test:
    timeout-minutes: 30
    name: 'Tests on ${{matrix.platform}}'
    strategy:
      fail-fast: false
      matrix:
        platform:
          - ubuntu-latest
          - windows-latest
    runs-on: ${{matrix.platform}}
    steps:
      - uses: actions/checkout@v3
      - uses: ./.github/actions/ci-setup
 
      - name: Run Tests
        run: yarn test:ci --color
 
      - name: Upload coverage to Codecov
        uses: codecov/codecov-action@v1
        if: ${{ matrix.platform == 'ubuntu-latest' && always() }}
 
  typescript:
    timeout-minutes: 30
    name: TypeScript
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@v3
      - uses: ./.github/actions/ci-setup
 
      - name: Check Types
        run: yarn tsc:all
 
  test_react18:
    timeout-minutes: 30
    name: Test React 18
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@v3
      - uses: ./.github/actions/ci-setup
 
      - name: Run Tests with React 18
        run: yarn test:react18:ci
 
  test_prod:
    timeout-minutes: 30
    name: Test Prod
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@v3
      - uses: ./.github/actions/ci-setup
 
      - name: Prod Tests
        run: yarn test:prod
 
  test_dist:
    timeout-minutes: 30
    name: Test Dist
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@v3
      - uses: ./.github/actions/ci-setup
 
      - name: Dist Tests
        run: yarn test:dist
 
  linting:
    timeout-minutes: 30
    name: Linting
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@v3
      - uses: ./.github/actions/ci-setup
 
      - name: ESLint
        run: yarn lint:check
 
  dtslint:
    timeout-minutes: 30
    name: dtslint
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@v3
      - uses: ./.github/actions/ci-setup
 
      - name: build
        run: yarn build
 
      - name: dtslint
        run: yarn test:typescript
 

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.

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

Actions used in this workflow