- 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 Entire-Checkpoint: 70341e29996b Signed-off-by: twi-devel <torsten.wierschin@life-maps.com>
112 lines
2.4 KiB
Groovy
112 lines
2.4 KiB
Groovy
pipeline {
|
|
agent {
|
|
docker {
|
|
image 'lifemaps/ci-cpp:latest'
|
|
reuseNode true
|
|
args '-u root:root'
|
|
}
|
|
}
|
|
|
|
options {
|
|
timestamps()
|
|
disableConcurrentBuilds()
|
|
}
|
|
|
|
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"
|
|
LC_ALL = "C.UTF-8"
|
|
}
|
|
|
|
stages {
|
|
stage('Checkout') {
|
|
steps {
|
|
checkout scm
|
|
sh 'git fetch --all --prune'
|
|
sh 'git submodule update --init --recursive || true'
|
|
}
|
|
}
|
|
|
|
stage('Tool Versions') {
|
|
steps {
|
|
sh '''
|
|
python3 --version
|
|
cmake --version
|
|
ninja --version
|
|
g++ --version
|
|
'''
|
|
}
|
|
}
|
|
|
|
stage('Qt Diagnostics') {
|
|
steps {
|
|
sh '''
|
|
echo "QT_QPA_PLATFORM=$QT_QPA_PLATFORM"
|
|
echo "LANG=$LANG"
|
|
echo "LC_ALL=$LC_ALL"
|
|
dpkg -l | grep -E "qt6-base-dev|qtbase5-dev|qt6-tools" || true
|
|
pkg-config --list-all | grep -i qt || true
|
|
'''
|
|
}
|
|
}
|
|
|
|
stage('Policy Checks') {
|
|
steps {
|
|
sh 'python3 ci/check_pr_policies.py'
|
|
}
|
|
}
|
|
|
|
stage('Configure') {
|
|
steps {
|
|
sh 'cmake -S ${PROJECT_DIR} -B ${BUILD_DIR} -G Ninja -DCMAKE_BUILD_TYPE=Debug'
|
|
}
|
|
}
|
|
|
|
stage('Build') {
|
|
steps {
|
|
sh 'cmake --build ${BUILD_DIR} --parallel'
|
|
}
|
|
}
|
|
|
|
stage('Test') {
|
|
steps {
|
|
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 {
|
|
always {
|
|
script {
|
|
if (getContext(hudson.FilePath)) {
|
|
cleanWs deleteDirs: true, disableDeferredWipeout: true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|