Skip to content
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

Test on MSRV in CI #285

Open
joshlf opened this issue Oct 12, 2024 · 6 comments
Open

Test on MSRV in CI #285

joshlf opened this issue Oct 12, 2024 · 6 comments

Comments

@joshlf
Copy link

joshlf commented Oct 12, 2024

It appears as though the MSRV is not tested in CI, and so it isn't actually supported. E.g., taking a dependency on 0.27.1:

$ cargo +1.70.0 check --tests
error: package `rustfix v0.8.5` cannot be built because it requires rustc 1.77 or newer, while the currently active rustc version is 1.70.0
Either upgrade to rustc 1.77 or newer, or use
cargo update -p [email protected] --precise ver
where `ver` is the latest version of `rustfix` supporting rustc 1.70.0
@oli-obk
Copy link
Owner

oli-obk commented Oct 13, 2024

Hmm... weird that cargo allows a crate to depend on crates with a higher msrv

But that would indeed not help with ensuring it actually builds.

We can't really run tests tho, as those are tied to the latest version as we do test rustc output directly, but hopefully that doesn't matter.

I'll ponder on this some more, but we should def bump msrv to 1.73 which is supported by rustfix 0.8.1, which is what it says on our Cargo.toml

@joshlf
Copy link
Author

joshlf commented Oct 16, 2024

We can't really run tests tho, as those are tied to the latest version as we do test rustc output directly, but hopefully that doesn't matter.

Does that imply that you can't run ui-test to assert on the output of specific (older) compiler toolchains? Or am I misunderstanding?

The reason I ask is that what we do in our CI is pin specific versions of Rust (we test with multiple). We have error output tests (using trybuild) that are each specific to a particular version of Rust. Would you maybe be able to do the same? So you could pin your MSRV toolchain and test on it in CI (in addition to whatever other toolchains you want to test on). I can link to the source code on our side if you're curious how we do it.

@oli-obk
Copy link
Owner

oli-obk commented Oct 16, 2024

I guess I can pin it again and always test and work on the msrv. We stopped pinning because @RalfJung ended up with too many locally installed toolchains xD

@RalfJung
Copy link
Collaborator

I guess I can pin it again and always test and work on the msrv.

If that works, why can't CI do it?

What CI certainly can do is cargo check with the MSRV.

@oli-obk
Copy link
Owner

oli-obk commented Oct 16, 2024

yes, that's what I'm going to do, I just had a brain fart when I wrote

We can't really run tests tho, as those are tied to the latest version as we do test rustc output directly, but hopefully that doesn't matter.

As I assumed we'd work with the latest rustc and just test MSRV in CI to ensure everything builds

@joshlf
Copy link
Author

joshlf commented Oct 16, 2024

Sounds good!

This may be overkill for y'all, but we wrote a cargo wrapper that permits you to write ./cargo.sh +<meta-toolchain> where <meta-toolchain> is the name of a pinned toolchain specified in Cargo.toml - it parses Cargo.toml to figure out the corresponding toolchain name (e.g., ./cargo.sh +msrv check might run cargo +1.56.0 check under the hood) and offer to install it via Rustup if it's not installed. We use it for local development and in all of our CI scripts. It's all pretty copy-pastable if you want to use it for this:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants