Build Status workflow (pmorissette/bt)
The Build Status workflow from pmorissette/bt, explained and optimized by Latchkey.
CI health: C - fair
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 Build Status workflow from the pmorissette/bt 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: Build Status
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
python-version:
- 3.11
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
version: ${{ matrix.python-version }}
- name: Install dependencies
run: make develop
- name: Lint
run: make lint
- name: Test
run: make test
- name: Package and check
run: make dist
- name: Install cibuildwheel
run: python -m pip install cibuildwheel
- name: Set up QEMU
uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0
with:
platforms: all
if: runner.os == 'Linux'
- name: Build wheels
run: python -m cibuildwheel --output-dir dist
env:
CIBW_BUILD: "cp311-*"
CIBW_BEFORE_BUILD: "python -c \"from pathlib import Path; [p.unlink() for pattern in ('*.pyd', '*.so', '*.dylib') for p in Path('bt').glob(pattern)]\""
- name: Check Wheels
run: twine check dist/*
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
path: ./dist/*.whl
name: wheel-test-${{ runner.os }}-${{ runner.arch }}-${{ matrix.python-version }}
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: Build Status on: push: branches: - master pull_request: workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true jobs: build: timeout-minutes: 30 runs-on: ${{ matrix.os }} strategy: matrix: os: - ubuntu-latest - macos-latest - windows-latest python-version: - 3.11 steps: - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 with: cache: 'pip' version: ${{ matrix.python-version }} - name: Install dependencies run: make develop - name: Lint run: make lint - name: Test run: make test - name: Package and check run: make dist - name: Install cibuildwheel run: python -m pip install cibuildwheel - name: Set up QEMU uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0 with: platforms: all if: runner.os == 'Linux' - name: Build wheels run: python -m cibuildwheel --output-dir dist env: CIBW_BUILD: "cp311-*" CIBW_BEFORE_BUILD: "python -c \"from pathlib import Path; [p.unlink() for pattern in ('*.pyd', '*.so', '*.dylib') for p in Path('bt').glob(pattern)]\"" - name: Check Wheels run: twine check dist/* - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: path: ./dist/*.whl name: wheel-test-${{ runner.os }}-${{ runner.arch }}-${{ matrix.python-version }}
What changed
- 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 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.