Skip to content
Latchkey

Test workflow (semantic-release/semantic-release)

The Test workflow from semantic-release/semantic-release, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get run de-duplication, job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: semantic-release/semantic-release.github/workflows/test.ymlLicense MITView source

What it does

This is the Test workflow from the semantic-release/semantic-release 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: Test

on:
  push:
    branches:
      - master
      # renovate/** branches are generated by https://github.com/apps/renovate
      - renovate/**

  pull_request:
    types:
      - opened
      - synchronize

permissions:
  contents: read # to fetch code (actions/checkout)

env:
  FORCE_COLOR: 1
  NPM_CONFIG_COLOR: always

jobs:
  # verify against ranges defined as supported in engines.node
  test_matrix:
    strategy:
      matrix:
        node-version:
          - 22.14.0
          - 24.10.0
          - 24

    runs-on: ubuntu-latest
    timeout-minutes: 5

    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
      - run: git config --global user.name github-actions
      - run: git config --global user.email github-actions@github.com
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
        with:
          node-version: ${{ matrix.node-version }}
          cache: npm
      - run: npm clean-install
      - run: npm install --global corepack@latest
      - run: corepack npm audit signatures
      - run: npm test

  # verify against the node version defined for development in the .nvmrc
  test_dev:
    runs-on: ubuntu-latest
    timeout-minutes: 5

    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
      - run: git config --global user.name github-actions
      - run: git config --global user.email github-actions@github.com
      - name: Use Node.js from .nvmrc
        uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
        with:
          node-version-file: .nvmrc
          cache: npm
      - run: npm clean-install
      - run: npm install --global corepack@latest
      - run: corepack npm audit signatures
      - run: npm test

  # separate job to set as required in branch protection,
  # as the build names above change each time Node versions change
  test:
    runs-on: ubuntu-latest
    needs:
      - test_dev
      - test_matrix
    if: ${{ !cancelled() }}
    steps:
      - name: All matrix versions passed
        if: ${{ !(contains(needs.*.result, 'failure')) }}
        run: exit 0
      - name: Some matrix version failed
        if: ${{ contains(needs.*.result, 'failure') }}
        run: exit 1

The same workflow, on Latchkey

Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.

name: Test
 
on:
  push:
    branches:
      - master
      # renovate/** branches are generated by https://github.com/apps/renovate
      - renovate/**
 
  pull_request:
    types:
      - opened
      - synchronize
 
permissions:
  contents: read # to fetch code (actions/checkout)
 
env:
  FORCE_COLOR: 1
  NPM_CONFIG_COLOR: always
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  # verify against ranges defined as supported in engines.node
  test_matrix:
    strategy:
      matrix:
        node-version:
          - 22.14.0
          - 24.10.0
          - 24
 
    runs-on: latchkey-small
    timeout-minutes: 5
 
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
      - run: git config --global user.name github-actions
      - run: git config --global user.email github-actions@github.com
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
        with:
          node-version: ${{ matrix.node-version }}
          cache: npm
      - run: npm clean-install
      - run: npm install --global corepack@latest
      - run: corepack npm audit signatures
      - run: npm test
 
  # verify against the node version defined for development in the .nvmrc
  test_dev:
    runs-on: latchkey-small
    timeout-minutes: 5
 
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
      - run: git config --global user.name github-actions
      - run: git config --global user.email github-actions@github.com
      - name: Use Node.js from .nvmrc
        uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
        with:
          node-version-file: .nvmrc
          cache: npm
      - run: npm clean-install
      - run: npm install --global corepack@latest
      - run: corepack npm audit signatures
      - run: npm test
 
  # separate job to set as required in branch protection,
  # as the build names above change each time Node versions change
  test:
    timeout-minutes: 30
    runs-on: latchkey-small
    needs:
      - test_dev
      - test_matrix
    if: ${{ !cancelled() }}
    steps:
      - name: All matrix versions passed
        if: ${{ !(contains(needs.*.result, 'failure')) }}
        run: exit 0
      - name: Some matrix version failed
        if: ${{ contains(needs.*.result, 'failure') }}
        run: exit 1
 

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 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.

Actions used in this workflow