Python application workflow (Mause/duckdb_engine)
The Python application workflow from Mause/duckdb_engine, explained and optimized by Latchkey.
CI health: C - fair
Point runs-on at Latchkey and get run de-duplication, job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Python application workflow from the Mause/duckdb_engine 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
name: Python application
on: [pull_request, workflow_dispatch]
permissions:
checks: write
jobs:
build_backend:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: [3.9, "3.10"]
env:
FORCE_COLOR: 1
steps:
- uses: actions/checkout@v5
- name: Remove cached duckdb extensions
run: rm -rf ~/.duckdb
- uses: fjwillemsen/setup-nox2@v3.0.0
- run: python -m pip install github-action-utils uv -U
- name: List nox envs
run: nox -l
- run: nox --pythons '${{ matrix.python }}'
- run: uvx poetry build
- run: uvx poetry check --strict
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: results.xml
comment_mode: off
check_name: "Test Results - ${{ join(matrix.*, ', ') }}"
- uses: codecov/codecov-action@v5.5.1
env:
PYTHON: ${{matrix.python}}
BLEEDING_EDGE: ${{matrix.bleeding_edge}}
with:
files: ./coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
env_vars: PYTHON # ,BLEEDING_EDGE # set from matrix
fail_ci_if_error: true
verbose: true
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Python application on: [pull_request, workflow_dispatch] permissions: checks: write concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: build_backend: timeout-minutes: 30 runs-on: latchkey-small strategy: fail-fast: false matrix: python: [3.9, "3.10"] env: FORCE_COLOR: 1 steps: - uses: actions/checkout@v5 - name: Remove cached duckdb extensions run: rm -rf ~/.duckdb - uses: fjwillemsen/setup-nox2@v3.0.0 - run: python -m pip install github-action-utils uv -U - name: List nox envs run: nox -l - run: nox --pythons '${{ matrix.python }}' - run: uvx poetry build - run: uvx poetry check --strict - name: Publish Unit Test Results uses: EnricoMi/publish-unit-test-result-action@v2 if: always() with: files: results.xml comment_mode: off check_name: "Test Results - ${{ join(matrix.*, ', ') }}" - uses: codecov/codecov-action@v5.5.1 env: PYTHON: ${{matrix.python}} BLEEDING_EDGE: ${{matrix.bleeding_edge}} with: files: ./coverage.xml token: ${{ secrets.CODECOV_TOKEN }} env_vars: PYTHON # ,BLEEDING_EDGE # set from matrix fail_ci_if_error: true verbose: true
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.
- Add a job timeout so a hung step cannot burn hours of runner time.
3 third-party actions are referenced by a movable tag. Pin them 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 (2 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.