Skip to content
Latchkey

CI workflow (automerge/automerge)

The CI workflow from automerge/automerge, 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: automerge/automerge.github/workflows/ci.yamlLicense MITView source

What it does

This is the CI workflow from the automerge/automerge 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:
    branches:
      - main
jobs:
  fmt:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: 1.89
          default: true
          components: rustfmt
      - uses: Swatinem/rust-cache@v2
      - run: ./scripts/ci/fmt
        shell: bash

  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: 1.89
          default: true
          components: clippy
      - uses: Swatinem/rust-cache@v2
      - run: ./scripts/ci/lint
        shell: bash

  docs:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: 1.89
          default: true
      - uses: Swatinem/rust-cache@v2
      - name: Build rust docs
        run: ./scripts/ci/rust-docs
        shell: bash
      - name: Install doxygen
        run: sudo apt-get install -y doxygen
        shell: bash

  cargo-deny:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        checks:
          - advisories
          - bans licenses sources
    continue-on-error: ${{ matrix.checks == 'advisories' }}
    steps:
      - uses: actions/checkout@v6
      - uses: EmbarkStudios/cargo-deny-action@v2
        with:
          manifest-path: "./rust/Cargo.toml"
          command: check ${{ matrix.checks }}

  build_wasm:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: jetli/wasm-bindgen-action@v0.2.0
        with:
          # Optional version of wasm-bindgen to install(eg. '0.2.83', 'latest')
          version: "0.2.121"
      - name: Install wasm32 target
        working-directory: rust
        run: rustup target add wasm32-unknown-unknown
      - name: run tests
        run: ./scripts/ci/wasm_tests

  js_tests:
    runs-on: ubuntu-latest
    needs:
      - build_wasm

    steps:
      - uses: actions/checkout@v6
      - uses: actions/setup-node@v6
        with:
          node-version: "24"
      - uses: jetli/wasm-bindgen-action@v0.2.0
        with:
          # Optional version of wasm-bindgen to install(eg. '0.2.83', 'latest')
          version: "0.2.121"
      - name: Install wasm32 target
        working-directory: rust
        run: rustup target add wasm32-unknown-unknown
      - name: run tests
        run: ./scripts/ci/js_tests

  # This test is necessary because we want to make sure that the webcrypto polyfill
  # for node 18 works correctly. See the notes in javascript/HACKING.md#getrandom-support
  node_18_packaging_test:
    runs-on: ubuntu-latest
    needs:
      - build_wasm

    steps:
      - uses: actions/checkout@v6
      - uses: actions/setup-node@v6
        with:
          node-version: "18"
      - uses: jetli/wasm-bindgen-action@v0.2.0
        with:
          # Optional version of wasm-bindgen to install(eg. '0.2.83', 'latest')
          version: "0.2.121"
      - name: Install wasm32 target
        working-directory: rust
        run: rustup target add wasm32-unknown-unknown
      - name: run tests
        run: ./scripts/ci/node_18_packaging_test

  linux:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        toolchain:
          - 1.89
    steps:
      - uses: actions/checkout@v6
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: ${{ matrix.toolchain }}
          default: true
      - uses: Swatinem/rust-cache@v2
      - run: ./scripts/ci/build-test
        shell: bash

  macos:
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v6
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: 1.89
          default: true
      - uses: Swatinem/rust-cache@v2
      - run: ./scripts/ci/build-test
        shell: bash

  windows:
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v6
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: 1.89
          default: true
      - uses: Swatinem/rust-cache@v2
      - run: ./scripts/ci/build-test
        shell: bash

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:
    branches:
      - main
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  fmt:
    timeout-minutes: 30
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@v6
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: 1.89
          default: true
          components: rustfmt
      - uses: Swatinem/rust-cache@v2
      - run: ./scripts/ci/fmt
        shell: bash
 
  lint:
    timeout-minutes: 30
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@v6
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: 1.89
          default: true
          components: clippy
      - uses: Swatinem/rust-cache@v2
      - run: ./scripts/ci/lint
        shell: bash
 
  docs:
    timeout-minutes: 30
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@v6
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: 1.89
          default: true
      - uses: Swatinem/rust-cache@v2
      - name: Build rust docs
        run: ./scripts/ci/rust-docs
        shell: bash
      - name: Install doxygen
        run: sudo apt-get install -y doxygen
        shell: bash
 
  cargo-deny:
    timeout-minutes: 30
    runs-on: latchkey-small
    strategy:
      matrix:
        checks:
          - advisories
          - bans licenses sources
    continue-on-error: ${{ matrix.checks == 'advisories' }}
    steps:
      - uses: actions/checkout@v6
      - uses: EmbarkStudios/cargo-deny-action@v2
        with:
          manifest-path: "./rust/Cargo.toml"
          command: check ${{ matrix.checks }}
 
  build_wasm:
    timeout-minutes: 30
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@v6
      - uses: jetli/wasm-bindgen-action@v0.2.0
        with:
          # Optional version of wasm-bindgen to install(eg. '0.2.83', 'latest')
          version: "0.2.121"
      - name: Install wasm32 target
        working-directory: rust
        run: rustup target add wasm32-unknown-unknown
      - name: run tests
        run: ./scripts/ci/wasm_tests
 
  js_tests:
    timeout-minutes: 30
    runs-on: latchkey-small
    needs:
      - build_wasm
 
    steps:
      - uses: actions/checkout@v6
      - uses: actions/setup-node@v6
        with:
          cache: 'npm'
          node-version: "24"
      - uses: jetli/wasm-bindgen-action@v0.2.0
        with:
          # Optional version of wasm-bindgen to install(eg. '0.2.83', 'latest')
          version: "0.2.121"
      - name: Install wasm32 target
        working-directory: rust
        run: rustup target add wasm32-unknown-unknown
      - name: run tests
        run: ./scripts/ci/js_tests
 
  # This test is necessary because we want to make sure that the webcrypto polyfill
  # for node 18 works correctly. See the notes in javascript/HACKING.md#getrandom-support
  node_18_packaging_test:
    timeout-minutes: 30
    runs-on: latchkey-small
    needs:
      - build_wasm
 
    steps:
      - uses: actions/checkout@v6
      - uses: actions/setup-node@v6
        with:
          cache: 'npm'
          node-version: "18"
      - uses: jetli/wasm-bindgen-action@v0.2.0
        with:
          # Optional version of wasm-bindgen to install(eg. '0.2.83', 'latest')
          version: "0.2.121"
      - name: Install wasm32 target
        working-directory: rust
        run: rustup target add wasm32-unknown-unknown
      - name: run tests
        run: ./scripts/ci/node_18_packaging_test
 
  linux:
    timeout-minutes: 30
    runs-on: latchkey-small
    strategy:
      matrix:
        toolchain:
          - 1.89
    steps:
      - uses: actions/checkout@v6
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: ${{ matrix.toolchain }}
          default: true
      - uses: Swatinem/rust-cache@v2
      - run: ./scripts/ci/build-test
        shell: bash
 
  macos:
    timeout-minutes: 30
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v6
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: 1.89
          default: true
      - uses: Swatinem/rust-cache@v2
      - run: ./scripts/ci/build-test
        shell: bash
 
  windows:
    timeout-minutes: 30
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v6
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: 1.89
          default: true
      - uses: Swatinem/rust-cache@v2
      - run: ./scripts/ci/build-test
        shell: bash
 

What changed

4 third-party actions are referenced by a movable tag. Pin them 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 10 jobs (11 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