Test against downstream projects workflow (agronholm/anyio)
The Test against downstream projects workflow from agronholm/anyio, explained and optimized by Latchkey.
CI health: C - fair
Point runs-on at Latchkey and get caching, job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Test against downstream projects workflow from the agronholm/anyio 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: Test against downstream projects
on:
workflow_dispatch:
jobs:
starlette:
name: "Starlette on Python ${{ matrix.python-version }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.14"]
steps:
- uses: actions/checkout@v7
with:
repository: Kludex/starlette
- uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
- name: Install dependencies
run: |
scripts/install
pip install anyio[trio]@git+https://github.com/agronholm/anyio.git@${{ github.ref_name }}
- name: Run tests
run: scripts/test
- name: Enforce coverage
run: scripts/coverage
httpcore:
name: "Httpcore on Python ${{ matrix.python-version }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.14"]
steps:
- uses: actions/checkout@v7
with:
repository: encode/httpcore
- name: Install uv
uses: actions/setup-python@v6
with:
python-version: "${{ matrix.python-version }}"
- name: Install dependencies
run: |
scripts/install
pip install anyio[trio]@git+https://github.com/agronholm/anyio.git@${{ github.ref_name }}
- name: Run tests
run: scripts/test
- name: Enforce coverage
run: scripts/coverage
fastapi:
name: "FastAPI on Python ${{ matrix.python-version }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.14"]
env:
UV_SYSTEM_PYTHON: 1
steps:
- uses: actions/checkout@v7
with:
repository: tiangolo/fastapi
- uses: actions/setup-python@v6
with:
python-version: "${{ matrix.python-version }}"
- name: Setup uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
version: "0.11.18"
enable-cache: true
cache-dependency-glob: |
pyproject.toml
uv.lock
- name: Install dependencies
run: |
uv sync --no-dev --group tests --extra all
uv pip install anyio[trio]@git+https://github.com/agronholm/anyio.git@${{ github.ref_name }}
- name: Run tests
run: uv run --no-sync pytest -W ignore::UserWarning
env:
PYTHONPATH: ./docs_src
litestar:
name: "Litestar on Python ${{ matrix.python-version }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.14"]
steps:
- uses: actions/checkout@v7
with:
repository: litestar-org/litestar
- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
version: "0.8.8"
enable-cache: true
- name: Install dependencies
run: |
uv sync
uv pip install anyio[trio]@git+https://github.com/agronholm/anyio.git@${{ github.ref_name }}
- name: Test
run: uv run pytest docs/examples tests -n auto
mcp:
name: "Anthropic MCP on Python ${{ matrix.python-version }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.14"]
dep-resolution: ["lowest-direct", "highest"]
steps:
- uses: actions/checkout@v7
with:
repository: modelcontextprotocol/python-sdk
- name: Install uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
enable-cache: true
version: "0.9.5"
- name: Install the project
run: |
uv sync --frozen --all-extras --python ${{ matrix.python-version }} --resolution ${{ matrix.dep-resolution }}
uv pip install anyio[trio]@git+https://github.com/agronholm/anyio.git@${{ github.ref_name }}
- name: Run pytest
run: uv run --frozen --no-sync pytest
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 against downstream projects on: workflow_dispatch: jobs: starlette: timeout-minutes: 30 name: "Starlette on Python ${{ matrix.python-version }}" runs-on: latchkey-small strategy: fail-fast: false matrix: python-version: ["3.10", "3.14"] steps: - uses: actions/checkout@v7 with: repository: Kludex/starlette - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 with: python-version: ${{ matrix.python-version }} enable-cache: true - name: Install dependencies run: | scripts/install pip install anyio[trio]@git+https://github.com/agronholm/anyio.git@${{ github.ref_name }} - name: Run tests run: scripts/test - name: Enforce coverage run: scripts/coverage httpcore: timeout-minutes: 30 name: "Httpcore on Python ${{ matrix.python-version }}" runs-on: latchkey-small strategy: fail-fast: false matrix: python-version: ["3.10", "3.14"] steps: - uses: actions/checkout@v7 with: repository: encode/httpcore - name: Install uv uses: actions/setup-python@v6 with: cache: 'pip' python-version: "${{ matrix.python-version }}" - name: Install dependencies run: | scripts/install pip install anyio[trio]@git+https://github.com/agronholm/anyio.git@${{ github.ref_name }} - name: Run tests run: scripts/test - name: Enforce coverage run: scripts/coverage fastapi: timeout-minutes: 30 name: "FastAPI on Python ${{ matrix.python-version }}" runs-on: latchkey-small strategy: fail-fast: false matrix: python-version: ["3.10", "3.14"] env: UV_SYSTEM_PYTHON: 1 steps: - uses: actions/checkout@v7 with: repository: tiangolo/fastapi - uses: actions/setup-python@v6 with: cache: 'pip' python-version: "${{ matrix.python-version }}" - name: Setup uv uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 with: version: "0.11.18" enable-cache: true cache-dependency-glob: | pyproject.toml uv.lock - name: Install dependencies run: | uv sync --no-dev --group tests --extra all uv pip install anyio[trio]@git+https://github.com/agronholm/anyio.git@${{ github.ref_name }} - name: Run tests run: uv run --no-sync pytest -W ignore::UserWarning env: PYTHONPATH: ./docs_src litestar: timeout-minutes: 30 name: "Litestar on Python ${{ matrix.python-version }}" runs-on: latchkey-small strategy: fail-fast: false matrix: python-version: ["3.10", "3.14"] steps: - uses: actions/checkout@v7 with: repository: litestar-org/litestar - name: Set up python ${{ matrix.python-version }} uses: actions/setup-python@v6 with: cache: 'pip' python-version: ${{ matrix.python-version }} - name: Install uv uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 with: version: "0.8.8" enable-cache: true - name: Install dependencies run: | uv sync uv pip install anyio[trio]@git+https://github.com/agronholm/anyio.git@${{ github.ref_name }} - name: Test run: uv run pytest docs/examples tests -n auto mcp: timeout-minutes: 30 name: "Anthropic MCP on Python ${{ matrix.python-version }}" runs-on: latchkey-small strategy: fail-fast: false matrix: python-version: ["3.10", "3.14"] dep-resolution: ["lowest-direct", "highest"] steps: - uses: actions/checkout@v7 with: repository: modelcontextprotocol/python-sdk - name: Install uv uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 with: enable-cache: true version: "0.9.5" - name: Install the project run: | uv sync --frozen --all-extras --python ${{ matrix.python-version }} --resolution ${{ matrix.dep-resolution }} uv pip install anyio[trio]@git+https://github.com/agronholm/anyio.git@${{ github.ref_name }} - name: Run pytest run: uv run --frozen --no-sync pytest
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. - 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 5 jobs (12 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.