actions-rust-lang/setup-rust-toolchain

Unable to test project with multiple Rust versions if `rust-toolchain.toml` file is present

obi1kenobi opened this issue · 5 comments

cargo-semver-checks needs to support multiple rustdoc format versions, so its rustdoc-facing components need to run tests in CI with multiple Rust versions.

However, since running on multiple Rust versions is very time-consuming and usually doesn't find bugs across different versions of the same format, we'd like to use rust-toolchain.toml files so that in local development, our scripts automatically use the correct Rust version to generate our rustdoc. These files have to be checked in, because they are different for different git branches which target different rustdoc format versions: obi1kenobi/trustfall-rustdoc-adapter#311

Unfortunately, this causes a problem with this action: it seems to be impossible to run tests with multiple Rust versions (as is appropriate for a library) while a rust-toolchain.toml file is present. Even though we set the toolchain key in the action explicitly, it still picks up and uses the version from the rust-toolchain.toml file. AFAICT it also won't read the RUSTUP_TOOLCHAIN override env var that rustup supports for overriding the rust-toolchain.toml.

It would be awesome if we could have a way to tell the action to disregard the rust-toolchain.toml file and install a specific Rust version, so we can use the action in a GitHub Actions matrix of tests across Rust versions. Right now, AFAICT it's impossible to write such a matrix if rust-toolchain.toml exists.

i think this would be closed by #26

Yeah, it does seem like it would. Personally, I find the behavior in #26 more intuitive and preferable to the current one, though it is a breaking change.

Are you open to merging it? Any blockers?

I'd call it a fix personally, despite the apparent breakage. It seems very reasonable that an explicit action arg should override the in-tree rust-toolchain file.

@obi1kenobi you can use master commit hash to unblock yourself if you need to while #30 is in review

Thanks!