Skip to content

Commit

Permalink
Make CI ensure the Cargo.lock.msrv file is up to date
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhenrymantilla committed May 28, 2023
1 parent b5db23c commit 53ac97e
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,21 @@ fn main() -> xshell::Result<()> {
let _s = section("TEST_MSRV");
let _e = push_toolchain(&sh, MSRV)?;
sh.copy_file("Cargo.lock.msrv", "Cargo.lock")?;
cmd!(sh, "cargo build").run()?;
if let err @ Err(_) = cmd!(sh, "cargo update -w -v --locked").run() {
// `Cargo.lock.msrv` is out of date! Probably from having bumped our own version number.
println! {"\
Error: `Cargo.lock.msrv` is out of date. \
Please run:\n \
(cp Cargo.lock{{.msrv,}} && cargo +{MSRV} update -w -v && cp Cargo.lock{{.msrv,}})\n\
\n\
Alternatively, `git apply` the `.patch` below:\
"}
cmd!(sh, "cargo update -q -w").quiet().run()?;
sh.copy_file("Cargo.lock", "Cargo.lock.msrv")?;
cmd!(sh, "git --no-pager diff --color=always -- Cargo.lock.msrv").quiet().run()?;
return err;
}
cmd!(sh, "cargo build --locked").run()?;
}

{
Expand Down

0 comments on commit 53ac97e

Please sign in to comment.