Skip to content
Latchkey

Unit Tests workflow (11ty/buildawesome)

The Unit Tests workflow from 11ty/buildawesome, explained and optimized by Latchkey.

D

CI health: D - needs work

Run this on Latchkey for self-healing, caching, and up to 58% lower cost.

Grade your own workflow free or run it on Latchkey →
Source: 11ty/buildawesome.github/workflows/ci.ymlLicense MITView source

What it does

This is the Unit Tests workflow from the 11ty/buildawesome 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: Unit Tests
on: push
permissions: read-all
jobs:
  server:
    name: Node.js v${{ matrix.node }} on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: ["ubuntu-latest", "macos-latest", "windows-latest"]
        node: ["22", "24", "26"]
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # 7.0.0
      - name: Setup node
        uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # 6.4.0
        with:
          node-version: ${{ matrix.node }}
          # cache: npm
      - run: npm ci
      - run: npm run test:server
  client:
    name: Vitest on ${{ matrix.os }} (Node.js v${{ matrix.node }})
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: ["ubuntu-latest", "macos-latest", "windows-latest"]
        node: ["22"]
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # 7.0.0
      - name: Setup node
        uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # 6.4.0
        with:
          node-version: ${{ matrix.node }}
      - run: npm ci
      - run: npx playwright install
      - run: npm run test:browser
env:
  YARN_GPG: no

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: Unit Tests
on: push
permissions: read-all
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  server:
    timeout-minutes: 30
    name: Node.js v${{ matrix.node }} on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: ["ubuntu-latest", "macos-latest", "windows-latest"]
        node: ["22", "24", "26"]
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # 7.0.0
      - name: Setup node
        uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # 6.4.0
        with:
          cache: 'npm'
          node-version: ${{ matrix.node }}
          # cache: npm
      - run: npm ci
      - run: npm run test:server
  client:
    timeout-minutes: 30
    name: Vitest on ${{ matrix.os }} (Node.js v${{ matrix.node }})
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: ["ubuntu-latest", "macos-latest", "windows-latest"]
        node: ["22"]
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # 7.0.0
      - name: Setup node
        uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # 6.4.0
        with:
          cache: 'npm'
          node-version: ${{ matrix.node }}
      - run: npm ci
      - run: npx playwright install
      - run: npm run test:browser
env:
  YARN_GPG: no
 

What changed

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 2 jobs (12 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