Skip to content
Latchkey

build workflow (bower/bower)

The build workflow from bower/bower, 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: bower/bower.github/workflows/nodejs.ymlLicense MITView source

What it does

This is the build workflow from the bower/bower 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: build

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - '**'

jobs:
  test:
    name: Node v${{ matrix.node-version }} on ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        # https://github.com/actions/setup-node/issues/27
        node-version: [6.x, 8.x, 10.x, 12.x, 14.x, 16.x, 18.x, 20.x, 22.x]
        os: [ubuntu-latest, macOS-latest, windows-latest]
        include:
        # Pin deprecated Node.js versions on Mac to specific MacOS,
        # as later OS architecture wont support them anymore.
        - node-version: 6.x
          os: macOS-13
        - node-version: 8.x
          os: macOS-13
        - node-version: 10.x
          os: macOS-13
        - node-version: 12.x
          os: macOS-13
        - node-version: 14.x
          os: macOS-13
        exclude:
        # Exclude older Node.js versions from macOS-latest
        - node-version: 6.x
          os: macOS-latest
        - node-version: 8.x
          os: macOS-latest
        - node-version: 10.x
          os: macOS-latest
        - node-version: 12.x
          os: macOS-latest
        - node-version: 14.x
          os: macOS-latest
    runs-on: ${{ matrix.os }}

    steps:
      - name: Set git config
        shell: bash
        run: |
          git config --global core.autocrlf false
          git config --global core.symlinks true
        if: runner.os == 'Windows'

      - uses: actions/checkout@v4
      - name: install
        run: yarn && (cd packages/bower-json && yarn link) && yarn link bower-json
      - name: lint
        run: npm run lint
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node-version }}
      - name: bower tests
        run: npm test
        env:
          CI: true
        continue-on-error: ${{ matrix.os == 'windows-latest' }}  # Allow failure on Windows
      - name: bower-logger tests
        run: (cd packages/bower-logger && npm install && npm test)
        env:
          CI: true
      - name: bower-config tests
        run: (cd packages/bower-config && npm install && npm test)
        env:
          CI: true
      - name: bower-endpoint-parser tests
        run: (cd packages/bower-endpoint-parser && npm install && npm test)
        env:
          CI: true
      - name: bower-json tests
        run: (cd packages/bower-json && npm install && npm test)
        env:
          CI: true
      - name: bower-registry-client tests
        run: (cd packages/bower-registry-client && npm install && npm test)
        env:
          CI: true

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: build
 
on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - '**'
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  test:
    timeout-minutes: 30
    name: Node v${{ matrix.node-version }} on ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        # https://github.com/actions/setup-node/issues/27
        node-version: [6.x, 8.x, 10.x, 12.x, 14.x, 16.x, 18.x, 20.x, 22.x]
        os: [ubuntu-latest, macOS-latest, windows-latest]
        include:
        # Pin deprecated Node.js versions on Mac to specific MacOS,
        # as later OS architecture wont support them anymore.
        - node-version: 6.x
          os: macOS-13
        - node-version: 8.x
          os: macOS-13
        - node-version: 10.x
          os: macOS-13
        - node-version: 12.x
          os: macOS-13
        - node-version: 14.x
          os: macOS-13
        exclude:
        # Exclude older Node.js versions from macOS-latest
        - node-version: 6.x
          os: macOS-latest
        - node-version: 8.x
          os: macOS-latest
        - node-version: 10.x
          os: macOS-latest
        - node-version: 12.x
          os: macOS-latest
        - node-version: 14.x
          os: macOS-latest
    runs-on: ${{ matrix.os }}
 
    steps:
      - name: Set git config
        shell: bash
        run: |
          git config --global core.autocrlf false
          git config --global core.symlinks true
        if: runner.os == 'Windows'
 
      - uses: actions/checkout@v4
      - name: install
        run: yarn && (cd packages/bower-json && yarn link) && yarn link bower-json
      - name: lint
        run: npm run lint
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v4
        with:
          cache: 'npm'
          node-version: ${{ matrix.node-version }}
      - name: bower tests
        run: npm test
        env:
          CI: true
        continue-on-error: ${{ matrix.os == 'windows-latest' }}  # Allow failure on Windows
      - name: bower-logger tests
        run: (cd packages/bower-logger && npm install && npm test)
        env:
          CI: true
      - name: bower-config tests
        run: (cd packages/bower-config && npm install && npm test)
        env:
          CI: true
      - name: bower-endpoint-parser tests
        run: (cd packages/bower-endpoint-parser && npm install && npm test)
        env:
          CI: true
      - name: bower-json tests
        run: (cd packages/bower-json && npm install && npm test)
        env:
          CI: true
      - name: bower-registry-client tests
        run: (cd packages/bower-registry-client && npm install && npm test)
        env:
          CI: true
 

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