| 364 |
364 |
|
# versions, which is the whole reason the pins exist, and the sweep's fmt cell
|
| 365 |
365 |
|
# then measures which machine formatted last.
|
| 366 |
366 |
|
#
|
|
367 |
+ |
# Two of the three publish gates are louder than that, and only by accident:
|
|
368 |
+ |
# Fedora's rust package carries neither rustfmt nor clippy, so on the fw13 image
|
|
369 |
+ |
# `cargo fmt` and `cargo clippy` are `no such command` rather than the wrong
|
|
370 |
+ |
# version. Measured in the rehearsal-4 run. That makes the publish recipe fail at
|
|
371 |
+ |
# its first gate on a rustup-less host, which is the good outcome; `cargo test`
|
|
372 |
+ |
# and `cargo publish --dry-run` both ran green there on 1.98.0, which is the bad
|
|
373 |
+ |
# one. So the components are asked for separately below: rustup being installed
|
|
374 |
+ |
# and on the right channel does not mean the toolchain carries them, and a
|
|
375 |
+ |
# `--profile minimal` install without them fails a release rather than a build.
|
|
376 |
+ |
#
|
| 367 |
377 |
|
# Only a build host is asked. A laptop with no tree is not failing anything by
|
| 368 |
378 |
|
# not having a toolchain, so the absence of either the tree or rustc is a SKIP.
|
| 369 |
379 |
|
pin_file="$(target_home)/Code/alloy/rust-toolchain.toml"
|
| 380 |
390 |
|
if [ -z "$pinned" ] || [ -z "$active" ]; then
|
| 381 |
391 |
|
row SKIP toolchain "could not read the pin or the active version from this output shape"
|
| 382 |
392 |
|
elif [ "$pinned" = "$active" ]; then
|
| 383 |
|
- |
row PASS toolchain "rustc $active matches the pinned channel"
|
|
393 |
+ |
# The channel is right. Now the two components the publish recipe runs
|
|
394 |
+ |
# before anything else, each asked for by the command that would fail.
|
|
395 |
+ |
missing=""
|
|
396 |
+ |
cargo fmt --version >/dev/null 2>&1 || missing="rustfmt"
|
|
397 |
+ |
cargo clippy --version >/dev/null 2>&1 || missing="${missing:+$missing }clippy"
|
|
398 |
+ |
if [ -n "$missing" ]; then
|
|
399 |
+ |
row FAIL toolchain "rustc $active matches the pin but $missing is absent -- run: rustup component add $missing"
|
|
400 |
+ |
else
|
|
401 |
+ |
row PASS toolchain "rustc $active matches the pinned channel, with rustfmt and clippy"
|
|
402 |
+ |
fi
|
| 384 |
403 |
|
elif have rustup; then
|
| 385 |
404 |
|
row FAIL toolchain "rustc $active, tree pins $pinned, and rustup is installed -- run: rustup toolchain install $pinned"
|
| 386 |
405 |
|
else
|