Skip to content
Latchkey

Build wheels workflow (astropy/halotools)

The Build wheels workflow from astropy/halotools, explained and optimized by Latchkey.

C

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 →
Source: astropy/halotools.github/workflows/wheels.yamlLicense BSD-3-ClauseView source

What it does

This is the Build wheels workflow from the astropy/halotools 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

workflow (.yml)
name: Build wheels

on:
  workflow_dispatch:
  release:
    types:
      - published

jobs:
  build_wheels:
    name: Build wheels on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-22.04, macos-latest]

    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0  # v7.0.0

      # Used to host cibuildwheel
      - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1  # v6.3.0

      - name: Install cibuildwheel
        run: python -m pip install cibuildwheel==2.10.0

      - name: Build wheels
        # uses: pypa/cibuildwheel@d4a2945fcc8d13f20a1b99d461b8e844d5fc6e23  # v2.21.1
        run: python -m cibuildwheel --output-dir wheelhouse
        env:
          CIBW_BEFORE_BUILD: pip install numpy>=2 Cython extension-helpers
          CIBW_PROJECT_REQUIRES_PYTHON: ">=3.11"
          CIBW_SKIP: pp*

      - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a  # v7.0.1
        with:
          name: wheels-${{ matrix.os }}
          path: ./wheelhouse/*.whl

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 wheels
 
on:
  workflow_dispatch:
  release:
    types:
      - published
 
jobs:
  build_wheels:
    timeout-minutes: 30
    name: Build wheels on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-22.04, macos-latest]
 
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0  # v7.0.0
 
      # Used to host cibuildwheel
      - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1  # v6.3.0
        with:
          cache: 'pip'
 
      - name: Install cibuildwheel
        run: python -m pip install cibuildwheel==2.10.0
 
      - name: Build wheels
        # uses: pypa/cibuildwheel@d4a2945fcc8d13f20a1b99d461b8e844d5fc6e23  # v2.21.1
        run: python -m cibuildwheel --output-dir wheelhouse
        env:
          CIBW_BEFORE_BUILD: pip install numpy>=2 Cython extension-helpers
          CIBW_PROJECT_REQUIRES_PYTHON: ">=3.11"
          CIBW_SKIP: pp*
 
      - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a  # v7.0.1
        with:
          name: wheels-${{ matrix.os }}
          path: ./wheelhouse/*.whl
 

What changed

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:

This workflow runs 1 job (2 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow