1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 19:08:07 +08:00

gitlab-ci: add a series of jobs to perform coverage

This commit is contained in:
Ben Boeckel
2025-09-24 23:33:05 -04:00
parent cedd32892e
commit f7b0ddbe92
3 changed files with 99 additions and 0 deletions

View File

@@ -40,6 +40,7 @@ variables:
################################################################################
# Job prefixes:
# - `a:` analysis
# - `b:` build
# - `k:` package
# - `l:` lint
@@ -147,6 +148,44 @@ l:clazy-fedora42:
- .linux_x86_64_tags
- .run_automatically
# Coverage builds
b:fedora42-gcc-gcov:
extends:
- .fedora42_gcc_gcov
- .cmake_build_linux
- .cmake_build_artifacts
- .linux_x86_64_tags
- .run_manually
variables:
CMAKE_CI_JOB_NIGHTLY: "true"
t:fedora42-gcc-gcov:
extends:
- .fedora42_gcc_gcov
- .cmake_test_linux
- .cmake_coverage_artifacts
- .linux_x86_64_tags_x11
- .run_dependent
# Run coverage analysis even if the tests fail.
allow_failure: true
needs:
- b:fedora42-gcc-gcov
variables:
CMAKE_CI_JOB_NIGHTLY: "true"
a:fedora42-gcc-gcov:
extends:
- .fedora42_gcc_gcov
- .cmake_coverage_linux
- .cmake_cdash_artifacts
- .linux_x86_64_tags
- .run_dependent
needs:
- t:fedora42-gcc-gcov
variables:
CMAKE_CI_JOB_NIGHTLY: "true"
# Linux builds
b:centos7-x86_64:

View File

@@ -0,0 +1,46 @@
set(CMake_TEST_GUI "ON" CACHE BOOL "")
set(CMake_TEST_MODULE_COMPILATION "named,compile_commands,collation,partitions,internal_partitions,export_bmi,install_bmi,shared,bmionly,build_database" CACHE STRING "")
set(CMake_TEST_TLS_VERIFY_URL "https://gitlab.kitware.com" CACHE STRING "")
set(CMake_TEST_TLS_VERIFY_URL_BAD "https://badtls-expired.kitware.com" CACHE STRING "")
set(CMake_TEST_TLS_VERSION "1.3" CACHE STRING "")
set(CMake_TEST_TLS_VERSION_URL_BAD "https://badtls-v1-1.kitware.com:8011" CACHE STRING "")
string(CONCAT coverage_flags
"--coverage "
"-fprofile-abs-path "
# These files are committed generated sources and contain relative path
# `#line` directives. CI coverage then cannot find the source files reliably.
# See related issue #20001.
"-fprofile-exclude-files=cmExprParser[.].*\\;cmFortranParser[.].* "
"-fdiagnostics-show-option "
"-Wall "
"-Wextra "
"-Wshadow "
"-Wpointer-arith "
"-Winvalid-pch "
"-Wcast-align "
"-Wdisabled-optimization "
"-Wwrite-strings "
"-fstack-protector-all "
"-Wconversion "
"-Wno-error=sign-conversion "
"-Wno-error=conversion ")
string(CONCAT link_flags
"--coverage ")
set(CMAKE_C_FLAGS "${coverage_flags}" CACHE STRING "")
set(CMAKE_CXX_FLAGS "${coverage_flags} -Woverloaded-virtual -Wstrict-null-sentinel" CACHE STRING "")
# Apply `LDFLAGS`.
set(CMAKE_EXE_LINKER_FLAGS_INIT "${link_flags}" CACHE STRING "")
set(CMAKE_SHARED_LINKER_FLAGS_INIT "${link_flags}" CACHE STRING "")
set(CMAKE_MODULE_LINKER_FLAGS_INIT "${link_flags}" CACHE STRING "")
# Do not bootstrap for the coverage test suite.
set(CMAKE_SKIP_BOOTSTRAP_TEST TRUE CACHE BOOL "")
# Cover compilation with C++11 only and not higher standards.
set(CMAKE_CXX_STANDARD "11" CACHE STRING "")
# Qt 6 requires C++17, so use Qt 5.
set(CMake_QT_MAJOR_VERSION "5" CACHE STRING "")
include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora42_common.cmake")

View File

@@ -97,6 +97,20 @@
GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake-ci"
CMAKE_ARCH: x86_64
#### Coverage builds
.fedora42_gcc_gcov:
extends: .fedora42
variables:
# See issue #20001
CMAKE_GENERATOR: "Unix Makefiles"
CMAKE_CONFIGURATION: fedora42_gcc_gcov
CTEST_NO_WARNINGS_ALLOWED: 1
CMAKE_CI_BUILD_TYPE: Debug
CMAKE_CI_TEST_TIMEOUT: "1500"
CMAKE_CI_NO_INSTALL: 1
#### Lint builds
.fedora42_tidy: