Skip to content
Latchkey

CI workflow (node-fetch/node-fetch)

The CI workflow from node-fetch/node-fetch, 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: node-fetch/node-fetch.github/workflows/ci.ymlLicense MITView source

What it does

This is the CI workflow from the node-fetch/node-fetch 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: CI

on:
  push:
    branches: [main]
  pull_request:
    paths:
      - "**.js"
      - "package.json"
      - ".github/workflows/ci.yml"

jobs:
  test:
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest, macOS-latest]
        node: ["12.20.0", "14.13.1", "16.0.0"]
        exclude:
          # On Windows, run tests with only the LTS environments.
          - os: windows-latest
            node: "12.22.3"
          - os: windows-latest
            node: "16.0.0"
          # On macOS, run tests with only the LTS environments.
          - os: macOS-latest
            node: "12.22.3"
          - os: macOS-latest
            node: "16.0.0"

    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v2

      - uses: actions/setup-node@v2
        with:
          node-version: ${{ matrix.node }}

      - run: npm install

      - run: npm test -- --colors

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: CI
 
on:
  push:
    branches: [main]
  pull_request:
    paths:
      - "**.js"
      - "package.json"
      - ".github/workflows/ci.yml"
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  test:
    timeout-minutes: 30
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest, macOS-latest]
        node: ["12.20.0", "14.13.1", "16.0.0"]
        exclude:
          # On Windows, run tests with only the LTS environments.
          - os: windows-latest
            node: "12.22.3"
          - os: windows-latest
            node: "16.0.0"
          # On macOS, run tests with only the LTS environments.
          - os: macOS-latest
            node: "12.22.3"
          - os: macOS-latest
            node: "16.0.0"
 
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v2
 
      - uses: actions/setup-node@v2
        with:
          cache: 'npm'
          node-version: ${{ matrix.node }}
 
      - run: npm install
 
      - run: npm test -- --colors
 

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 (9 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