ci: Add PVS-Studio linting

It requires a license, so run it only in continuous and nightly
pipelines where we can make the license available.

Co-authored-by: Martin Duffy <martin.duffy@kitware.com>
This commit is contained in:
Brad King
2026-04-29 18:29:44 -04:00
co-authored by Martin Duffy
parent b7105edd72
commit 7ddd46bb7b
5 changed files with 40 additions and 0 deletions
+12
View File
@@ -138,6 +138,18 @@ l:tidy-fedora43:
- .cmake_cdash_artifacts
- .rules
l:pvs-studio-fedora43:
extends:
- .fedora43_pvs_studio
- .cmake_build_linux
- .linux_x86_64_tags
- .cmake_cdash_artifacts
- .rules
variables:
CMAKE_CI_JOB_CONTINUOUS: "true"
CMAKE_CI_JOB_NIGHTLY: "true"
CMAKE_CI_JOB_NO_MR: "true"
l:sphinx-fedora43:
extends:
- .fedora43_sphinx
@@ -0,0 +1,3 @@
set(configure_no_sccache 1)
set(CMake_RUN_PVS_STUDIO ON CACHE BOOL "")
include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora43_common.cmake")
+1
View File
@@ -0,0 +1 @@
. .gitlab/ci/pvs-studio-env.sh
+8
View File
@@ -132,6 +132,14 @@
CMAKE_CONFIGURATION: fedora43_tidy
CMAKE_CI_NO_INSTALL: 1
.fedora43_pvs_studio:
extends: .fedora43
environment:
name: pvs-studio
variables:
CMAKE_CONFIGURATION: fedora43_pvs_studio
CMAKE_CI_NO_INSTALL: 1
.fedora43_clang_analyzer:
extends: .fedora43
+16
View File
@@ -391,6 +391,22 @@ if(CMake_RUN_IWYU)
list(APPEND CMAKE_CXX_INCLUDE_WHAT_YOU_USE ${CMake_IWYU_OPTIONS})
endif()
option(CMake_RUN_PVS_STUDIO "Run pvs-studio-analyzer with the compiler." OFF)
if(CMake_RUN_PVS_STUDIO)
if(CMake_SOURCE_DIR STREQUAL CMake_BINARY_DIR)
message(FATAL_ERROR "CMake_RUN_PVS_STUDIO requires an out-of-source build!")
endif()
find_program(PVS_STUDIO_COMMAND NAMES pvs-studio-analyzer)
if(NOT PVS_STUDIO_COMMAND)
message(FATAL_ERROR "CMake_RUN_PVS_STUDIO is ON but pvs-studio-analyzer is not found!")
endif()
set(CMAKE_CXX_PVS_STUDIO
"${PVS_STUDIO_COMMAND}" analyze
-a GA
--apply-pvs-configs
--project-root "${CMAKE_SOURCE_DIR}"
)
endif()
#-----------------------------------------------------------------------
# a macro that only sets the FOLDER target property if it's