From 54dd5dd1ddf36805e8b17571bbb8c2579d518ba8 Mon Sep 17 00:00:00 2001 From: Ajeet D'Souza <98ajeet@gmail.com> Date: Fri, 8 Oct 2021 21:03:28 +0530 Subject: [PATCH] Add xtask check --- tests/completion.rs | 2 +- tests/man.rs | 2 +- xtask/src/main.rs | 9 +++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/completion.rs b/tests/completion.rs index 9887096..5e5c288 100644 --- a/tests/completion.rs +++ b/tests/completion.rs @@ -1,5 +1,5 @@ //! Syntax checking for auto-generated shell completions. -#![cfg(feature = "nix_tests")] +#![cfg(feature = "nix")] use assert_cmd::Command; diff --git a/tests/man.rs b/tests/man.rs index 6792fa1..faf1e64 100644 --- a/tests/man.rs +++ b/tests/man.rs @@ -1,5 +1,5 @@ //! Syntax checking for manpages. -#![cfg(feature = "nix_tests")] +#![cfg(feature = "nix")] use assert_cmd::Command; diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 3ae36ec..bb5b981 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -12,6 +12,8 @@ fn main() -> Result<()> { let app = App::parse(); match app { App::Audit => run_audit(&[] as &[&str])?, + App::Check => run_check(&[] as &[&str])?, + App::Clippy => run_clippy(&[] as &[&str])?, App::CI => run_ci(nix_enabled)?, App::Fmt => run_fmt(&[] as &[&str])?, App::Markdownlint => run_markdownlint()?, @@ -24,7 +26,9 @@ fn main() -> Result<()> { #[derive(Clap)] enum App { Audit, + Check, CI, + Clippy, Fmt, Markdownlint, Test { args: Vec }, @@ -49,6 +53,10 @@ fn run_audit>(args: &[S]) -> Result<()> { Command::new("cargo").args(&["audit", "--deny=warnings"]).args(args)._run() } +fn run_check>(args: &[S]) -> Result<()> { + Command::new("cargo").args(&["check", "--all-features", "--all-targets", "--workspace"]).args(args)._run() +} + fn run_clippy>(args: &[S]) -> Result<()> { Command::new("cargo").args(&["clippy", "--all-features", "--all-targets"]).args(args)._run() } @@ -56,6 +64,7 @@ fn run_clippy>(args: &[S]) -> Result<()> { fn run_ci(nix_enabled: bool) -> Result<()> { let color = if env::var_os("CI").is_some() { "--color=always" } else { "--color=auto" }; run_fmt(&["--check", color, "--files-with-diff"])?; + run_check(&[color])?; run_clippy(&[color])?; run_test(nix_enabled, &[color, "--no-fail-fast"])?; if nix_enabled {