Test workflow (beancount/fava)
The Test workflow from beancount/fava, 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 →What it does
This is the Test workflow from the beancount/fava 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:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: read
jobs:
test-py:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu-latest"]
py: ["3.13", "3.10"]
make_target: ["test-py", "test-py-old-deps"]
include:
- os: "macos-latest"
make_target: "test-py"
py: "3.13"
- os: "windows-latest"
make_target: "test-py"
py: "3.13"
- os: "ubuntu-latest"
make_target: "test-py"
py: "3.14"
- os: "ubuntu-latest"
make_target: "test-py-typeguard"
py: "3.14"
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: ${{ matrix.py }}
- uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
enable-cache: false
- run: touch src/fava/static/app.js
- run: make ${{ matrix.make_target }}
test-js:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
node: ["lts/*"]
include:
- os: "ubuntu-latest"
node: "current"
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: ${{ matrix.node }}
package-manager-cache: false
- run: make frontend/node_modules
- run: cd frontend && npm run build
- run: cd frontend && npm test
deno-js:
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- uses: denoland/setup-deno@22d081ff2d3a40755e97629de92e3bcbfa7cf2ed # v2.0.5
with:
deno-version: "v2.8.x"
- run: cd frontend && deno install
- run: cd frontend && deno lint
- run: cd frontend && deno run build
lint-js:
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: "3.13"
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: "lts/*"
package-manager-cache: false
- uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
enable-cache: false
- run: make frontend/node_modules
- run: uv run --no-dev --group pre-commit pre-commit run -a eslint
- run: uv run --no-dev --group pre-commit pre-commit run -a stylelint
- run: cd frontend; npx tsc
- run: cd frontend; npx svelte-check
lint-python-mypy:
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: "3.13"
- uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
enable-cache: false
- run: touch src/fava/static/app.js
- run: make mypy
lint-python-ty:
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: "3.13"
- uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
enable-cache: false
- run: touch src/fava/static/app.js
- run: make ty
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: workflow_dispatch: push: branches: - main pull_request: branches: - main permissions: contents: read concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: test-py: timeout-minutes: 30 runs-on: ${{ matrix.os }} strategy: matrix: os: ["ubuntu-latest"] py: ["3.13", "3.10"] make_target: ["test-py", "test-py-old-deps"] include: - os: "macos-latest" make_target: "test-py" py: "3.13" - os: "windows-latest" make_target: "test-py" py: "3.13" - os: "ubuntu-latest" make_target: "test-py" py: "3.14" - os: "ubuntu-latest" make_target: "test-py-typeguard" py: "3.14" steps: - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 with: python-version: ${{ matrix.py }} - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 with: enable-cache: false - run: touch src/fava/static/app.js - run: make ${{ matrix.make_target }} test-js: timeout-minutes: 30 runs-on: ${{ matrix.os }} strategy: matrix: os: ["ubuntu-latest", "macos-latest", "windows-latest"] node: ["lts/*"] include: - os: "ubuntu-latest" node: "current" steps: - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 with: cache: 'npm' node-version: ${{ matrix.node }} package-manager-cache: false - run: make frontend/node_modules - run: cd frontend && npm run build - run: cd frontend && npm test deno-js: timeout-minutes: 30 runs-on: "ubuntu-latest" steps: - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false - uses: denoland/setup-deno@22d081ff2d3a40755e97629de92e3bcbfa7cf2ed # v2.0.5 with: deno-version: "v2.8.x" - run: cd frontend && deno install - run: cd frontend && deno lint - run: cd frontend && deno run build lint-js: timeout-minutes: 30 runs-on: "ubuntu-latest" steps: - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 with: python-version: "3.13" - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 with: cache: 'npm' node-version: "lts/*" package-manager-cache: false - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 with: enable-cache: false - run: make frontend/node_modules - run: uv run --no-dev --group pre-commit pre-commit run -a eslint - run: uv run --no-dev --group pre-commit pre-commit run -a stylelint - run: cd frontend; npx tsc - run: cd frontend; npx svelte-check lint-python-mypy: timeout-minutes: 30 runs-on: "ubuntu-latest" steps: - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 with: python-version: "3.13" - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 with: enable-cache: false - run: touch src/fava/static/app.js - run: make mypy lint-python-ty: timeout-minutes: 30 runs-on: "ubuntu-latest" steps: - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 with: python-version: "3.13" - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 with: enable-cache: false - run: touch src/fava/static/app.js - run: make ty
What changed
- Cancel superseded runs when a branch or PR gets a newer push.
- 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.
This workflow runs 6 jobs (11 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.