CI workflow (beautifier/js-beautify)
The CI workflow from beautifier/js-beautify, 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 →What it does
This is the CI workflow from the beautifier/js-beautify 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:
branches:
- main
jobs:
build:
name: Build ${{ matrix.os }} (Node ${{ matrix.node-version }}, Python ${{ matrix.python-version }} )
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ ubuntu, windows, macos ]
python-version: [3.11, 3.12, 3.14]
include:
- python-version: 3.11
node-version: 22
- python-version: 3.12
node-version: 24
- python-version: 3.14
node-version: 26
steps:
- uses: actions/checkout@v7
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Cached node_modules
uses: actions/cache@v6
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package*.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Make all (Windows)
if: matrix.os == 'windows'
run: make all
- name: Make CI (Non-windows)
if: matrix.os != 'windows'
run: make ci
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: branches: - main concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: build: timeout-minutes: 30 name: Build ${{ matrix.os }} (Node ${{ matrix.node-version }}, Python ${{ matrix.python-version }} ) runs-on: ${{ matrix.os }}-latest strategy: fail-fast: false matrix: os: [ ubuntu, windows, macos ] python-version: [3.11, 3.12, 3.14] include: - python-version: 3.11 node-version: 22 - python-version: 3.12 node-version: 24 - python-version: 3.14 node-version: 26 steps: - uses: actions/checkout@v7 - name: Set up Node ${{ matrix.node-version }} uses: actions/setup-node@v6 with: cache: 'npm' node-version: ${{ matrix.node-version }} - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} - name: Cached node_modules uses: actions/cache@v6 with: path: node_modules key: ${{ runner.os }}-node-${{ hashFiles('**/package*.json') }} restore-keys: | ${{ runner.os }}-node- - name: Make all (Windows) if: matrix.os == 'windows' run: make all - name: Make CI (Non-windows) if: matrix.os != 'windows' run: make ci
What changed
- Cancel superseded runs when a branch or PR gets a newer push.
- Cache dependency installs on the setup step so they are served from cache.
- Add a job timeout so a hung step cannot burn hours of runner time.
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.