smoke workflow (google/docsy)
The smoke workflow from google/docsy, explained and optimized by Latchkey.
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 →What it does
This is the smoke 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
# Smoke test across OSs: build a Docsy-based site from scratch,
# using Docsy as hugo module and fetching Docsy via NPM.
# cSpell:ignore docsy github
name: smoke
on:
push:
branches: [main]
pull_request:
# schedule: # midnight every day
# - cron: '0 0 * * *'
workflow_dispatch:
permissions:
contents: read
jobs:
new-site:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest]
docsy-src: [NPM, HUGO_MODULE]
env:
BASE_REPO: ${{ github.repository }}
BRANCH: ${{ github.head_ref }}
PR_REPO: ${{ github.event.pull_request.head.repo.full_name }}
SHA: ${{ github.sha }}
# TODO: drop PR testing under Windows because it's too slow?
# if: github.event_name != 'pull_request' && matrix.os != 'windows-latest'
if: github.event_name != 'push' || github.repository == 'google/docsy'
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
cache: npm
cache-dependency-path: package.json
- name: Setup workspace
run: |
npm install --omit=optional
mkdir -p tmp && cd tmp && npm init -y
shell: bash
- name: Make site (non-PR)
if: github.event_name != 'pull_request'
working-directory: tmp
run: ../scripts/make-site.sh -s ${{ matrix.docsy-src }} -r $BASE_REPO -v $SHA
shell: bash
- name: Make site from PR
if: github.event_name == 'pull_request'
working-directory: tmp
run: ../scripts/make-site.sh -s ${{ matrix.docsy-src }} -r $PR_REPO -v $BRANCH
shell: bash
- uses: actions/upload-artifact@v6
with:
name: tmp-site-${{ matrix.os }}-${{ matrix.docsy-src }}
path: |
tmp
!**/node_modules
!**/resources
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
# Smoke test across OSs: build a Docsy-based site from scratch, # using Docsy as hugo module and fetching Docsy via NPM. # cSpell:ignore docsy github name: smoke on: push: branches: [main] pull_request: # schedule: # midnight every day # - cron: '0 0 * * *' workflow_dispatch: permissions: contents: read concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: new-site: timeout-minutes: 30 runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [windows-latest, ubuntu-latest] docsy-src: [NPM, HUGO_MODULE] env: BASE_REPO: ${{ github.repository }} BRANCH: ${{ github.head_ref }} PR_REPO: ${{ github.event.pull_request.head.repo.full_name }} SHA: ${{ github.sha }} # TODO: drop PR testing under Windows because it's too slow? # if: github.event_name != 'pull_request' && matrix.os != 'windows-latest' if: github.event_name != 'push' || github.repository == 'google/docsy' steps: - uses: actions/checkout@v6 - uses: actions/setup-node@v6 with: node-version-file: .nvmrc cache: npm cache-dependency-path: package.json - name: Setup workspace run: | npm install --omit=optional mkdir -p tmp && cd tmp && npm init -y shell: bash - name: Make site (non-PR) if: github.event_name != 'pull_request' working-directory: tmp run: ../scripts/make-site.sh -s ${{ matrix.docsy-src }} -r $BASE_REPO -v $SHA shell: bash - name: Make site from PR if: github.event_name == 'pull_request' working-directory: tmp run: ../scripts/make-site.sh -s ${{ matrix.docsy-src }} -r $PR_REPO -v $BRANCH shell: bash - uses: actions/upload-artifact@v6 with: name: tmp-site-${{ matrix.os }}-${{ matrix.docsy-src }} path: | tmp !**/node_modules !**/resources
What changed
- Cancel superseded runs when a branch or PR gets a newer push.
- Add a job timeout so a hung step cannot burn hours of runner time.
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:
- Dependency installs
This workflow runs 1 job (4 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.