ci: switch from dtolnay/rust-toolchain to actions-rust-lang/setup-rust-toolchain#3
Merged
Merged
Conversation
…t-toolchain The dtolnay action's macos-14 PATH handling regressed when GitHub started shipping Homebrew's rust package on the runner image. `cargo` resolved to `rustup-init`, and even after manually purging brew's rust + writing $GITHUB_PATH, PATH wasn't propagating to later steps. Switch all 9 toolchain-install sites to the actions-rust-lang/setup-rust-toolchain@v1 action, which is the official recommended setup and bundles Swatinem/rust-cache so we can drop the explicit cache step. Notes: - Pass rustflags: "" everywhere to disable the new action's default RUSTFLAGS=-D warnings. Workspace lint policy lives in [workspace.lints] in Cargo.toml; promoting warn-level lints to hard errors at the env level would break test/build jobs that rely on warnings being warnings. - Keep the macOS brew-uninstall steps as defense-in-depth. - Bump verify-hyperd-pin.yml's actions/checkout to @v6 to match the rest of the workflows.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Switch from
dtolnay/rust-toolchaintoactions-rust-lang/setup-rust-toolchainSummary
Replaces
dtolnay/rust-toolchain@stable+Swatinem/rust-cache@v2with the officialactions-rust-lang/setup-rust-toolchain@v1action across all 9 toolchain-install sites. Fixes a recurring CI failure onmacos-14runners and consolidates toolchain + cache into a single action.Why
The
macos-14GitHub Actions runner image recently started shipping Homebrew'srustpackage, which symlinkscargotorustup-init. With no toolchain installed,cargo testthen invokesrustup-init's CLI parser and fails:I tried two workarounds before this PR:
brew uninstall rust+ symlink purge beforedtolnay/rust-toolchain@stableruns. This unblocked the toolchain install, butdtolnay/rust-toolchain's internal: create cachekeycomposite step couldn't findrustcon PATH and failed mid-action.echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"after the toolchain action. The "Ensure cargo is on PATH" step itself succeeded (which cargoprinted/Users/runner/.cargo/bin/cargo), but the$GITHUB_PATHmechanism wasn't propagating to subsequent steps — the "Workspace tests" step still gotcargo: command not found.Both workarounds are brittle. The official
actions-rust-lang/setup-rust-toolchain@v1action is more actively maintained, handles macos-14 quirks, and bundlesSwatinem/rust-cacheinternally so we can drop the explicit cache step.What changes
9 toolchain-install sites converted across 4 workflows
.github/workflows/ci.ymlfmt.github/workflows/ci.ymlclippyclippy.github/workflows/ci.ymltest(matrix: ubuntu / macos-14 / windows)test-${{ matrix.os }}.github/workflows/ci.ymlpublish-dry-runpublish-dry-run.github/workflows/ci.ymlauditaudit.github/workflows/release.ymlverifyrelease-verify.github/workflows/release.ymlpublishrelease-publish.github/workflows/npm-build-publish.ymlbuild-npm(matrix per target)npm-${{ matrix.target }}.github/workflows/verify-hyperd-pin.ymlverifyverify-hyperd-pinrustflags: ""on every siteThe new action sets
RUSTFLAGS="-D warnings"at the environment level by default. Our workspace has manywarn-level lints (missing_docs,missing_debug_implementations, etc.) that would silently turn into hard errors in test/build jobs.We disable the action's default with
rustflags: ""everywhere so:[workspace.lints]inCargo.tomlremains the single source of truth for lint policy.-D warningsvia its explicit-- -D warningsargument (no behavior change there).This was caught by adversarial review — without it, every test job would fail on the first
warn-level lint hit.macOS brew-uninstall steps kept as defense-in-depth
The
Remove pre-installed Homebrew rust (macOS)steps inci.yml(test job) andnpm-build-publish.yml(build-npm job) stay. Comments document why: macos-14 runner image regressions are recurring, and the|| trueshort-circuits make the steps no-ops when brew rust isn't installed.Smaller cleanups
verify-hyperd-pin.yml: bumpedactions/checkout@v4→@v6to match the other workflows.npm-build-publish.yml: dtolnay'stargets:(plural) renamed totarget:(singular) to match the new action's input.Adversarial review
A code-reviewer subagent flagged:
rustflags: ""to all 9 sites with explanatory comments. Verified by fetching the action'saction.ymldirectly.@v1is a moving tag — accepted as the same risk profile as the previousdtolnay@stable.cargo-auditcache doesn't auto-invalidate — accepted as not a regression.verify-hyperd-pinlostworkspaces: . -> target— verified the action's default matches the previous explicit setting; not a regression.Test plan
test (macos-14)matrix entry, which has been failing pre-fix.clippyjob still enforces-D warningson all targets/features.auditjob still runscargo audit --deny warningsagainst the live RustSec advisory-db.mainto confirmrelease-please.ymlstill works (no toolchain-install in that workflow, but want to confirm nothing else regressed).