From e2a3c6c8f9e2ed3e4a74f9e02fd7e7de6327b4cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E5=BA=86=E4=B8=B0?= Date: Mon, 7 Sep 2026 16:19:24 +0800 Subject: [PATCH] ci: build and run the unit test suite on Linux/macOS/Windows ENGINE_BUILD_TESTS is OFF by default so CI never compiled or ran the unittest suite. Configure with ENGINE_BUILD_TESTS=ON and run ctest after the main targets on the three CMake-driven workflows; build_windows.ps1 gains a -RunTests switch (forces tests ON, builds remaining targets, runs ctest) instead of hardcoding it into the release presets. Rebased after the test-gate split (#480-era): the noisy utility/perf tests now live behind ENGINE_BUILD_EXTENDED_TESTS / MODEL_TESTS, so the plain unit gate runs clean with no per-test exclusions. --- .github/workflows/linux-build.yml | 5 +++++ .github/workflows/mac-build.yml | 8 +++++++- scripts/build_windows.ps1 | 12 ++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index 3e104a45..de9919c3 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -58,3 +58,8 @@ jobs: - name: Build run: | cmake --build "$BUILD_DIR" --parallel "$(nproc)" --target audiocpp_cli audiocpp_server audiocpp_gguf + + - name: Build and run unit tests + run: | + cmake --build "$BUILD_DIR" --parallel "$(nproc)" + ctest --test-dir "$BUILD_DIR" --output-on-failure --parallel 4 diff --git a/.github/workflows/mac-build.yml b/.github/workflows/mac-build.yml index d434203c..ac752f7c 100644 --- a/.github/workflows/mac-build.yml +++ b/.github/workflows/mac-build.yml @@ -40,10 +40,16 @@ jobs: -DENGINE_ENABLE_VULKAN=OFF \ -DENGINE_ENABLE_METAL=OFF \ -DENGINE_ENABLE_OPENMP=OFF \ - -DGGML_OPENMP=OFF + -DGGML_OPENMP=OFF \ + -DENGINE_BUILD_TESTS=ON - name: Build run: | cmake --build "$BUILD_DIR" \ --parallel "$(sysctl -n hw.logicalcpu)" \ --target audiocpp_cli audiocpp_server audiocpp_gguf + + - name: Build and run unit tests + run: | + cmake --build "$BUILD_DIR" --parallel "$(sysctl -n hw.logicalcpu)" + ctest --test-dir "$BUILD_DIR" --output-on-failure --parallel 4 diff --git a/scripts/build_windows.ps1 b/scripts/build_windows.ps1 index 53790d3e..cdcf8cc3 100644 --- a/scripts/build_windows.ps1 +++ b/scripts/build_windows.ps1 @@ -4,6 +4,7 @@ param( [string]$Target = "audiocpp_cli", [int]$Jobs = 0, [switch]$ConfigureOnly, + [switch]$RunTests, [switch]$Clean, [string]$CudaArchitectures = "auto", [ValidateSet("", "native", "avx2", "baseline")] @@ -460,6 +461,9 @@ function Find-VulkanRoot { } $settings = Get-PresetSettings $Preset +if ($RunTests) { + $settings.BuildTests = "ON" +} $cpuArchSettings = Get-CpuArchSettings $CpuArch if ($null -ne $cpuArchSettings.Native) { $settings.Native = $cpuArchSettings.Native @@ -632,3 +636,11 @@ if ($Target -ne "") { Write-Host "Build jobs: $effectiveJobs" Invoke-Checked $cmake $buildArgs + +if ($RunTests) { + # Unit tests live under ENGINE_BUILD_TESTS; flip ON above, build everything + # that the -Target build skipped, then run the registered ctest suite. + Invoke-Checked $cmake @("--build", $buildDir, "-j", $effectiveJobs.ToString()) + $ctest = Join-Path (Split-Path $cmake -Parent) "ctest.exe" + Invoke-Checked $ctest @("--test-dir", $buildDir, "--output-on-failure", "-j", $effectiveJobs.ToString()) +}