CI workflow (testem/testem)
The CI workflow from testem/testem, explained and optimized by Latchkey.
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.
What it does
This is the CI workflow from the testem/testem 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
name: CI
on:
push:
branches:
- master
- "0.6"
- "0.8.x"
- v*
pull_request:
jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v6
with:
node-version: 22
cache: "npm"
cache-dependency-path: package.json
- run: npm i
- run: npm run lint
test:
strategy:
matrix:
os: [ubuntu-latest]
node: [20, 22, 24]
include:
- os: macos-latest
node: 22
- os: windows-latest
node: 22
fail-fast: true
runs-on: ${{ matrix.os }}
steps:
- uses: browser-actions/setup-firefox@v1.7.2
- uses: actions/checkout@v7
- uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node }}
cache: "npm"
cache-dependency-path: package.json
- run: firefox --version
- run: npm i
- uses: nick-invision/retry@v4.0.0
with:
timeout_minutes: 10
max_attempts: 3
retry_on: error
command: npm test
- run: sudo apt-get install -y libgtk2.0-0
if: runner.os == 'Linux'
- name: npm run integration
uses: GabrielBB/xvfb-action@v1.7
with:
run: npm run integration
safari-smoke:
name: safari-ci-smoke
runs-on: macos-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v6
with:
node-version: 22
cache: "npm"
cache-dependency-path: package.json
- run: npm i
- run: npm run ci:safari-smoke
browser-tests:
name: browser-tests
runs-on: ubuntu-latest
timeout-minutes: 10
concurrency: "sauce"
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v6
with:
node-version: 22
cache: "npm"
cache-dependency-path: package.json
- run: npm i
- run: npm run browser-tests
env:
SAUCE_USERNAME: testem-ci
SAUCE_ACCESS_KEY: 1f00979e-0252-4d69-98ff-f6c85d1a746b
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: CI on: push: branches: - master - "0.6" - "0.8.x" - v* pull_request: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: lint: timeout-minutes: 30 name: lint runs-on: latchkey-small steps: - uses: actions/checkout@v7 - uses: actions/setup-node@v6 with: node-version: 22 cache: "npm" cache-dependency-path: package.json - run: npm i - run: npm run lint test: timeout-minutes: 30 strategy: matrix: os: [ubuntu-latest] node: [20, 22, 24] include: - os: macos-latest node: 22 - os: windows-latest node: 22 fail-fast: true runs-on: ${{ matrix.os }} steps: - uses: browser-actions/setup-firefox@v1.7.2 - uses: actions/checkout@v7 - uses: actions/setup-node@v6 with: node-version: ${{ matrix.node }} cache: "npm" cache-dependency-path: package.json - run: firefox --version - run: npm i - uses: nick-invision/retry@v4.0.0 with: timeout_minutes: 10 max_attempts: 3 retry_on: error command: npm test - run: sudo apt-get install -y libgtk2.0-0 if: runner.os == 'Linux' - name: npm run integration uses: GabrielBB/xvfb-action@v1.7 with: run: npm run integration safari-smoke: name: safari-ci-smoke runs-on: macos-latest timeout-minutes: 15 steps: - uses: actions/checkout@v7 - uses: actions/setup-node@v6 with: node-version: 22 cache: "npm" cache-dependency-path: package.json - run: npm i - run: npm run ci:safari-smoke browser-tests: name: browser-tests runs-on: latchkey-small timeout-minutes: 10 concurrency: "sauce" steps: - uses: actions/checkout@v7 - uses: actions/setup-node@v6 with: node-version: 22 cache: "npm" cache-dependency-path: package.json - run: npm i - run: npm run browser-tests env: SAUCE_USERNAME: testem-ci SAUCE_ACCESS_KEY: 1f00979e-0252-4d69-98ff-f6c85d1a746b
What changed
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - Cancel superseded runs when a branch or PR gets a newer push.
- Add a job timeout so a hung step cannot burn hours of runner time.
3 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:
- Dependency installs
This workflow runs 4 jobs (6 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.