From db9352b1c2f0e236df03592eeacdf06c0f5ebe67 Mon Sep 17 00:00:00 2001 From: Lucas Farias Date: Sat, 24 May 2025 16:25:30 -0300 Subject: [PATCH] Add CI for render asset leaks --- tools/ci/src/ci.rs | 3 +++ tools/ci/src/commands/mod.rs | 2 ++ tools/ci/src/commands/test_render_assets.rs | 22 +++++++++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 tools/ci/src/commands/test_render_assets.rs diff --git a/tools/ci/src/ci.rs b/tools/ci/src/ci.rs index 349e74a5a0..f21f6b2df2 100644 --- a/tools/ci/src/ci.rs +++ b/tools/ci/src/ci.rs @@ -73,6 +73,7 @@ impl CI { cmds.append(&mut commands::FormatCommand::default().prepare(sh, flags)); cmds.append(&mut commands::ClippyCommand::default().prepare(sh, flags)); cmds.append(&mut commands::TestCommand::default().prepare(sh, flags)); + cmds.append(&mut commands::TestRenderAssetsCommand::default().prepare(sh, flags)); cmds.append(&mut commands::TestCheckCommand::default().prepare(sh, flags)); cmds.append(&mut commands::IntegrationTestCommand::default().prepare(sh, flags)); cmds.append( @@ -105,6 +106,7 @@ enum Commands { Format(commands::FormatCommand), Clippy(commands::ClippyCommand), Test(commands::TestCommand), + TestRenderAssets(commands::TestRenderAssetsCommand), TestCheck(commands::TestCheckCommand), IntegrationTest(commands::IntegrationTestCommand), IntegrationTestCheck(commands::IntegrationTestCheckCommand), @@ -127,6 +129,7 @@ impl Prepare for Commands { Commands::Format(subcommand) => subcommand.prepare(sh, flags), Commands::Clippy(subcommand) => subcommand.prepare(sh, flags), Commands::Test(subcommand) => subcommand.prepare(sh, flags), + Commands::TestRenderAssets(subcommand) => subcommand.prepare(sh, flags), Commands::TestCheck(subcommand) => subcommand.prepare(sh, flags), Commands::IntegrationTest(subcommand) => subcommand.prepare(sh, flags), Commands::IntegrationTestCheck(subcommand) => subcommand.prepare(sh, flags), diff --git a/tools/ci/src/commands/mod.rs b/tools/ci/src/commands/mod.rs index 9247ab2016..fffb5089af 100644 --- a/tools/ci/src/commands/mod.rs +++ b/tools/ci/src/commands/mod.rs @@ -14,6 +14,7 @@ pub use integration_test_clean::*; pub use lints::*; pub use test::*; pub use test_check::*; +pub use test_render_assets::*; mod bench_check; mod clippy; @@ -31,3 +32,4 @@ mod integration_test_clean; mod lints; mod test; mod test_check; +mod test_render_assets; diff --git a/tools/ci/src/commands/test_render_assets.rs b/tools/ci/src/commands/test_render_assets.rs new file mode 100644 index 0000000000..0e8001cdd8 --- /dev/null +++ b/tools/ci/src/commands/test_render_assets.rs @@ -0,0 +1,22 @@ +use crate::{Flag, Prepare, PreparedCommand}; +use argh::FromArgs; +use xshell::cmd; + +/// Runs all tests (except for doc tests). +#[derive(FromArgs, Default)] +#[argh(subcommand, name = "test-render-assets")] +pub struct TestRenderAssetsCommand {} + +impl Prepare for TestRenderAssetsCommand { + fn prepare<'a>(&self, sh: &'a xshell::Shell, flags: Flag) -> Vec> { + let no_fail_fast = flags + .contains(Flag::KEEP_GOING) + .then_some("--no-fail-fast") + .unwrap_or_default(); + + vec![PreparedCommand::new::( + cmd!(sh, "cargo test --test render_asset_leaks {no_fail_fast}"), + "Please fix failing tests in output above.", + )] + } +}