Add MSRV to CI

This commit is contained in:
Ajeet D'Souza 2023-01-18 11:05:19 +05:30
parent 575cfd485c
commit 066730f95d
2 changed files with 17 additions and 6 deletions

View File

@ -21,6 +21,7 @@ in pkgs.mkShell {
pkgs.zsh pkgs.zsh
# Tools # Tools
pkgs.cargo-msrv
pkgs.cargo-nextest pkgs.cargo-nextest
pkgs.mandoc pkgs.mandoc
pkgs.nixfmt pkgs.nixfmt

View File

@ -57,14 +57,10 @@ impl CommandExt for &mut Command {
} }
fn run_ci(nix_enabled: bool) -> Result<()> { fn run_ci(nix_enabled: bool) -> Result<()> {
// Run cargo-clippy.
Command::new("cargo")
.args(["clippy", "--all-features", "--all-targets"])
.args(["--", "-Dwarnings"])
.run()?;
run_fmt(nix_enabled, true)?; run_fmt(nix_enabled, true)?;
run_lint(nix_enabled)?; run_lint(nix_enabled)?;
run_tests(nix_enabled, "") run_tests(nix_enabled, "")?;
run_msrv(nix_enabled)
} }
fn run_fmt(nix_enabled: bool, check: bool) -> Result<()> { fn run_fmt(nix_enabled: bool, check: bool) -> Result<()> {
@ -89,6 +85,12 @@ fn run_fmt(nix_enabled: bool, check: bool) -> Result<()> {
} }
fn run_lint(nix_enabled: bool) -> Result<()> { fn run_lint(nix_enabled: bool) -> Result<()> {
// Run cargo-clippy.
Command::new("cargo")
.args(["clippy", "--all-features", "--all-targets"])
.args(["--", "-Dwarnings"])
.run()?;
if nix_enabled { if nix_enabled {
// Run markdownlint. // Run markdownlint.
for result in Walk::new("./") { for result in Walk::new("./") {
@ -112,6 +114,14 @@ fn run_lint(nix_enabled: bool) -> Result<()> {
Ok(()) Ok(())
} }
fn run_msrv(nix_enabled: bool) -> Result<()> {
if nix_enabled {
// Run cargo-msrv.
Command::new("cargo-msrv").arg("verify").run()?;
}
Ok(())
}
fn run_tests(nix_enabled: bool, name: &str) -> Result<()> { fn run_tests(nix_enabled: bool, name: &str) -> Result<()> {
let args: &[&str] = if nix_enabled { &["nextest", "run", "--all-features"] } else { &["test"] }; let args: &[&str] = if nix_enabled { &["nextest", "run", "--all-features"] } else { &["test"] };
Command::new("cargo").args(args).args(["--no-fail-fast", "--workspace", "--", name]).run() Command::new("cargo").args(args).args(["--no-fail-fast", "--workspace", "--", name]).run()