Skip to content

Commit 67aea4d

Browse files
authored
👷 ci: derive the wheel toolchain from rust-toolchain.toml (#689)
The wheel build pins the Rust channel and components in `CIBW_BEFORE_ALL_LINUX`, and `rust-toolchain.toml` states them again; the comment above the pin asks whoever edits one to keep the other in sync. Dependabot owns the toml file and cannot reach the workflow, so [#686](#686) moved the channel to 1.98 while the pin stayed at 1.97. Each container then provisioned 1.98 on demand during the parallel ninja build, raced, and the aarch64 musl wheel died with `recovering from a partially installed toolchain` then `detected conflict: 'bin/cargo-clippy'`. 👷 A step now reads `rust-toolchain.toml` and hands rustup the flags, so the two cannot disagree and the next toolchain bump needs no workflow edit. Running the step as GitHub composes it emits `flags=--default-toolchain 1.97 --component clippy --component llvm-tools-preview --component rustfmt`.
1 parent 89d7361 commit 67aea4d

1 file changed

Lines changed: 17 additions & 4 deletions

File tree

.github/workflows/dist.yaml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,28 @@ jobs:
8383
done
8484
echo "CIBW_MANYLINUX_${ARCH^^}_IMAGE=$manylinux" >> "$GITHUB_ENV"
8585
echo "CIBW_MUSLLINUX_${ARCH^^}_IMAGE=$musllinux" >> "$GITHUB_ENV"
86+
- name: Read the toolchain rustup should install
87+
id: rust
88+
shell: bash
89+
run: |
90+
python3 - <<'EOF' >> "$GITHUB_OUTPUT"
91+
import tomllib
92+
from pathlib import Path
93+
94+
toolchain = tomllib.loads(Path("rust-toolchain.toml").read_text())["toolchain"]
95+
flags = ["--default-toolchain", toolchain["channel"]]
96+
flags += [word for name in toolchain["components"] for word in ("--component", name)]
97+
print("flags=" + " ".join(flags))
98+
EOF
8699
- name: Build wheels
87100
uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
88101
env:
89102
CIBW_ARCHS: ${{ matrix.platform.arch }}
90-
# Install the pinned toolchain and its components up front. Left to rust-toolchain.toml, the first
91-
# cargo call in each container provisions them on demand, which races and conflicts on the
92-
# cargo-clippy hardlink on aarch64. Keep the channel and components in sync with rust-toolchain.toml.
103+
# Install the toolchain and its components up front. Left to rust-toolchain.toml, the first cargo
104+
# call in each container provisions them on demand, which races and conflicts on the cargo-clippy
105+
# hardlink on aarch64.
93106
CIBW_BEFORE_ALL_LINUX: >-
94-
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain 1.98 --component clippy --component llvm-tools-preview --component rustfmt
107+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal ${{ steps.rust.outputs.flags }}
95108
# 3.15 is still a prerelease, so cpython-prerelease enables its free-threaded build.
96109
CIBW_BUILD: ${{ matrix.identifiers || format('{0}-*', matrix.build) }}
97110
CIBW_ENABLE: pypy cpython-prerelease

0 commit comments

Comments
 (0)