Skip to content
Latchkey

test workflow (google/docsy)

The test workflow from google/docsy, explained and optimized by Latchkey.

C

CI health: C - fair

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: google/docsy.github/workflows/test.yamlLicense Apache-2.0View source

What it does

This is the test workflow from the google/docsy repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
# Build Docsy & the website and run all repo checks across OSs.
# cSpell:ignore docsy

name: test

on:
  push:
    branches: [main]
  pull_request:
  # schedule:
  #   - cron: '11 0 * * *' # 11 past midnight every day
  workflow_dispatch:
permissions:
  contents: read

jobs:
  build:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [windows-latest, ubuntu-latest]
    steps:
      - uses: actions/checkout@v6

      - uses: actions/setup-node@v6
        with:
          node-version-file: .nvmrc
          cache: npm
          cache-dependency-path: package.json

      - run: npm install --omit=optional

      # Put lychee on PATH for the link checker (ci:test runs on Linux only).
      - if: runner.os != 'Windows'
        name: Install lychee
        env:
          LYCHEE_VERSION: v0.24.2
        run: |
          tmp="$(mktemp -d)"
          curl -sfL "https://github.com/lycheeverse/lychee/releases/download/lychee-${LYCHEE_VERSION}/lychee-x86_64-unknown-linux-gnu.tar.gz" \
            | tar -xz -C "$tmp"
          install -D "$(find "$tmp" -type f -name lychee | head -n1)" "$HOME/.local/bin/lychee"
          echo "$HOME/.local/bin" >> "$GITHUB_PATH"

      - if: runner.os != 'Windows'
        run: npm run ci:test

      # Offline lychee canaries; Linux-only, like ci:test (no lychee on Windows).
      - if: runner.os != 'Windows'
        name: Lychee sanity tests (offline)
        env: { LYCHEE_SANITY_NO_NET: 1 }
        run: npm run test:lychee

      - if: runner.os == 'Windows'
        run: npm run ci:prepare && npm run -C docsy.dev build && npm run ci:post

      - uses: actions/upload-artifact@v6
        with:
          name: test-site-${{ matrix.os }}
          path: |
            docsy.dev/public

The same workflow, on Latchkey

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

# Build Docsy & the website and run all repo checks across OSs.
# cSpell:ignore docsy
 
name: test
 
on:
  push:
    branches: [main]
  pull_request:
  # schedule:
  #   - cron: '11 0 * * *' # 11 past midnight every day
  workflow_dispatch:
permissions:
  contents: read
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  build:
    timeout-minutes: 30
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [windows-latest, ubuntu-latest]
    steps:
      - uses: actions/checkout@v6
 
      - uses: actions/setup-node@v6
        with:
          node-version-file: .nvmrc
          cache: npm
          cache-dependency-path: package.json
 
      - run: npm install --omit=optional
 
      # Put lychee on PATH for the link checker (ci:test runs on Linux only).
      - if: runner.os != 'Windows'
        name: Install lychee
        env:
          LYCHEE_VERSION: v0.24.2
        run: |
          tmp="$(mktemp -d)"
          curl -sfL "https://github.com/lycheeverse/lychee/releases/download/lychee-${LYCHEE_VERSION}/lychee-x86_64-unknown-linux-gnu.tar.gz" \
            | tar -xz -C "$tmp"
          install -D "$(find "$tmp" -type f -name lychee | head -n1)" "$HOME/.local/bin/lychee"
          echo "$HOME/.local/bin" >> "$GITHUB_PATH"
 
      - if: runner.os != 'Windows'
        run: npm run ci:test
 
      # Offline lychee canaries; Linux-only, like ci:test (no lychee on Windows).
      - if: runner.os != 'Windows'
        name: Lychee sanity tests (offline)
        env: { LYCHEE_SANITY_NO_NET: 1 }
        run: npm run test:lychee
 
      - if: runner.os == 'Windows'
        run: npm run ci:prepare && npm run -C docsy.dev build && npm run ci:post
 
      - uses: actions/upload-artifact@v6
        with:
          name: test-site-${{ matrix.os }}
          path: |
            docsy.dev/public
 

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