CI workflow (smartbgp/yabgp)
The CI workflow from smartbgp/yabgp, explained and optimized by Latchkey.
CI health: F - at risk
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 CI workflow from the smartbgp/yabgp repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
# This workflow installs Python dependencies and runs tests on Python 3.13
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: CI
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
tests:
name: Tests
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
python-version: [ "3.13" ]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set up uv
uses: astral-sh/setup-uv@v5
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Sync dependencies
run: |
uv --version
uv sync --locked --group test --group dev
- name: Run tests
run: uv run pytest yabgp/tests/unit/ --tb=short -q
- name: Lint
run: uv run ruff check yabgp/
- name: Type check
run: uv run pyright -p pyrightconfig.json
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 installs Python dependencies and runs tests on Python 3.13 # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions name: CI on: push: branches: [ "master" ] pull_request: branches: [ "master" ] concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: tests: timeout-minutes: 30 name: Tests runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ ubuntu-latest, macos-latest, windows-latest ] python-version: [ "3.13" ] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: cache: 'pip' python-version: ${{ matrix.python-version }} - name: Set up uv uses: astral-sh/setup-uv@v5 - name: Display Python version run: python -c "import sys; print(sys.version)" - name: Sync dependencies run: | uv --version uv sync --locked --group test --group dev - name: Run tests run: uv run pytest yabgp/tests/unit/ --tb=short -q - name: Lint run: uv run ruff check yabgp/ - name: Type check run: uv run pyright -p pyrightconfig.json
What changed
- 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.
1 third-party action is referenced by a movable tag. Pin it to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.
This workflow runs 1 job (3 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.