Tests workflow (piglei/ai-vocabulary-builder)
The Tests workflow from piglei/ai-vocabulary-builder, 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 Tests workflow from the piglei/ai-vocabulary-builder repository, a real project running GitHub Actions. It is shown here with attribution under its BSD-3-Clause license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
name: Tests
on:
workflow_dispatch:
push:
paths-ignore:
- 'docs/**'
branches:
- master
- develop
pull_request:
paths-ignore:
- 'docs/**'
branches:
- '**'
concurrency:
group: tests-${{ github.head_ref || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
tests:
name: ${{ matrix.os }} / ${{ matrix.python-version }}
runs-on: ${{ matrix.image }}
strategy:
matrix:
os: [Ubuntu, macOS, Windows]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
include:
- os: Ubuntu
image: ubuntu-22.04
- os: Windows
image: windows-2022
- os: macOS
image: macos-14
fail-fast: true
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Setup uv
uses: astral-sh/setup-uv@v4
- name: Install Nox
run: uv pip install --system "nox==2024.10.9"
- name: Run tests on ${{ matrix.os }}
run: nox --non-interactive --error-on-missing-interpreter --session "tests(python='${{ matrix.python-version }}')" -- --full-traceThe 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: Tests on: workflow_dispatch: push: paths-ignore: - 'docs/**' branches: - master - develop pull_request: paths-ignore: - 'docs/**' branches: - '**' concurrency: group: tests-${{ github.head_ref || github.ref }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: tests: timeout-minutes: 30 name: ${{ matrix.os }} / ${{ matrix.python-version }} runs-on: ${{ matrix.image }} strategy: matrix: os: [Ubuntu, macOS, Windows] python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] include: - os: Ubuntu image: ubuntu-22.04 - os: Windows image: windows-2022 - os: macOS image: macos-14 fail-fast: true defaults: run: shell: bash steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: cache: 'pip' python-version: ${{ matrix.python-version }} allow-prereleases: true - name: Setup uv uses: astral-sh/setup-uv@v4 - name: Install Nox run: uv pip install --system "nox==2024.10.9" - name: Run tests on ${{ matrix.os }} run: nox --non-interactive --error-on-missing-interpreter --session "tests(python='${{ matrix.python-version }}')" -- --full-trace
What changed
- Cache dependency installs on the setup step so they are served from cache.
- Add a job timeout so a hung step cannot burn hours of runner time.
1 third-party action is referenced by a movable tag. Pin it to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.
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 (15 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.