Skip to content
Latchkey

CI workflow (cssstats/cssstats)

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

What it does

This is the CI workflow from the cssstats/cssstats 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:
  default:
    name: Build and test on ${{ matrix.os }} with node v${{ matrix.node }}
    strategy:
      matrix:
        os: [ubuntu-latest]
        node: [12, 14]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v1

      - uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node }}

      - name: Setup yarn
        if: matrix.os != 'windows-latest'
        run: |
          curl -o- -L https://yarnpkg.com/install.sh | bash
          export PATH="$HOME/.yarn/bin:$PATH"

      - name: Get yarn cache
        id: yarn-cache
        run: echo "::set-output name=dir::$(yarn cache dir)"

      - uses: actions/cache@v1
        with:
          path: ${{ steps.yarn-cache.outputs.dir }}
          key: ${{ matrix.os }}-${{ matrix.node }}-yarn-${{ hashFiles('**/yarn.lock') }}
          restore-keys: |
            ${{ matrix.os }}-${{ matrix.node }}-yarn-

      - name: Install Dependencies
        run: yarn --frozen-lockfile
        env:
          CI: 'true'

      - name: Test
        run: yarn test
        env:
          CI: 'true'

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, pull_request]
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  default:
    timeout-minutes: 30
    name: Build and test on ${{ matrix.os }} with node v${{ matrix.node }}
    strategy:
      matrix:
        os: [ubuntu-latest]
        node: [12, 14]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v1
 
      - uses: actions/setup-node@v1
        with:
          cache: 'npm'
          node-version: ${{ matrix.node }}
 
      - name: Setup yarn
        if: matrix.os != 'windows-latest'
        run: |
          curl -o- -L https://yarnpkg.com/install.sh | bash
          export PATH="$HOME/.yarn/bin:$PATH"
 
      - name: Get yarn cache
        id: yarn-cache
        run: echo "::set-output name=dir::$(yarn cache dir)"
 
      - uses: actions/cache@v1
        with:
          path: ${{ steps.yarn-cache.outputs.dir }}
          key: ${{ matrix.os }}-${{ matrix.node }}-yarn-${{ hashFiles('**/yarn.lock') }}
          restore-keys: |
            ${{ matrix.os }}-${{ matrix.node }}-yarn-
 
      - name: Install Dependencies
        run: yarn --frozen-lockfile
        env:
          CI: 'true'
 
      - name: Test
        run: yarn test
        env:
          CI: 'true'
 

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 1 job (2 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