Skip to content
Latchkey

CI workflow (babel/minify)

The CI workflow from babel/minify, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get 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: babel/minify.github/workflows/ci.ymlLicense MITView source

What it does

This is the CI workflow from the babel/minify 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, pull_request]

jobs:
  build:
    name: Build
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
      - name: Use Node.js latest
        uses: actions/setup-node@v3
        with:
          node-version: "*"
          cache: "yarn"
      - name: Bootstrap
        run: yarn && yarn bootstrap
      - name: Build
        run: yarn build
      - uses: actions/upload-artifact@v3
        with:
          name: lib
          path: |
            packages/*/lib/**/*
            utils/*/lib/**

  lint:
    name: Lint
    needs: build
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
      - name: Use Node.js latest
        uses: actions/setup-node@v3
        with:
          node-version: "*"
          cache: "yarn"
      - name: Install
        run: yarn
      - name: Lint
        run: yarn lint

  test:
    name: Test on Node.js # GitHub will add ${{ matrix.node-version }} to this title
    needs: build
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        node-version: [16, 14, 12, 10, 8, 6]
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
      - name: Use Node.js ${{ matrix.node-version }} # Checkout node version for test executor
        uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node-version }}
          cache: "yarn"
      - name: Install
        run: yarn && yarn bootstrap
      - uses: actions/download-artifact@v3
        with:
          name: lib
      - name: Test
        run: yarn test

The same workflow, on Latchkey

Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.

name: CI
 
on: [push, pull_request]
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  build:
    timeout-minutes: 30
    name: Build
    runs-on: latchkey-small
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
      - name: Use Node.js latest
        uses: actions/setup-node@v3
        with:
          node-version: "*"
          cache: "yarn"
      - name: Bootstrap
        run: yarn && yarn bootstrap
      - name: Build
        run: yarn build
      - uses: actions/upload-artifact@v3
        with:
          name: lib
          path: |
            packages/*/lib/**/*
            utils/*/lib/**
 
  lint:
    timeout-minutes: 30
    name: Lint
    needs: build
    runs-on: latchkey-small
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
      - name: Use Node.js latest
        uses: actions/setup-node@v3
        with:
          node-version: "*"
          cache: "yarn"
      - name: Install
        run: yarn
      - name: Lint
        run: yarn lint
 
  test:
    timeout-minutes: 30
    name: Test on Node.js # GitHub will add ${{ matrix.node-version }} to this title
    needs: build
    runs-on: latchkey-small
    strategy:
      fail-fast: false
      matrix:
        node-version: [16, 14, 12, 10, 8, 6]
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
      - name: Use Node.js ${{ matrix.node-version }} # Checkout node version for test executor
        uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node-version }}
          cache: "yarn"
      - name: Install
        run: yarn && yarn bootstrap
      - uses: actions/download-artifact@v3
        with:
          name: lib
      - name: Test
        run: yarn test
 

What changed

This workflow runs 3 jobs (8 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