Skip to content
Latchkey

Test workflow (blocks/blocks)

The Test workflow from blocks/blocks, 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: blocks/blocks.github/workflows/test.ymlLicense MITView source

What it does

This is the Test workflow from the blocks/blocks 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: Test

on: [push, pull_request]

jobs:
  build-and-test:
    name: 'Build on ${{ matrix.platform }} with node.js ${{ matrix.node-version }}'
    strategy:
      matrix:
        platform: [ubuntu-latest, windows-latest, macos-latest]
        node-version: [12]
    runs-on: ${{ matrix.platform }}
    steps:
      - name: Checkout
        uses: actions/checkout@master

      - name: Set up Node.js
        uses: actions/setup-node@master
        with:
          node-version: ${{ matrix.node-version }}

      - name: Install
        run: yarn

      - name: Test
        run: yarn test

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: Test
 
on: [push, pull_request]
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  build-and-test:
    timeout-minutes: 30
    name: 'Build on ${{ matrix.platform }} with node.js ${{ matrix.node-version }}'
    strategy:
      matrix:
        platform: [ubuntu-latest, windows-latest, macos-latest]
        node-version: [12]
    runs-on: ${{ matrix.platform }}
    steps:
      - name: Checkout
        uses: actions/checkout@master
 
      - name: Set up Node.js
        uses: actions/setup-node@master
        with:
          cache: 'npm'
          node-version: ${{ matrix.node-version }}
 
      - name: Install
        run: yarn
 
      - name: Test
        run: yarn test
 

What changed

This workflow runs 1 job (3 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