Testing workflow (gmr/rabbitpy)
The Testing workflow from gmr/rabbitpy, explained and optimized by Latchkey.
CI health: B - good
Point runs-on at Latchkey and get run de-duplication, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Testing workflow from the gmr/rabbitpy 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
name: Testing
on:
pull_request:
push:
branches: [main]
paths-ignore:
- 'docs/**'
- '*.md'
- '*.rst'
tags-ignore: ["*"]
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
python: ["3.11", "3.12", "3.13", "3.14"]
services:
rabbitmq:
image: rabbitmq:4-management
ports:
- 5672:5672
- 15672:15672
options: >-
--health-cmd "rabbitmq-diagnostics -q check_running"
--health-interval 10s
--health-timeout 5s
--health-retries 10
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: uv sync --all-groups
- name: Write .env for integration tests
run: |
echo "RABBITMQ_URL=amqp://guest:guest@localhost:5672/%2f" >> .env
echo "MANAGEMENT_URL=http://localhost:15672/%2f" >> .env
- name: Lint Check
run: uv run pre-commit run --all-files
- name: Run tests
run: uv run coverage run
- name: Coverage report
run: uv run coverage report
- name: Coverage XML
run: uv run coverage xml
- name: Upload Coverage
uses: codecov/codecov-action@v5
with:
files: ./build/coverage.xml
flags: unittests
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Testing on: pull_request: push: branches: [main] paths-ignore: - 'docs/**' - '*.md' - '*.rst' tags-ignore: ["*"] concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: test: runs-on: latchkey-small timeout-minutes: 10 strategy: fail-fast: false matrix: python: ["3.11", "3.12", "3.13", "3.14"] services: rabbitmq: image: rabbitmq:4-management ports: - 5672:5672 - 15672:15672 options: >- --health-cmd "rabbitmq-diagnostics -q check_running" --health-interval 10s --health-timeout 5s --health-retries 10 steps: - name: Checkout repository uses: actions/checkout@v5 - name: Install uv uses: astral-sh/setup-uv@v6 with: python-version: ${{ matrix.python }} - name: Install dependencies run: uv sync --all-groups - name: Write .env for integration tests run: | echo "RABBITMQ_URL=amqp://guest:guest@localhost:5672/%2f" >> .env echo "MANAGEMENT_URL=http://localhost:15672/%2f" >> .env - name: Lint Check run: uv run pre-commit run --all-files - name: Run tests run: uv run coverage run - name: Coverage report run: uv run coverage report - name: Coverage XML run: uv run coverage xml - name: Upload Coverage uses: codecov/codecov-action@v5 with: files: ./build/coverage.xml flags: unittests
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.
2 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.
This workflow runs 1 job (4 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.