feat: Add LCOV coverage support for Jenkins CI
- Add ENABLE_COVERAGE CMake option with gcov flags - Create collect-coverage.sh script for LCOV workflow - Add Qt6 test files with QTest framework - Update Jenkinsfile with Coverage stage (main/master/coverage.*) - Update CI Docker image with lcov and genhtml packages - Add .gitignore entries for coverage artifacts - Add COVERAGE.md documentation Coverage workflow: 1. Configure with -DENABLE_COVERAGE=ON 2. Build and run tests to generate .gcda/.gcno files 3. Collect coverage with lcov 4. Filter out Qt/system libraries 5. Generate HTML report and lcov.info for Jenkins Jenkins publishes coverage/lcov.info using Coverage Plugin. Coverage stage only runs on protected branches. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Entire-Checkpoint: 7783c7698334
This commit is contained in:
1 parent
9e3c6eef2e
commit
8ef6529c0c
19 files changed
+733
-235
No files matched your search
Vendored
+21
@@ -15,6 +15,7 @@ pipeline {
|
||||
environment {
|
||||
PROJECT_DIR = "qt6-after/qt6-migrated-benchmark"
|
||||
BUILD_DIR = "build"
|
||||
COVERAGE_BUILD_DIR = "build-coverage"
|
||||
CHANGE_TARGET = "${env.CHANGE_TARGET ?: 'origin/main'}"
|
||||
QT_QPA_PLATFORM = "offscreen"
|
||||
LANG = "C.UTF-8"
|
||||
@@ -76,6 +77,26 @@ pipeline {
|
||||
sh 'QT_QPA_PLATFORM=offscreen LANG=C.UTF-8 LC_ALL=C.UTF-8 ctest --test-dir ${BUILD_DIR} --output-on-failure'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Coverage') {
|
||||
when {
|
||||
expression {
|
||||
return env.BRANCH_NAME ==~ /main|master|coverage.*/
|
||||
}
|
||||
}
|
||||
steps {
|
||||
echo "Running coverage collection..."
|
||||
sh '''
|
||||
${PROJECT_DIR}/scripts/collect-coverage.sh ${WORKSPACE}/${COVERAGE_BUILD_DIR}
|
||||
'''
|
||||
}
|
||||
post {
|
||||
always {
|
||||
publishCoverage adapters: [lcovAdapter(mergeToOneReport: true, reportFile: 'coverage/lcov.info')],
|
||||
sourceFileResolver: sourceFiles('STORE_LAST_BUILD')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
|
||||
Reference in new issue
Block a user