Skip to content
Latchkey

ci workflow (node-formidable/formidable)

The ci workflow from node-formidable/formidable, explained and optimized by Latchkey.

D

CI health: D - needs work

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

Grade your own workflow free or run it on Latchkey →
Source: node-formidable/formidable.github/workflows/main.ymlLicense MITView source

What it does

This is the ci workflow from the node-formidable/formidable 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: [ master ]
#   pull_request:
#     branches: [ master ]

# jobs:
#   # lint:
#   #   name: Lint
#   #   runs-on: ubuntu-latest
#   #   steps:
#   #     - uses: actions/checkout@v5

#   #     - name: Set up Node.js
#   #       uses: actions/setup-node@v5
#   #       with:
#   #         node-version: '20'
#   #         cache: 'npm'

#   #     - name: Install dependencies
#   #       run: npm install

#   #     - name: Run lint
#   #       run: npm run lint

#   test:
#     name: Test on ${{ matrix.os }}
#     runs-on: ${{ matrix.os }}
#     strategy:
#       fail-fast: false
#       matrix:
#         os: [ubuntu-latest, macos-latest]
#         node-version: ['lts/*']

#     steps:
#       - uses: actions/checkout@v5

#       - name: Set up Node.js ${{ matrix.node-version }}
#         uses: actions/setup-node@v5
#         with:
#           node-version: ${{ matrix.node-version }}
#           cache: 'npm'

#       - name: Install dependencies
#         run: npm install

#       - name: Run tests
#         run: npm test

on:
  push:
    branches:
      - "*"
  pull_request:
    branches:
      - "*"

jobs:
  build-and-test:
    name: Test on ${{ matrix.os }} with Node.js ${{matrix.node-version}}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest]
        node-version: [18, 20, 22, "lts/*"]
        exclude:
          - os: macos-latest
            node-version: 18
          - os: macos-latest
            node-version: 20

    steps:
      - name: Checkout
        uses: actions/checkout@v5

      - uses: pnpm/action-setup@v6
        name: Install pnpm
        with:
          run_install: false

      - name: Setup Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v5
        with:
          node-version: ${{ matrix.node-version }}
          cache: pnpm

      - name: Install dependencies
        run: pnpm install

      - name: Run tests
        run: pnpm test

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: [ master ]
#   pull_request:
#     branches: [ master ]
 
# jobs:
#   # lint:
#   #   name: Lint
#   #   runs-on: latchkey-small
#   #   steps:
#   #     - uses: actions/checkout@v5
 
#   #     - name: Set up Node.js
#   #       uses: actions/setup-node@v5
            with:
              cache: 'npm'
#   #       with:
#   #         node-version: '20'
#   #         cache: 'npm'
 
#   #     - name: Install dependencies
#   #       run: npm install
 
#   #     - name: Run lint
#   #       run: npm run lint
 
#   test:
#     name: Test on ${{ matrix.os }}
#     runs-on: ${{ matrix.os }}
#     strategy:
#       fail-fast: false
#       matrix:
#         os: [ubuntu-latest, macos-latest]
#         node-version: ['lts/*']
 
#     steps:
#       - uses: actions/checkout@v5
 
#       - name: Set up Node.js ${{ matrix.node-version }}
#         uses: actions/setup-node@v5
          with:
            cache: 'npm'
#         with:
#           node-version: ${{ matrix.node-version }}
#           cache: 'npm'
 
#       - name: Install dependencies
#         run: npm install
 
#       - name: Run tests
#         run: npm test
 
on:
  push:
    branches:
      - "*"
  pull_request:
    branches:
      - "*"
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  build-and-test:
    name: Test on ${{ matrix.os }} with Node.js ${{matrix.node-version}}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest]
        node-version: [18, 20, 22, "lts/*"]
        exclude:
          - os: macos-latest
            node-version: 18
          - os: macos-latest
            node-version: 20
 
    steps:
      - name: Checkout
        uses: actions/checkout@v5
 
      - uses: pnpm/action-setup@v6
        name: Install pnpm
        with:
          run_install: false
 
      - name: Setup Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v5
        with:
          node-version: ${{ matrix.node-version }}
          cache: pnpm
 
      - name: Install dependencies
        run: pnpm install
 
      - name: Run tests
        run: pnpm test
 

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