Build-Test-Multi-Scipy-Numpy workflow (CalebBell/ht)
The Build-Test-Multi-Scipy-Numpy workflow from CalebBell/ht, explained and optimized by Latchkey.
CI health: B - good
Point runs-on at Latchkey and get job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Build-Test-Multi-Scipy-Numpy workflow from the CalebBell/ht 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-Test-Multi-Scipy-Numpy
on:
push:
branches: [release]
pull_request:
branches: [master, release]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/release' }}
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
numpy: ['2.0.1'] #['1.16.5', '1.18.5', '1.20.3', '1.22.4', '1.24.4', '1.26.4', '2.0.1']
scipy: ['1.14.0'] #['1.7.3', '1.8.1', '1.9.3', '1.10.1', '1.12.0', '1.14.0']
python-version: ['3.10'] #['3.7', '3.8', '3.9', '3.10']
os: [ubuntu-latest]
architecture: ['x64']
include:
- numpy: '1.24.4'
scipy: '1.9.3'
python-version: '3.10'
- numpy: '1.24.4'
scipy: '1.12.0'
python-version: '3.9'
- numpy: '1.26.4'
scipy: '1.10.1'
python-version: '3.9'
- numpy: '1.26.4'
scipy: '1.12.0'
python-version: '3.9'
- numpy: '1.26.4'
scipy: '1.14.0'
python-version: '3.10'
- numpy: '2.0.1'
scipy: '1.14.0'
python-version: '3.10'
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"
- name: Install Just
uses: extractions/setup-just@v2
- name: Run tests with specific Python/NumPy/SciPy versions
run: just test-multi-single ${{ matrix.python-version }} ${{ matrix.numpy }} ${{ matrix.scipy }}
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Build-Test-Multi-Scipy-Numpy on: push: branches: [release] pull_request: branches: [master, release] concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/release' }} jobs: build: timeout-minutes: 30 runs-on: latchkey-small strategy: fail-fast: false matrix: numpy: ['2.0.1'] #['1.16.5', '1.18.5', '1.20.3', '1.22.4', '1.24.4', '1.26.4', '2.0.1'] scipy: ['1.14.0'] #['1.7.3', '1.8.1', '1.9.3', '1.10.1', '1.12.0', '1.14.0'] python-version: ['3.10'] #['3.7', '3.8', '3.9', '3.10'] os: [ubuntu-latest] architecture: ['x64'] include: - numpy: '1.24.4' scipy: '1.9.3' python-version: '3.10' - numpy: '1.24.4' scipy: '1.12.0' python-version: '3.9' - numpy: '1.26.4' scipy: '1.10.1' python-version: '3.9' - numpy: '1.26.4' scipy: '1.12.0' python-version: '3.9' - numpy: '1.26.4' scipy: '1.14.0' python-version: '3.10' - numpy: '2.0.1' scipy: '1.14.0' python-version: '3.10' steps: - uses: actions/checkout@v4 - name: Install uv uses: astral-sh/setup-uv@v4 with: enable-cache: true cache-dependency-glob: "pyproject.toml" - name: Install Just uses: extractions/setup-just@v2 - name: Run tests with specific Python/NumPy/SciPy versions run: just test-multi-single ${{ matrix.python-version }} ${{ matrix.numpy }} ${{ matrix.scipy }}
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. - Add a job timeout so a hung step cannot burn hours of runner time.
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 per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.