mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-08 04:44:13 +02:00
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user