tests workflow (horejsek/python-fastjsonschema)
The tests workflow from horejsek/python-fastjsonschema, 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 →What it does
This is the tests workflow from the horejsek/python-fastjsonschema 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
workflow (.yml)
name: tests
on: [push, pull_request, workflow_dispatch]
concurrency:
group: >-
${{ github.workflow }}-
${{ github.ref_type }}-
${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
test:
strategy:
matrix:
python:
- "3.10" # oldest Python supported by PSF
- "3.11"
- "3.12"
- "3.13"
- "3.14" # newest Python that is stable
platform:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Run tests
run: pipx run tox -e py -- -vvv
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: tests on: [push, pull_request, workflow_dispatch] concurrency: group: >- ${{ github.workflow }}- ${{ github.ref_type }}- ${{ github.event.pull_request.number || github.sha }} cancel-in-progress: true jobs: test: timeout-minutes: 30 strategy: matrix: python: - "3.10" # oldest Python supported by PSF - "3.11" - "3.12" - "3.13" - "3.14" # newest Python that is stable platform: - ubuntu-latest - macos-latest - windows-latest runs-on: ${{ matrix.platform }} steps: - uses: actions/checkout@v2 - name: Setup Python uses: actions/setup-python@v2 with: cache: 'pip' python-version: ${{ matrix.python }} - name: Run tests run: pipx run tox -e py -- -vvv
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.
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.