build: Add new SKIP_BUILD_TESTS option to allow the build time test to be skipped and run later on
ci: run and check Qt Tests post build
This commit is contained in:
parent
89c199b630
commit
db3b18b36d
3 changed files with 30 additions and 8 deletions
20
.github/actions/run-tests/action.yml
vendored
20
.github/actions/run-tests/action.yml
vendored
|
|
@ -15,8 +15,22 @@ runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Unit tests
|
- name: unittests
|
||||||
id: unittests
|
id: unittests
|
||||||
|
env:
|
||||||
|
QT_QPA_PLATFORM: offscreen
|
||||||
|
run: |
|
||||||
|
ctest --test-dir "build/src/unittests" --output-on-failure
|
||||||
|
result=$?
|
||||||
|
|
||||||
|
if [ $result -ne 0 ]; then
|
||||||
|
echo "Unit tests failed with code: $result" >> $GITHUB_STEP_SUMMARY
|
||||||
|
fi
|
||||||
|
shell: bash
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
- name: legacytests
|
||||||
|
id: legacytests
|
||||||
env:
|
env:
|
||||||
QT_QPA_PLATFORM: offscreen
|
QT_QPA_PLATFORM: offscreen
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -35,8 +49,11 @@ runs:
|
||||||
pass="✅ Pass"
|
pass="✅ Pass"
|
||||||
fail="❌ Fail"
|
fail="❌ Fail"
|
||||||
unittests_outcome="${{ steps.unittests.outcome }}"
|
unittests_outcome="${{ steps.unittests.outcome }}"
|
||||||
|
legacytests_outcome="${{ steps.legacytests.outcome }}"
|
||||||
unittests=$( [ "$unittests_outcome" = "success" ] && echo $pass || echo $fail )
|
unittests=$( [ "$unittests_outcome" = "success" ] && echo $pass || echo $fail )
|
||||||
|
legacytests=$( [ "$legacytests_outcome" = "success" ] && echo $pass || echo $fail )
|
||||||
echo "unittests=$unittests" >> $GITHUB_OUTPUT
|
echo "unittests=$unittests" >> $GITHUB_OUTPUT
|
||||||
|
echo "legacytests=$legacytests" >> $GITHUB_OUTPUT
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Summary row
|
- name: Summary row
|
||||||
|
|
@ -47,6 +64,7 @@ runs:
|
||||||
row=""
|
row=""
|
||||||
row+="| ${{ inputs.job }} "
|
row+="| ${{ inputs.job }} "
|
||||||
row+="| ${{ steps.results.outputs.unittests }} "
|
row+="| ${{ steps.results.outputs.unittests }} "
|
||||||
|
row+="| ${{ steps.results.outputs.legacytests }} "
|
||||||
echo "$row" > $file
|
echo "$row" > $file
|
||||||
|
|
||||||
echo "file=$file" > $GITHUB_OUTPUT
|
echo "file=$file" > $GITHUB_OUTPUT
|
||||||
|
|
|
||||||
2
.github/workflows/continuous-integration.yml
vendored
2
.github/workflows/continuous-integration.yml
vendored
|
|
@ -28,7 +28,7 @@ env:
|
||||||
GIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
|
GIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
|
||||||
PACKAGE_PREFIX: "deskflow"
|
PACKAGE_PREFIX: "deskflow"
|
||||||
PACKAGE_PATH: ./dist
|
PACKAGE_PATH: ./dist
|
||||||
CMAKE_CONFIGURE: "cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_COMPILE_WARNING_AS_ERROR=ON"
|
CMAKE_CONFIGURE: "cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DSKIP_BUILD_TESTS=ON -DCMAKE_COMPILE_WARNING_AS_ERROR=ON"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# Always run this job, even if not on PR, since other jobs need it.
|
# Always run this job, even if not on PR, since other jobs need it.
|
||||||
|
|
|
||||||
|
|
@ -66,9 +66,13 @@ else()
|
||||||
set(guiApp deskflow)
|
set(guiApp deskflow)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_custom_target(run_tests ALL DEPENDS ${PROJECT_TESTS} ${guiApp})
|
option(SKIP_BUILD_TESTS "Skip build time test" OFF)
|
||||||
add_custom_command (
|
|
||||||
TARGET run_tests
|
if(NOT SKIP_BUILD_TESTS)
|
||||||
POST_BUILD
|
add_custom_target(run_tests ALL DEPENDS ${PROJECT_TESTS} ${guiApp})
|
||||||
COMMAND ${qPA_Platform} ${CMAKE_CTEST_COMMAND} --test-dir "${CMAKE_BINARY_DIR}/src/unittests" --output-on-failure
|
add_custom_command (
|
||||||
)
|
TARGET run_tests
|
||||||
|
POST_BUILD
|
||||||
|
COMMAND ${qPA_Platform} ${CMAKE_CTEST_COMMAND} --test-dir "${CMAKE_BINARY_DIR}/src/unittests" --output-on-failure
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue