Regression and Version Tests workflow (pmorissette/bt)
The Regression and Version Tests workflow from pmorissette/bt, explained and optimized by Latchkey.
CI health: A - excellent
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 Regression and Version Tests 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: Regression and Version Tests
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 }}
environment: dev
strategy:
matrix:
python-version:
- 3.11
os:
- ubuntu-latest
pandas_version:
- '>=1,<2'
- '>=2,<3'
- '>=3,<4'
numpy_version:
- '<2'
- '>=2'
exclude:
- numpy_version: '>=2'
pandas_version: '>=1,<2'
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: 'pyproject.toml'
- name: Install dependencies
run: make develop
- name: Install specific pandas and numpy versions
run: pip install "pandas${{ matrix.pandas_version }}" "numpy${{ matrix.numpy_version }}"
- name: Test
run: make test
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Regression and Version Tests 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 }} environment: dev strategy: matrix: python-version: - 3.11 os: - ubuntu-latest pandas_version: - '>=1,<2' - '>=2,<3' - '>=3,<4' numpy_version: - '<2' - '>=2' exclude: - numpy_version: '>=2' pandas_version: '>=1,<2' steps: - name: Checkout uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 with: python-version: ${{ matrix.python-version }} cache: 'pip' cache-dependency-path: 'pyproject.toml' - name: Install dependencies run: make develop - name: Install specific pandas and numpy versions run: pip install "pandas${{ matrix.pandas_version }}" "numpy${{ matrix.numpy_version }}" - name: Test run: make test
What changed
- 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 (6 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.