Skip to content

Commit c5790c6

Browse files
Merge latest origin/main before main push
2 parents faeddfe + 6bc9927 commit c5790c6

1 file changed

Lines changed: 24 additions & 11 deletions

File tree

.github/workflows/build-wheels.yml

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ name: Build wheels (cibuildwheel — Rust Phase 2)
22

33
# Phase-2 gate for the Rust HDFE kernel spike.
44
#
5-
# The Rust kernel lives on `feat/rust-hdfe`. On `main` the repository
6-
# is Rust-free, so this workflow is INERT on `main`: the
7-
# `rust/statspai_hdfe/Cargo.toml` file does not exist there, and the
8-
# per-job guard step below exits early with a no-op status. The
9-
# purpose of committing the workflow to `main` is so that when the
10-
# rust branch merges, the cibuildwheel matrix is already defined and
11-
# `feat/rust-hdfe`'s CI just turns green.
5+
# The Rust HDFE crate lives under `rust/statspai_hdfe/` and its
6+
# `Cargo.toml` IS present on `main`. But cibuildwheel can only emit a
7+
# platform wheel when the project's PEP 517 build-backend is maturin,
8+
# so the PyO3 extension gets compiled into the wheel. Today
9+
# `pyproject.toml` uses `setuptools.build_meta` (no `[tool.maturin]`),
10+
# which yields a pure-Python `py3-none-any` wheel that cibuildwheel
11+
# rejects with exit 5 (NonPlatformWheelError). The `check_rust_present`
12+
# guard below therefore gates on the maturin backend — NOT on Cargo.toml
13+
# presence — so this workflow stays INERT until the native wheel
14+
# pipeline is actually wired. When a PR switches the build-backend to
15+
# maturin, the guard opens and the cibuildwheel matrix runs.
1216
#
1317
# Matrix coverage mirrors the contract in `rust/README.md`:
1418
# - macOS arm64 (macos-14) + x86_64 (macos-13)
@@ -53,14 +57,23 @@ jobs:
5357
steps:
5458
- uses: actions/checkout@v4
5559
- id: detect
56-
name: Look for rust/statspai_hdfe/Cargo.toml
60+
name: Detect a maturin (PyO3) build backend
5761
run: |
58-
if [ -f rust/statspai_hdfe/Cargo.toml ]; then
62+
# cibuildwheel can only build a platform wheel when the PEP 517
63+
# backend is maturin (so the Rust extension is compiled in).
64+
# Gate on that — Cargo.toml presence alone is NOT sufficient:
65+
# with the setuptools backend a pure-Python wheel is produced
66+
# and cibuildwheel exits 5 (NonPlatformWheelError). This keeps
67+
# the workflow inert until the native build is really wired,
68+
# while still re-triggering (via the pyproject.toml path filter)
69+
# the moment a PR adopts the maturin backend.
70+
if grep -Eq '^[[:space:]]*build-backend[[:space:]]*=[[:space:]]*"maturin' pyproject.toml \
71+
&& [ -f rust/statspai_hdfe/Cargo.toml ]; then
5972
echo "has_rust=true" >> "$GITHUB_OUTPUT"
60-
echo "Rust crate present — cibuildwheel matrix will run."
73+
echo "maturin backend + Rust crate present — cibuildwheel matrix will run."
6174
else
6275
echo "has_rust=false" >> "$GITHUB_OUTPUT"
63-
echo "Rust crate absent on this ref — wheel jobs skip."
76+
echo "No maturin build-backend on this ref — wheel jobs skip (pure-Python build)."
6477
fi
6578
6679
build_wheels:

0 commit comments

Comments
 (0)