Skip to content
Latchkey

Tests workflow (mozilla/nunjucks)

The Tests workflow from mozilla/nunjucks, explained and optimized by Latchkey.

C

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 →
Source: mozilla/nunjucks.github/workflows/tests.ymlLicense BSD-2-ClauseView source

What it does

This is the Tests workflow from the mozilla/nunjucks repository, a real project running GitHub Actions. It is shown here with attribution under its BSD-2-Clause license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
name: Tests

on:
  push:
  pull_request:
  workflow_dispatch:

permissions:
  contents: read

jobs:
  tests:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - node: 16
            os: windows-2022
          - node: 16
            os: windows-2025
          - node: 18
            os: ubuntu-22.04
          - node: 18.20.1  # TODO: spawn node18+/win: github.com/nodejs/nodejs.org/pull/6660
            os: windows-2022
          - node: 20
            os: macos-14
          - node: 20
            os: ubuntu-latest
          - node: 20.12.1  # TODO: spawn node18+/win: github.com/nodejs/nodejs.org/pull/6660
            os: windows-2025
          - node: 22
            os: macos-15-intel
          - node: 22
            os: ubuntu-24.04
          - node: 24
            os: ubuntu-latest
          - node: 24
            os: macos-latest
          - node: 25
            os: macos-26

    name: Test (node-${{ matrix.node }}/${{ matrix.os }})

    steps:
      - if: runner.os == 'Linux'  # PhantomJS OpenSSL 1.1.1 vs 3.x Ubuntu 22+ compat
        run: echo "OPENSSL_CONF=/dev/null" >> "$GITHUB_ENV"
      - if: runner.os == 'Windows'  # Tests would fail LF vs CRLF linebreak-style
        run: git config --global core.autocrlf false && git config --global core.eol lf
      - uses: actions/checkout@v5
      - uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node }}
          cache: npm
      - run: npm ci
      - run: npm test
      - if: success()
        uses: codecov/codecov-action@v5
        env:
          CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

The same workflow, on Latchkey

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

name: Tests
 
on:
  push:
  pull_request:
  workflow_dispatch:
 
permissions:
  contents: read
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  tests:
    timeout-minutes: 30
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - node: 16
            os: windows-2022
          - node: 16
            os: windows-2025
          - node: 18
            os: ubuntu-22.04
          - node: 18.20.1  # TODO: spawn node18+/win: github.com/nodejs/nodejs.org/pull/6660
            os: windows-2022
          - node: 20
            os: macos-14
          - node: 20
            os: ubuntu-latest
          - node: 20.12.1  # TODO: spawn node18+/win: github.com/nodejs/nodejs.org/pull/6660
            os: windows-2025
          - node: 22
            os: macos-15-intel
          - node: 22
            os: ubuntu-24.04
          - node: 24
            os: ubuntu-latest
          - node: 24
            os: macos-latest
          - node: 25
            os: macos-26
 
    name: Test (node-${{ matrix.node }}/${{ matrix.os }})
 
    steps:
      - if: runner.os == 'Linux'  # PhantomJS OpenSSL 1.1.1 vs 3.x Ubuntu 22+ compat
        run: echo "OPENSSL_CONF=/dev/null" >> "$GITHUB_ENV"
      - if: runner.os == 'Windows'  # Tests would fail LF vs CRLF linebreak-style
        run: git config --global core.autocrlf false && git config --global core.eol lf
      - uses: actions/checkout@v5
      - uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node }}
          cache: npm
      - run: npm ci
      - run: npm test
      - if: success()
        uses: codecov/codecov-action@v5
        env:
          CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
 

What changed

1 third-party action is referenced by a movable tag. Pin it 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:

This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow