Build and test workflow (spencermountain/compromise)
The Build and test workflow from spencermountain/compromise, explained and optimized by Latchkey.
CI health: C - fair
Run this on Latchkey for self-healing, caching, and up to 58% lower cost.
Grade your own workflow free or run it on Latchkey →What it does
This is the Build and test workflow from the spencermountain/compromise 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: Build and test
on: [pull_request]
jobs:
build-and-test:
runs-on: ${{ matrix.os }}
permissions:
contents: read
strategy:
matrix:
node-version: [20.x, 26.x]
os: [macos-latest, ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: use node.js ${{ matrix.node-version }}
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: ${{ matrix.node-version }}
cache: npm
check-latest: true
- name: install
run: |
npm ci
npm run plugins:ci
- name: static checks
run: |
npm i --no-save eslint
npm run lint
- name: build
run: |
npm run build
npm run plugins:build
- name: test
run: |
npm run test:smoke
npm run test
npm run test:one
npm run test:two
npm run test:three
npm run testb
npm run test:plugins
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Build and test on: [pull_request] concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: build-and-test: timeout-minutes: 30 runs-on: ${{ matrix.os }} permissions: contents: read strategy: matrix: node-version: [20.x, 26.x] os: [macos-latest, ubuntu-latest, windows-latest] steps: - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 with: persist-credentials: false - name: use node.js ${{ matrix.node-version }} uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 with: node-version: ${{ matrix.node-version }} cache: npm check-latest: true - name: install run: | npm ci npm run plugins:ci - name: static checks run: | npm i --no-save eslint npm run lint - name: build run: | npm run build npm run plugins:build - name: test run: | npm run test:smoke npm run test npm run test:one npm run test:two npm run test:three npm run testb npm run test:plugins
What changed
- 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.
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 1 job (6 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.