From c7a9ddbf8c5a5114d72ba88a448c91a2339ec650 Mon Sep 17 00:00:00 2001 From: Beat Hangartner Date: Tue, 6 Oct 2026 14:05:57 +0200 Subject: [PATCH] CI: build and run the unit tests in the Windows job The Windows job configured with -DPACKAGE_TESTS=OFF, so no test ever ran on Windows. Build the tests and run ctest after the build, with the offscreen platform. ctest prints no output for failed tests in the MSYS2 shell, so each failed test runs again with QtTest writing its log to a file, which is printed in its own log group. The ctest log is added to the artifact uploaded on failure. No change to the app or its files. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/windows-build.yml | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml index 9d6cfb9a0..bc0ff10e5 100644 --- a/.github/workflows/windows-build.yml +++ b/.github/workflows/windows-build.yml @@ -117,7 +117,7 @@ jobs: -DQT_VERSION_MAJOR=6 \ -DBUILD_WITH_KF=ON \ -DBUILD_KF=OFF \ - -DPACKAGE_TESTS=OFF \ + -DPACKAGE_TESTS=ON \ -DCMAKE_POLICY_DEFAULT_CMP0077=NEW \ -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ -DQET_EXPORT_PROJECT_DB=ON \ @@ -136,6 +136,32 @@ jobs: echo "=== ccache statistics ===" /ucrt64/bin/ccache -s + - name: Run the unit tests + shell: msys2 {0} + env: + QT_QPA_PLATFORM: offscreen + run: | + set -euo pipefail + cd "$GITHUB_WORKSPACE/build" + ctest --output-on-failure --timeout 300 && exit 0 + # ctest shows no output for failed tests in this shell, so run each + # failed test again with QtTest writing its log to a file, and print it. + set +e + while IFS=: read -r _ name; do + name=${name%$'\r'} + exe=$(find tests -name "$name.exe" | head -1) + echo "::group::$name" + if [ -n "$exe" ]; then + QT_QPA_PLATFORM=offscreen "$exe" -o "$name.txt,txt" + echo "exit code $?" + cat "$name.txt" 2>/dev/null + else + echo "no executable for $name" + fi + echo "::endgroup::" + done < Testing/Temporary/LastTestsFailed.log + exit 1 + - name: Verify exe was built shell: msys2 {0} run: | @@ -436,6 +462,7 @@ jobs: name: build-logs-qt6 path: | build/CMakeFiles/*.log + build/Testing/Temporary/LastTest*.log nsis_root/files/bin/ if-no-files-found: warn