ci: enable coverage for Qt Tests
This commit is contained in:
parent
81392fe758
commit
49173b11b9
2 changed files with 17 additions and 4 deletions
12
.github/workflows/sonarcloud-analysis.yml
vendored
12
.github/workflows/sonarcloud-analysis.yml
vendored
|
|
@ -51,16 +51,20 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
build-wrapper-linux-x86-64 --out-dir bw-output cmake --build build -j${CPU_CORE_COUNT}
|
build-wrapper-linux-x86-64 --out-dir bw-output cmake --build build -j${CPU_CORE_COUNT}
|
||||||
|
|
||||||
- name: Legacy tests coverage
|
- name: Test coverage
|
||||||
|
shell: bash
|
||||||
env:
|
env:
|
||||||
QT_QPA_PLATFORM: offscreen
|
QT_QPA_PLATFORM: offscreen
|
||||||
run: cmake --build build --target coverage-legacytests
|
run: |
|
||||||
|
tests=(`cmake --build build --target help | grep -o "^coverage-[^:]*"`)
|
||||||
|
for i in "${tests[@]}"; do
|
||||||
|
cmake --build build --target "$i"
|
||||||
|
done
|
||||||
|
|
||||||
- name: Get coverage report paths
|
- name: Get coverage report paths
|
||||||
id: coverage-paths
|
id: coverage-paths
|
||||||
run: |
|
run: |
|
||||||
legacytests=$(find build -name coverage-legacytests.xml)
|
paths=$(ls -w 0 -m build/coverage-*.xml | sed 's/ //g')
|
||||||
paths="${legacytests}"
|
|
||||||
if [ -z "$paths" ]; then
|
if [ -z "$paths" ]; then
|
||||||
echo "Error: No coverage files found"
|
echo "Error: No coverage files found"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,15 @@ function(create_test)
|
||||||
set_tests_properties(${m_NAME} PROPERTIES DEPENDS ${m_DEPENDS})
|
set_tests_properties(${m_NAME} PROPERTIES DEPENDS ${m_DEPENDS})
|
||||||
set_property(GLOBAL APPEND PROPERTY ${CMAKE_PROJECT_NAME}_tests ${m_NAME})
|
set_property(GLOBAL APPEND PROPERTY ${CMAKE_PROJECT_NAME}_tests ${m_NAME})
|
||||||
|
|
||||||
|
if(ENABLE_COVERAGE)
|
||||||
|
setup_target_for_coverage_gcovr_xml(
|
||||||
|
NAME coverage-${m_NAME}
|
||||||
|
EXECUTABLE ${m_NAME}
|
||||||
|
BASE_DIRECTORY ${CMAKE_SOURCE_DIR}/src
|
||||||
|
EXCLUDE subprojects/* ${CMAKE_BINARY_DIR}/* src/unittest/*
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue