Skip to content
Latchkey

ci workflow (expressjs/body-parser)

The ci workflow from expressjs/body-parser, explained and optimized by Latchkey.

D

CI health: D - needs work

Point runs-on at Latchkey and get caching, 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: expressjs/body-parser.github/workflows/ci.ymlLicense MITView source

What it does

This is the ci workflow from the expressjs/body-parser 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
    paths-ignore:
      - '*.md'
  pull_request:
    paths-ignore:
      - '*.md'
permissions:
  contents: read

jobs:
  lint:
    name: Lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0

      - name: Install Node.js
        uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
        with:
          node-version: 'lts/*'

      - name: Install Node.js dependencies
        run: npm install --ignore-scripts --include=dev

      - name: Lint code
        run: npm run lint

  test:
    name: Test - Node.js ${{ matrix.node-version }}
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        node-version: [18.0.0, 18, 19, 20, 21, 22, 23, 24, 25, 26]

    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0

      - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
        with:
          node-version: ${{ matrix.node-version }}
          check-latest: true

      - name: Install Node.js dependencies
        run: npm install

      - name: Run tests
        run: npm run test-ci

      - name: Upload code coverage
        uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
        with:
          name: coverage-node-${{ matrix.node-version }}
          path: ./coverage/lcov.info
          retention-days: 1

  coverage:
    needs: test
    runs-on: ubuntu-latest
    permissions:
      contents: read
      checks: write
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0

      - name: Install lcov
        shell: bash
        run: sudo apt-get -y install lcov

      - name: Collect coverage reports
        uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
        with:
          path: ./coverage
          pattern: coverage-node-*

      - name: Merge coverage reports
        shell: bash
        run: find ./coverage -name lcov.info -exec printf '-a %q\n' {} \; | xargs lcov -o ./lcov.info

      - name: Upload coverage report
        uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2.3.6
        with:
          file: ./lcov.info

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
    paths-ignore:
      - '*.md'
  pull_request:
    paths-ignore:
      - '*.md'
permissions:
  contents: read
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  lint:
    timeout-minutes: 30
    name: Lint
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
 
      - name: Install Node.js
        uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
        with:
          cache: 'npm'
          node-version: 'lts/*'
 
      - name: Install Node.js dependencies
        run: npm install --ignore-scripts --include=dev
 
      - name: Lint code
        run: npm run lint
 
  test:
    timeout-minutes: 30
    name: Test - Node.js ${{ matrix.node-version }}
    runs-on: latchkey-small
    strategy:
      fail-fast: false
      matrix:
        node-version: [18.0.0, 18, 19, 20, 21, 22, 23, 24, 25, 26]
 
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
 
      - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
        with:
          cache: 'npm'
          node-version: ${{ matrix.node-version }}
          check-latest: true
 
      - name: Install Node.js dependencies
        run: npm install
 
      - name: Run tests
        run: npm run test-ci
 
      - name: Upload code coverage
        uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
        with:
          name: coverage-node-${{ matrix.node-version }}
          path: ./coverage/lcov.info
          retention-days: 1
 
  coverage:
    timeout-minutes: 30
    needs: test
    runs-on: latchkey-small
    permissions:
      contents: read
      checks: write
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
 
      - name: Install lcov
        shell: bash
        run: sudo apt-get -y install lcov
 
      - name: Collect coverage reports
        uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
        with:
          path: ./coverage
          pattern: coverage-node-*
 
      - name: Merge coverage reports
        shell: bash
        run: find ./coverage -name lcov.info -exec printf '-a %q\n' {} \; | xargs lcov -o ./lcov.info
 
      - name: Upload coverage report
        uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2.3.6
        with:
          file: ./lcov.info
 

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