From 9f8ae70cbaabda7d14f29030cca7daf95c0ad58a Mon Sep 17 00:00:00 2001 From: Arnaud Ferraris Date: Tue, 29 Oct 2024 15:04:23 +0100 Subject: [PATCH] gitlab-ci: add static analysis check Similar to the formatting check job, take advantage of the `clang-tidy` configuration we just created to add a new job running this tool. Running `clang-tidy` requires the following: * build dependencies must be present on the system so it can resolve the includes * the build folder must be configured as it relies on the `compile_commands.json` to get build flags (such as the include paths) This could be run in the `build` job, but it would make it harder to understand the actual underlying issue, so this is executed as a new, separate job, re-using the artifacts from the `build` job. --- .gitlab-ci.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 66f82cb..33c3b45 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -37,3 +37,13 @@ format: - apt-get update - apt-get -y install ${BUILD_DEPS} clang-format-${CLANG_VERSION} - ninja -C build clang-format-check + +check: + stage: check + dependencies: + - build + script: + - apt-get update + # clang-tidy needs all dependencies to be installed so it can inspect their headers + - apt-get -y install ${BUILD_DEPS} clang-tidy-${CLANG_VERSION} + - ninja -C build clang-tidy