Skip to content

Commit 16a29b7

Browse files
committed
👷 ci: derive the wheel toolchain from rust-toolchain.toml
The channel and components were written twice, and the comment asked whoever edited one to remember the other. Dependabot owns rust-toolchain.toml and cannot reach the workflow, so its bump to 1.98 left the pin at 1.97; the container then provisioned 1.98 on demand during the parallel build and the aarch64 musl wheel failed on a half-installed toolchain. Reading the file at build time removes the pair that can disagree.
1 parent 89d7361 commit 16a29b7

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

.github/workflows/dist.yaml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,27 @@ 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+
run: |
89+
python3 - <<'EOF' >> "$GITHUB_OUTPUT"
90+
import tomllib
91+
from pathlib import Path
92+
93+
toolchain = tomllib.loads(Path("rust-toolchain.toml").read_text())["toolchain"]
94+
flags = ["--default-toolchain", toolchain["channel"]]
95+
flags += [word for name in toolchain["components"] for word in ("--component", name)]
96+
print("flags=" + " ".join(flags))
97+
EOF
8698
- name: Build wheels
8799
uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
88100
env:
89101
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.
102+
# Install the toolchain and its components up front. Left to rust-toolchain.toml, the first cargo
103+
# call in each container provisions them on demand, which races and conflicts on the cargo-clippy
104+
# hardlink on aarch64.
93105
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
106+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal ${{ steps.rust.outputs.flags }}
95107
# 3.15 is still a prerelease, so cpython-prerelease enables its free-threaded build.
96108
CIBW_BUILD: ${{ matrix.identifiers || format('{0}-*', matrix.build) }}
97109
CIBW_ENABLE: pypy cpython-prerelease

0 commit comments

Comments
 (0)