ci: enable coverage for Qt Tests
This commit is contained in:
12
.github/workflows/sonarcloud-analysis.yml
vendored
12
.github/workflows/sonarcloud-analysis.yml
vendored
@ -51,16 +51,20 @@ jobs:
|
||||
run: |
|
||||
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:
|
||||
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
|
||||
id: coverage-paths
|
||||
run: |
|
||||
legacytests=$(find build -name coverage-legacytests.xml)
|
||||
paths="${legacytests}"
|
||||
paths=$(ls -w 0 -m build/coverage-*.xml | sed 's/ //g')
|
||||
if [ -z "$paths" ]; then
|
||||
echo "Error: No coverage files found"
|
||||
exit 1
|
||||
|
||||
@ -39,6 +39,15 @@ function(create_test)
|
||||
set_tests_properties(${m_NAME} PROPERTIES DEPENDS ${m_DEPENDS})
|
||||
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()
|
||||
|
||||
enable_testing()
|
||||
|
||||
Reference in New Issue
Block a user