Exercises check workflow (exercism/python)
The Exercises check workflow from exercism/python, explained and optimized by Latchkey.
CI health: D - needs work
Point runs-on at Latchkey and get caching, run de-duplication, job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Exercises check workflow from the exercism/python 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
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Exercises check
on:
push:
branches:
- main
pull_request:
jobs:
housekeeping:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
- name: Set up Python
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1
with:
python-version: 3.13.5
- name: Download & Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 requests
git clone https://github.com/exercism/problem-specifications .problem-specifications
pip install -r requirements-generator.txt
# - name: Check readmes
# run: |
# ./bin/check-readmes.sh
- name: Generate tests
run: |
bin/generate_tests.py --verbose -p .problem-specifications --check
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test template status
continue-on-error: true
run: |
./bin/template_status.py -v -p .problem-specifications
canonical_sync:
runs-on: ubuntu-24.04
needs: housekeeping
strategy:
matrix:
python-version: [3.10.6, 3.11.2, 3.12, 3.13.5]
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1
with:
python-version: ${{ matrix.python-version }}
- name: Install pytest
run: pip install pytest~=8.4.0
- name: Check exercises
run: |
./bin/test_exercises.py
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.
# This workflow will install Python dependencies, run tests and lint with a single version of Python # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions name: Exercises check on: push: branches: - main pull_request: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: housekeeping: timeout-minutes: 30 runs-on: latchkey-small steps: - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 - name: Set up Python uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 with: cache: 'pip' python-version: 3.13.5 - name: Download & Install dependencies run: | python -m pip install --upgrade pip pip install flake8 requests git clone https://github.com/exercism/problem-specifications .problem-specifications pip install -r requirements-generator.txt # - name: Check readmes # run: | # ./bin/check-readmes.sh - name: Generate tests run: | bin/generate_tests.py --verbose -p .problem-specifications --check - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Test template status continue-on-error: true run: | ./bin/template_status.py -v -p .problem-specifications canonical_sync: timeout-minutes: 30 runs-on: latchkey-small needs: housekeeping strategy: matrix: python-version: [3.10.6, 3.11.2, 3.12, 3.13.5] steps: - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 with: cache: 'pip' python-version: ${{ matrix.python-version }} - name: Install pytest run: pip install pytest~=8.4.0 - name: Check exercises run: | ./bin/test_exercises.py
What changed
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - 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.
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 2 jobs (5 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.