Skip to content
Latchkey

Verify changes workflow (janl/mustache.js)

The Verify changes workflow from janl/mustache.js, explained and optimized by Latchkey.

D

CI health: D - needs work

Point runs-on at Latchkey and get caching, 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: janl/mustache.js.github/workflows/verify.ymlLicense MITView source

What it does

This is the Verify changes workflow from the janl/mustache.js 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: Verify changes

on: [push, pull_request]

jobs:
  lint:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
      - name: Setup Node.js
        uses: actions/setup-node@v1
        with:
          node-version: 14.x
      - run: npm install
      - run: npm run test-lint

  tests:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [10.x, 12.x, 14.x, 15.x]

    steps:
      - uses: actions/checkout@v2
        with:
          submodules: recursive
      - name: Setup Node.js
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
      - name: npm install and test
        run: |
          npm install
          npm run test-unit

  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
      - name: Setup Node.js
        uses: actions/setup-node@v1
        with:
          node-version: 14.x
      - name: npm install and build
        run: |
          npm install
          npm run build
      - name: Store build-output for later
        uses: actions/upload-artifact@v2
        with:
          name: build-output
          path: |
            mustache.js
            mustache.mjs

  tests-on-legacy:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [0.10.x, 0.12.x, 4.x, 6.x, 8.x]

    needs: build
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: recursive
      - name: Setup Node.js
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
      - name: Get build-output from build step
        uses: actions/download-artifact@v2
        with:
          name: build-output
      - name: npm install and test
        run: |
          npm install mocha@3 chai@3
          npm run test-unit

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: Verify changes
 
on: [push, pull_request]
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  lint:
    timeout-minutes: 30
    runs-on: latchkey-small
 
    steps:
      - uses: actions/checkout@v2
      - name: Setup Node.js
        uses: actions/setup-node@v1
        with:
          cache: 'npm'
          node-version: 14.x
      - run: npm install
      - run: npm run test-lint
 
  tests:
    timeout-minutes: 30
    runs-on: latchkey-small
 
    strategy:
      matrix:
        node-version: [10.x, 12.x, 14.x, 15.x]
 
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: recursive
      - name: Setup Node.js
        uses: actions/setup-node@v1
        with:
          cache: 'npm'
          node-version: ${{ matrix.node-version }}
      - name: npm install and test
        run: |
          npm install
          npm run test-unit
 
  build:
    timeout-minutes: 30
    runs-on: latchkey-small
 
    steps:
      - uses: actions/checkout@v2
      - name: Setup Node.js
        uses: actions/setup-node@v1
        with:
          cache: 'npm'
          node-version: 14.x
      - name: npm install and build
        run: |
          npm install
          npm run build
      - name: Store build-output for later
        uses: actions/upload-artifact@v2
        with:
          name: build-output
          path: |
            mustache.js
            mustache.mjs
 
  tests-on-legacy:
    timeout-minutes: 30
    runs-on: latchkey-small
 
    strategy:
      matrix:
        node-version: [0.10.x, 0.12.x, 4.x, 6.x, 8.x]
 
    needs: build
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: recursive
      - name: Setup Node.js
        uses: actions/setup-node@v1
        with:
          cache: 'npm'
          node-version: ${{ matrix.node-version }}
      - name: Get build-output from build step
        uses: actions/download-artifact@v2
        with:
          name: build-output
      - name: npm install and test
        run: |
          npm install mocha@3 chai@3
          npm run test-unit
 

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 4 jobs (11 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