Derive the newest Python for PR wheel builds and give CI jobs stable names

Pull requests and manual wheel builds no longer rely on a hardcoded
CIBW_SKIP list. A step asks cibuildwheel which identifiers pyproject.toml
selects on the runner and exports the newest as CIBW_BUILD, so adding or
dropping a Python version is a pyproject.toml-only change. The cibuildwheel
version is pinned once at job level.

The docs and conda build jobs get names without the Python version,
"CMake build on <platform>" and "Conda build on <platform>", so the
required status checks on main keep matching when the version is bumped.
The ruleset must be updated from "build (ubuntu-latest, 3.12)" to the two
new names when this merges.
This commit is contained in:
Erik Fröjdh committed 2026-10-13 16:33:57 +02:00
1 parent f794b81842
commit 4fd86092d1
3 files changed
+21 -5

No files matched your search

+3
View File
@@ -11,6 +11,9 @@ on:
jobs:
build:
# The name leaves out the Python version so that the required status
# check on main keeps matching when the version is bumped
name: Conda build on ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
+15 -5
View File
@@ -23,6 +23,7 @@ jobs:
# Job level so that the build and the statistics step talk to the same
# sccache server configured for the GitHub Actions cache
SCCACHE_GHA_ENABLED: "true"
CIBUILDWHEEL_VERSION: "4.3.0"
steps:
- uses: actions/checkout@v7
@@ -38,15 +39,24 @@ jobs:
with:
arch: x64
# Pull requests and manual runs build only the newest Python that
# pyproject.toml lists for this platform; pushes to main and releases
# skip this step and build every version. Deriving the identifier here
# keeps pyproject.toml the single place where versions are added or
# dropped.
- name: Select the newest Python
if: ${{ !(github.event_name == 'release' || (github.event_name == 'push' && github.ref == 'refs/heads/main')) }}
shell: bash
run: |
newest=$(pipx run cibuildwheel==${{ env.CIBUILDWHEEL_VERSION }} --print-build-identifiers | sort -V | tail -n 1)
echo "Building $newest"
echo "CIBW_BUILD=$newest" >> "$GITHUB_ENV"
# Linux wheels build inside a manylinux container, which needs its own
# sccache binary and the cache credentials the action exported; its
# statistics are printed after each wheel since the host cannot see them.
- name: Build wheels
env:
# Pull requests and manual runs build only the newest Python; pushes
# to main and releases build every version listed in pyproject.toml
CIBW_SKIP: >-
${{ !(github.event_name == 'release' || (github.event_name == 'push' && github.ref == 'refs/heads/main')) && 'cp312-* cp313-*' || '' }}
CIBW_ENVIRONMENT_WINDOWS: CMAKE_GENERATOR=Ninja
CIBW_REPAIR_WHEEL_COMMAND_LINUX: >-
auditwheel repair -w {dest_dir} {wheel} && sccache --show-stats
@@ -61,7 +71,7 @@ jobs:
curl -sSL https://github.com/mozilla/sccache/releases/download/v0.18.0/sccache-v0.18.0-x86_64-unknown-linux-musl.tar.gz
| tar -xz -C /usr/local/bin --strip-components=1 --wildcards '*/sccache'
&& chmod +x /usr/local/bin/sccache
run: pipx run cibuildwheel==4.3.0
run: pipx run cibuildwheel==${{ env.CIBUILDWHEEL_VERSION }}
- name: Compiler cache statistics
if: runner.os != 'Linux'
+3
View File
@@ -19,6 +19,9 @@ permissions:
jobs:
build:
# The name leaves out the Python version so that the required status
# check on main keeps matching when the version is bumped
name: CMake build on ${{ matrix.platform }}
strategy:
fail-fast: false
matrix: