Skip to content
Latchkey

Test workflow (remoteinterview/zero)

The Test workflow from remoteinterview/zero, 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: remoteinterview/zero.github/workflows/push.ymlLicense Apache-2.0View source

What it does

This is the Test workflow from the remoteinterview/zero repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.

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

The workflow

workflow (.yml)
on: [push, pull_request]
name: Test
jobs:
  npmInstall:
    name: ${{ matrix.os }} + node ${{ matrix.node }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [windows-latest, ubuntu-18.04, macOS-latest]
        node: [8, 10, 12, 13]
    steps:
    - uses: actions/checkout@master
    - uses: actions/setup-python@v1
    - name: npm install
      uses: actions/setup-node@v1
      with:
          node-version: ${{ matrix.node }}
    - run: npm install
    - name: bootstrap
      uses: actions/setup-node@v1
      with:
          node-version: ${{ matrix.node }}
    - run: npm run bootstrap
    - name: test
      uses: actions/setup-node@v1
      with:
          node-version: ${{ matrix.node }}
          python-version: 3.7
    - run: npm test
      env: 
        PARCEL_WORKERS: 1
        ZERO_LIMIT_BUNDLERS: 3
        HMRWAITTIME: 60000
        NODE_OPTIONS: --max-old-space-size=8192

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.

on: [push, pull_request]
name: Test
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  npmInstall:
    name: ${{ matrix.os }} + node ${{ matrix.node }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [windows-latest, ubuntu-18.04, macOS-latest]
        node: [8, 10, 12, 13]
    steps:
    - uses: actions/checkout@master
    - uses: actions/setup-python@v1
    - name: npm install
      uses: actions/setup-node@v1
      with:
        cache: 'npm'
          node-version: ${{ matrix.node }}
    - run: npm install
    - name: bootstrap
      uses: actions/setup-node@v1
      with:
        cache: 'npm'
          node-version: ${{ matrix.node }}
    - run: npm run bootstrap
    - name: test
      uses: actions/setup-node@v1
      with:
        cache: 'npm'
          node-version: ${{ matrix.node }}
          python-version: 3.7
    - run: npm test
      env: 
        PARCEL_WORKERS: 1
        ZERO_LIMIT_BUNDLERS: 3
        HMRWAITTIME: 60000
        NODE_OPTIONS: --max-old-space-size=8192
 

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 1 job (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