Skip to content
Latchkey

legacy workflow (expressjs/express)

The legacy workflow from expressjs/express, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get caching, 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/express.github/workflows/legacy.ymlLicense MITView source

What it does

This is the legacy workflow from the expressjs/express 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: legacy

on:
  push:
    branches:
      - master
      - develop
      - '4.x'
      - '5.x'
      - '5.0'
    paths-ignore:
      - '*.md'
  pull_request:
    paths-ignore:
      - '*.md'
  workflow_dispatch:
  
permissions:
  contents: read

# Cancel in progress workflows
# in the scenario where we already had a run going for that PR/branch/tag but then triggered a new run
concurrency:
  group: "${{ github.workflow }} ✨ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
  cancel-in-progress: true

jobs:
  test:
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, windows-latest]
        node-version: [16, 17]
        # Node.js release schedule: https://nodejs.org/en/about/releases/

    name: Node.js ${{ matrix.node-version }} - ${{matrix.os}}

    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
        with:
          persist-credentials: false

      - name: Setup Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
        with:
          node-version: ${{ matrix.node-version }}

      - name: Configure npm loglevel
        run: |
          npm config set loglevel error
        shell: bash

      - name: Install dependencies
        run: npm install

      - name: Output Node and NPM versions
        run: |
          echo "Node.js version: $(node -v)"
          echo "NPM version: $(npm -v)"

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

      - name: Upload code coverage
        uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
        with:
          name: coverage-node-${{ matrix.node-version }}-${{ matrix.os }}
          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
        with:
          persist-credentials: false

      - 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@5cbfd81b66ca5d10c19b062c04de0199c215fb6e # v2.3.7
        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: legacy
 
on:
  push:
    branches:
      - master
      - develop
      - '4.x'
      - '5.x'
      - '5.0'
    paths-ignore:
      - '*.md'
  pull_request:
    paths-ignore:
      - '*.md'
  workflow_dispatch:
  
permissions:
  contents: read
 
# Cancel in progress workflows
# in the scenario where we already had a run going for that PR/branch/tag but then triggered a new run
concurrency:
  group: "${{ github.workflow }} ✨ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
  cancel-in-progress: true
 
jobs:
  test:
    timeout-minutes: 30
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, windows-latest]
        node-version: [16, 17]
        # Node.js release schedule: https://nodejs.org/en/about/releases/
 
    name: Node.js ${{ matrix.node-version }} - ${{matrix.os}}
 
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
        with:
          persist-credentials: false
 
      - name: Setup Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
        with:
          cache: 'npm'
          node-version: ${{ matrix.node-version }}
 
      - name: Configure npm loglevel
        run: |
          npm config set loglevel error
        shell: bash
 
      - name: Install dependencies
        run: npm install
 
      - name: Output Node and NPM versions
        run: |
          echo "Node.js version: $(node -v)"
          echo "NPM version: $(npm -v)"
 
      - name: Run tests
        shell: bash
        run: npm run test-ci
 
      - name: Upload code coverage
        uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
        with:
          name: coverage-node-${{ matrix.node-version }}-${{ matrix.os }}
          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
        with:
          persist-credentials: false
 
      - 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@5cbfd81b66ca5d10c19b062c04de0199c215fb6e # v2.3.7
        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 2 jobs (5 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