diff --git a/.config/nextest.toml b/.config/nextest.toml index f3a233feb..7e1d2586a 100644 --- a/.config/nextest.toml +++ b/.config/nextest.toml @@ -39,3 +39,8 @@ test-threads = 1 [profile.ci-provider-integration.junit] path = "junit.xml" + +# profile for running the MBOR types smoke tests against the emu backend +# (in-process firmware). +[profile.ci-mbor-smoke.junit] +path = "junit.xml" diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 6e0d4fd25..db9d55a16 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -90,6 +90,50 @@ jobs: echo "One or more tests failed." exit 1 + test_ubuntu_smoke: + + runs-on: ubuntu-24.04 + + defaults: + run: + working-directory: . + + steps: + - uses: actions/checkout@v6 + - name: Install apt packages + run: | + sudo apt-get update + sudo apt-get install -y pkg-config libbsd-dev + + - name: Restore Cargo cache + id: cargo-cache + uses: actions/cache/restore@v5 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + key: ${{ runner.os }}-cargo-${{ env.CACHE_KEY_ID }} + - name: Setup + if: steps.cargo-cache.outputs.cache-hit != 'true' + run: cargo xtask setup + - name: Run MBOR types smoke tests against emu backend + id: test-mbor-smoke + run: cargo xtask precheck --nextest --package azihsm_ddi_mbor_types --features emu --test azihsm_ddi_tests --filter smoke + continue-on-error: true + - name: Generate nextest report + id: nextest-report + run: cargo xtask precheck --nextest-report + - name: Code Coverage Summary Report + if: ${{ steps.test-mbor-smoke.outcome == 'success' }} + run: cargo xtask precheck --coverage-report + - name: Fail if any tests failed + if: ${{ steps.test-mbor-smoke.outcome == 'failure' }} + run: | + echo "One or more tests failed." + exit 1 + build_windows: runs-on: windows-2025-vs2026 @@ -145,3 +189,42 @@ jobs: run: | echo "One or more tests failed." exit 1 + + test_windows_smoke: + + runs-on: windows-2025-vs2026 + + defaults: + run: + working-directory: . + + steps: + - uses: actions/checkout@v6 + - name: Restore Cargo cache + id: cargo-cache + uses: actions/cache/restore@v5 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + key: ${{ runner.os }}-cargo-${{ env.CACHE_KEY_ID }} + - name: Setup + if: steps.cargo-cache.outputs.cache-hit != 'true' + run: cargo xtask setup + - name: Run MBOR types smoke tests against emu backend + id: test-mbor-smoke + run: cargo xtask precheck --nextest --package azihsm_ddi_mbor_types --features emu --test azihsm_ddi_tests --filter smoke + continue-on-error: true + - name: Generate nextest report + id: nextest-report + run: cargo xtask precheck --nextest-report + - name: Code Coverage Summary Report + if: ${{ steps.test-mbor-smoke.outcome == 'success' }} + run: cargo xtask precheck --coverage-report + - name: Fail if any tests failed + if: ${{ steps.test-mbor-smoke.outcome == 'failure' }} + run: | + echo "One or more tests failed." + exit 1 diff --git a/xtask/src/nextest.rs b/xtask/src/nextest.rs index e189dac60..e65013ae7 100644 --- a/xtask/src/nextest.rs +++ b/xtask/src/nextest.rs @@ -40,6 +40,14 @@ pub struct Nextest { /// Crates to exclude from nextest (e.g. crates with heavyweight build scripts) #[clap(long)] pub exclude: Vec, + + /// Test only the specified test target + #[clap(long)] + pub test: Option, + + /// Test name filters + #[clap(long)] + pub filter: Vec, } impl Xtask for Nextest { @@ -97,6 +105,14 @@ impl Xtask for Nextest { command_args.push(val); } } + let test_val = self.test.clone().unwrap_or_default(); + if self.test.is_some() { + command_args.push("--test"); + command_args.push(&test_val); + } + if !self.filter.is_empty() { + command_args.extend(self.filter.iter().map(|s| s.as_str())); + } cmd!( sh, diff --git a/xtask/src/precheck.rs b/xtask/src/precheck.rs index 4788bfc29..58149a1f1 100644 --- a/xtask/src/precheck.rs +++ b/xtask/src/precheck.rs @@ -6,6 +6,8 @@ //! Xtask to run various repo-specific checks +use std::vec; + use clap::Parser; use crate::audit::Audit; @@ -180,6 +182,8 @@ impl Xtask for Precheck { filterset: None, profile: self.profile.clone().or(Some("ci-mock".to_string())), exclude: self.exclude.clone(), + test: None, + filter: vec![], } .run(ctx.clone())?; @@ -193,6 +197,23 @@ impl Xtask for Precheck { filterset: Some("test(resiliency::fault_injection::)".to_string()), profile: self.profile.clone().or(Some("ci-mock-res".to_string())), exclude: self.exclude.clone(), + test: None, + filter: vec![], + } + .run(ctx.clone())?; + } + + // Run MBOR types smoke tests against emu backend + if !self.exclude.iter().any(|e| e == "azihsm_ddi_mbor_types") { + Nextest { + features: Some("emu".to_string()), + package: Some("azihsm_ddi_mbor_types".to_string()), + no_default_features: false, + filterset: None, + profile: self.profile.clone().or(Some("ci-mbor-smoke".to_string())), + exclude: self.exclude.clone(), + test: None, + filter: vec![], } .run(ctx.clone())?; } @@ -207,6 +228,8 @@ impl Xtask for Precheck { filterset: None, profile: self.profile.clone().or(Some("ci-mock-table-4".to_string())), exclude: self.exclude.clone(), + test: None, + filter: vec![], } .run(ctx.clone())?; @@ -221,6 +244,8 @@ impl Xtask for Precheck { .clone() .or(Some("ci-mock-table-64".to_string())), exclude: self.exclude.clone(), + test: None, + filter: vec![], } .run(ctx.clone())?; @@ -233,6 +258,8 @@ impl Xtask for Precheck { filterset: None, profile: self.profile.clone().or(Some("ci-tbor-emu".to_string())), exclude: self.exclude.clone(), + test: None, + filter: vec![], } .run(ctx.clone())?; } @@ -244,6 +271,8 @@ impl Xtask for Precheck { filterset: None, profile: self.profile, exclude: self.exclude, + test: None, + filter: vec![], } .run(ctx.clone())?; }