diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4daaf29a6..372384389 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -129,4 +129,6 @@ jobs: mesa-ci-build-version: ${{ env.MESA_CI_BINARY_BUILD }} # -------------------------------------------------------------------------------- - name: Tests + env: + CUBEK_CI_WGPU_NO_RUN: "1" run: cargo xtask test --ci diff --git a/xtask/src/commands/test.rs b/xtask/src/commands/test.rs index 369e87c66..cd43487a9 100644 --- a/xtask/src/commands/test.rs +++ b/xtask/src/commands/test.rs @@ -1,5 +1,9 @@ +use std::collections::HashMap; + use tracel_xtask::prelude::*; +const CI_WGPU_NO_RUN_ENV: &str = "CUBEK_CI_WGPU_NO_RUN"; + #[macros::extend_command_args(TestCmdArgs, Target, TestSubCommand)] pub struct CubeKTestCmdArgs { /// Kept for CI workflow compatibility; tests already target the publish closure. @@ -8,12 +12,23 @@ pub struct CubeKTestCmdArgs { } pub(crate) fn handle_command( - _args: CubeKTestCmdArgs, + args: CubeKTestCmdArgs, _env: Environment, _context: Context, ) -> anyhow::Result<()> { let backends: &[&str] = &["cubecl/wgpu"]; + let envs = args.ci.then(|| HashMap::from([("RUST_TEST_THREADS", "1")])); + let no_run = std::env::var_os(CI_WGPU_NO_RUN_ENV).is_some(); for backend in backends { + let mut test_args = vec!["--features", *backend]; + if no_run { + test_args.push("--no-run"); + } + let group_msg = if no_run { + format!("Compile tests on backend {backend:?}") + } else { + format!("Test on backend {backend:?}") + }; helpers::custom_crates_tests( vec![ "t4a-cubek-matmul", @@ -22,10 +37,10 @@ pub(crate) fn handle_command( "t4a-cubek-std", "t4a-cubek-test-utils", ], - vec!["--features", backend], - None, + test_args, + envs.clone(), None, - &format!("Test on backend {backend:?}"), + &group_msg, )?; } Ok(())