ci Alternative Runtimes workflow (fastify/fastify)
The ci Alternative Runtimes workflow from fastify/fastify, explained and optimized by Latchkey.
CI health: A - excellent
Point runs-on at Latchkey and get job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the ci Alternative Runtimes workflow from the fastify/fastify 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 Alternative Runtimes
on:
push:
branches:
- main
- next
- 'v*'
paths-ignore:
- 'docs/**'
- '*.md'
pull_request:
paths-ignore:
- 'docs/**'
- '*.md'
# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
cancel-in-progress: true
permissions:
contents: read
jobs:
test-unit:
runs-on: ${{ matrix.os }}
continue-on-error: true
permissions:
contents: read
strategy:
matrix:
node-version: [20]
os: [macos-latest, ubuntu-latest, windows-latest]
include:
- runtime: nsolid
node-version: 20
nsolid-version: 5
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: nodesource/setup-nsolid@1ca68d2589d3d56ecd3881dfe6ffa87eeda9c939 # v1.0.1
if: ${{ matrix.runtime == 'nsolid' }}
with:
node-version: ${{ matrix.node-version }}
nsolid-version: ${{ matrix.nsolid-version }}
- name: Install
run: |
npm install --ignore-scripts
- name: Run tests
run: |
npm run unit
test-types:
runs-on: 'ubuntu-latest'
permissions:
contents: read
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: nodesource/setup-nsolid@1ca68d2589d3d56ecd3881dfe6ffa87eeda9c939 # v1.0.1
with:
node-version: 20
nsolid-version: 5
- name: Install
run: |
npm install --ignore-scripts
- name: Run type tests
run: |
npm run test:types
env:
NODE_OPTIONS: no-network-family-autoselection
package:
needs:
- test-types
- test-unit
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: nodesource/setup-nsolid@1ca68d2589d3d56ecd3881dfe6ffa87eeda9c939 # v1.0.1
with:
nsolid-version: 5
- name: install fastify
run: |
npm install --ignore-scripts
- name: install webpack stack
run: |
cd test/bundler/webpack && npm install
- name: Test webpack bundle
run: |
cd test/bundler/webpack && npm run test
- name: install esbuild stack
run: |
cd test/bundler/esbuild && npm install
- name: Test esbuild bundle
run: |
cd test/bundler/esbuild && npm run test
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: ci Alternative Runtimes on: push: branches: - main - next - 'v*' paths-ignore: - 'docs/**' - '*.md' pull_request: paths-ignore: - 'docs/**' - '*.md' # This allows a subsequently queued workflow run to interrupt previous runs concurrency: group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}" cancel-in-progress: true permissions: contents: read jobs: test-unit: timeout-minutes: 30 runs-on: ${{ matrix.os }} continue-on-error: true permissions: contents: read strategy: matrix: node-version: [20] os: [macos-latest, ubuntu-latest, windows-latest] include: - runtime: nsolid node-version: 20 nsolid-version: 5 steps: - uses: actions/checkout@v7 with: persist-credentials: false - uses: nodesource/setup-nsolid@1ca68d2589d3d56ecd3881dfe6ffa87eeda9c939 # v1.0.1 if: ${{ matrix.runtime == 'nsolid' }} with: node-version: ${{ matrix.node-version }} nsolid-version: ${{ matrix.nsolid-version }} - name: Install run: | npm install --ignore-scripts - name: Run tests run: | npm run unit test-types: timeout-minutes: 30 runs-on: 'ubuntu-latest' permissions: contents: read steps: - uses: actions/checkout@v7 with: persist-credentials: false - uses: nodesource/setup-nsolid@1ca68d2589d3d56ecd3881dfe6ffa87eeda9c939 # v1.0.1 with: node-version: 20 nsolid-version: 5 - name: Install run: | npm install --ignore-scripts - name: Run type tests run: | npm run test:types env: NODE_OPTIONS: no-network-family-autoselection package: timeout-minutes: 30 needs: - test-types - test-unit runs-on: latchkey-small permissions: contents: read steps: - uses: actions/checkout@v7 with: persist-credentials: false - uses: nodesource/setup-nsolid@1ca68d2589d3d56ecd3881dfe6ffa87eeda9c939 # v1.0.1 with: nsolid-version: 5 - name: install fastify run: | npm install --ignore-scripts - name: install webpack stack run: | cd test/bundler/webpack && npm install - name: Test webpack bundle run: | cd test/bundler/webpack && npm run test - name: install esbuild stack run: | cd test/bundler/esbuild && npm install - name: Test esbuild bundle run: | cd test/bundler/esbuild && npm run test
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. - 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 3 jobs (5 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.