-
-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Unable to install toolchain" on GitHub Actions Windows runner #1036
Comments
Yikes! Thanks for the report! It's a bit odd, since cargo-msrv's integration tests also run on Windows, although they're started via cargo run instead of directly. I also use windows as one of my development platforms and also didn't see issues there. I think I'll investigate this further by adding the windows platform to the separate msrv action on the ci, which acts as an e2e test. I wouldn't be surprised if it's a path problem, only that I've not seen it before. |
In #1036, an issue was reported which reported toolchain install issues, possibly caused by path separator issues on windows (ubuntu and mac seem to be fine). With this commit, we add a run of cargo-msrv as an e2e test to our own CI on windows and mac while we're at it. Previously, we would only run on ubuntu; the e2e test was a side-effect of checking our own MSRV. We do have tests which run via the 'cargo run' vehicle and temporary directories, but that's not as sandboxed as this approach. Hopefully, running all primary platforms will (1) give an indication of whether #1036 is indeed a cargo-msrv issue, and (2) prevent similar bugs in the future.
Today I had access to a windows machine, which let me test the reported issue locally. As it turns out, on this machine, there were no issues. I'll try to fix the potential path problem as far as its in my hands (because the invalid path is used and reported by |
I did some testing, but the results are unsatisfying for now. An observation I made, is that the path with the forward vs backward slash is not set by cargo-msrv, but by the rust toolchain install action (at least if you use https://github.com/foresterre/cargo-msrv/actions/runs/11695406885/job/32570778599?pr=1041#step:3:32 In addition, by default, Github actions uses powershell 7 (pwsh) on Windows, while |
Interesting. So maybe this should be fixed in (I'm not sure how to fix it but my initial guess would be to change this line from echo CARGO_HOME=${CARGO_HOME:-${{runner.os == 'Windows' && '$USERPROFILE' || '$HOME'}}/.cargo} >> $GITHUB_ENV to something like echo CARGO_HOME=${CARGO_HOME:-${{runner.os == 'Windows' && "$USERPROFILE\\" || "$HOME/"}}.cargo} >> $GITHUB_ENV However, I haven't checked whether rustup even uses the same name (i.e., ".cargo") for this directory on windows. There also seem to be a few more hard-coded |
I don't know whether this is the solution. I tried setting One thing I still want to try next is to simply run An idea I still have, is to try to work around the issue next by probing rustup first for prior installed toolchains, targets and components. Currently, I just say "add toolchain x" or "component y" and this works for all platforms because if they're already present, rustup still returns with exit code 0. This is something I intended to do anyways at some point, because it also allows you to optionally clean up extra toolchains after cargo-msrv execution |
It is unlikely a Really the only difference in output is the line I'll have to dive a bit into cargo's source code for what that means exactly, but I guess it has something to do with symlinks. It also seems to be more and more unlikely that this is a |
/
vs. \
issue)In #1036, an issue was reported which reported toolchain install issues, possibly caused by path separator issues on windows (ubuntu and mac seem to be fine). With this commit, we add a run of cargo-msrv as an e2e test to our own CI on windows and mac while we're at it. Previously, we would only run on ubuntu; the e2e test was a side-effect of checking our own MSRV. We do have tests which run via the 'cargo run' vehicle and temporary directories, but that's not as sandboxed as this approach. Hopefully, running all primary platforms will (1) give an indication of whether #1036 is indeed a cargo-msrv issue, and (2) prevent similar bugs in the future.
Running
cargo msrv check
from a github workflow (aka github action) on thewindows-latest
image results in the following error message:The same command works without any issues on github's
ubuntu-latest
andmacos-latest
images.It seems like there's an issue with the file separators: the path
C:\Users\runneradmin/.cargo\bin\rustup.exe
mixes forward and backward slashes. This would also explain why the error only occurs on windows.How to reproduce
More precisely, my workflow file runs the following command:
Here,
--log-level
and--output-format
are set so thatcargo msrv
doesn't suppress its output (cargo msrv
doesn't consider github's action environment as a terminal, so it would default to not printing any output or error messages); and-- cargo check --all-features
) is specific to my use case, but I don't think it makes a difference here sincecargo msrv
never even gets past toolchain installation on windows anyway.The full output from this command on windows is:
Here's a pretty-printed version of the message in the last JSON line:
The text was updated successfully, but these errors were encountered: