fix(ci): detect and set CARGO_HOME explicitly for rust tests#745
Merged
lpcox merged 2 commits intolpcox/port-one-shot-token-rustfrom Feb 12, 2026
Merged
Conversation
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes CARGO_HOME detection in the GitHub Actions test-chroot workflow. The dtolnay/rust-toolchain action installs Rust to ~/.cargo/bin but doesn't set the CARGO_HOME environment variable, causing tests to fail when the container entrypoint tries to add Cargo binaries to PATH.
Changes:
- Detect CARGO_HOME from cargo binary location using
which cargo | dirname | dirname - Fall back to
~/.cargoif cargo is not found - Always set CARGO_HOME in $GITHUB_ENV to ensure it propagates to the container
- Update comment to correctly state that rust-toolchain action doesn't set CARGO_HOME
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced Feb 12, 2026
Merged
Closed
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.
The
dtolnay/rust-toolchainaction installs Rust binaries to~/.cargo/binbut doesn't set theCARGO_HOMEenvironment variable. WithoutCARGO_HOME, the container entrypoint can't add Cargo binaries to PATH, causingrustc --versionandcargo --versiontests to fail with exit code 127.Changes
CARGO_HOMEfrom cargo binary location usingwhich cargo | dirname | dirname~/.cargoif cargo not foundCARGO_HOMEin$GITHUB_ENVregardless of whether it was pre-setBefore:
After:
This ensures the environment variable propagates through the chain: workflow → Node.js process (
process.env.CARGO_HOME) → container env var (AWF_CARGO_HOME) → chroot PATH ($CARGO_HOME/bin).Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/graphql/usr/bin/gh gh pr checks --json name,state,link --abbrev-ref HEAD /home/REDACTED/.local/bin/git(http block)/usr/bin/gh gh pr view 745 --json isDraft,statusCheckRollup(http block)https://api.github.com/repos/github/gh-aw-firewall/actions/runs/usr/bin/gh gh run list --branch claude/fix-github-actions-workflow-again --limit 5 --json workflowName,status,conclusion,createdAt,headSha /home/REDACTED/.nvm/package.json /home/REDACTED/.nvm/rename_test.sh /home/REDACTED/.nvm/test -n 1000(http block)If you need me to access, download, or install something from one of these locations, you can either: