babel-loader workflow (babel/babel-loader)
The babel-loader workflow from babel/babel-loader, explained and optimized by Latchkey.
- C
- CI health grade
- 56/100
- Health score
- 2
- Jobs per trigger
- 3
- Fixes in the optimized version
In short
- CI health: C (fair)
- The optimized version below points runs-on at Latchkey managed runners and adds run de-duplication and job timeouts.
What it does
This is the babel-loader workflow from the babel/babel-loader 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
name: babel-loader
on: [push, pull_request]
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
test:
name: Test - ${{ matrix.os }} - Node ${{ matrix.node-version }}, Babel ${{ matrix.babel-version }}, Webpack ${{ matrix.webpack-version }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node-version: [22, 24]
babel-version: ["7", "8"]
webpack-version: ["5"]
include:
- node-version: "20"
webpack-version: "5"
babel-version: "7"
os: ubuntu-latest
- node-version: "18"
webpack-version: "5"
babel-version: "7"
os: ubuntu-latest
- node-version: "18"
webpack-version: "5"
babel-version: "7"
os: windows-latest
- node-version: "18.20.0" # The minimum supported node version
webpack-version: "5.61.0" # The minimum supported webpack version
babel-version: "7"
os: ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
- name: Install dependencies
run: yarn
- name: Install webpack ${{ matrix.webpack-version }}
run: yarn add -D webpack@${{ matrix.webpack-version }}
- name: Downgrade to Babel 7
if: matrix.babel-version == '7'
run: yarn up @babel/*@^7
- name: Build babel-loader
run: yarn run build
- name: Run tests for webpack version ${{ matrix.webpack-version }}
run: yarn test-only
lint-coverage:
name: Lint and Coverage - ${{ matrix.os }} - Node ${{ matrix.node-version }}, Webpack 5
strategy:
matrix:
os: [ubuntu-latest]
node-version: [latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
- name: Install dependencies
run: yarn
- name: Run tsc
run: yarn tsc
- name: Run lint and coverage tests
run: yarn test
- name: Submit coverage data to codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: babel-loader
on: [push, pull_request]
permissions:
contents: read # to fetch code (actions/checkout)
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
timeout-minutes: 30
name: Test - ${{ matrix.os }} - Node ${{ matrix.node-version }}, Babel ${{ matrix.babel-version }}, Webpack ${{ matrix.webpack-version }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node-version: [22, 24]
babel-version: ["7", "8"]
webpack-version: ["5"]
include:
- node-version: "20"
webpack-version: "5"
babel-version: "7"
os: ubuntu-latest
- node-version: "18"
webpack-version: "5"
babel-version: "7"
os: ubuntu-latest
- node-version: "18"
webpack-version: "5"
babel-version: "7"
os: windows-latest
- node-version: "18.20.0" # The minimum supported node version
webpack-version: "5.61.0" # The minimum supported webpack version
babel-version: "7"
os: ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
- name: Install dependencies
run: yarn
- name: Install webpack ${{ matrix.webpack-version }}
run: yarn add -D webpack@${{ matrix.webpack-version }}
- name: Downgrade to Babel 7
if: matrix.babel-version == '7'
run: yarn up @babel/*@^7
- name: Build babel-loader
run: yarn run build
- name: Run tests for webpack version ${{ matrix.webpack-version }}
run: yarn test-only
lint-coverage:
timeout-minutes: 30
name: Lint and Coverage - ${{ matrix.os }} - Node ${{ matrix.node-version }}, Webpack 5
strategy:
matrix:
os: [ubuntu-latest]
node-version: [latest]
runs-on: ${{ matrix.os }}
runs-on: latchkey-small
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
- name: Install dependencies
run: yarn
- name: Run tsc
run: yarn tsc
- name: Run lint and coverage tests
run: yarn test
- name: Submit coverage data to codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
What changed
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. Each Linux x64 job moves to the Latchkey size matching its vCPU count,latchkey-smallfor a standard 2 vCPU runner; macOS, Windows and arm64 jobs stay as written. - Cancel superseded runs when a branch or PR gets a newer push.
- Add a job timeout so a hung step cannot burn hours of runner time.
Left runs-on as written on the test job: matrix.os mixes Linux with Windows, which Latchkey does not run. Point only the Linux legs at Latchkey, for example with a matrix include entry that sets the runner.
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.
This workflow runs 2 jobs (9 with the matrix expanded) per trigger. 5 of the 9 run on a standard GitHub-hosted Linux x64 runner, which in a private repository bills $0.006 a minute against $0.0025 on latchkey-small, 58% lower; in a public repository like this one they are free. 4 of the 9 run on Windows, which Latchkey does not offer, so those stay where they are. Estimate the monthly difference with your own run counts.
Actions used in this workflow
- actions/checkout
- actions/setup-node
- codecov/codecov-action