You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pn...@apache.org on 2026/02/10 19:22:13 UTC
(celix) 04/04: gh-566: Add clang-tidy ci workflow
This is an automated email from the ASF dual-hosted git repository.
pnoltes pushed a commit to branch feature/566-introduce-clang-tidy-setup
in repository https://gitbox.apache.org/repos/asf/celix.git
commit 93d2c0eded228c863510e09bb9939e20ea0912f2
Author: Pepijn Noltes <pn...@apache.org>
AuthorDate: Tue Feb 10 20:21:51 2026 +0100
gh-566: Add clang-tidy ci workflow
---
.clang-tidy | 14 ++++---
.github/workflows/clang-tidy-scan.yml | 77 +++++++++++++++++++++++++++++++++++
.github/workflows/ubuntu.yml | 5 +--
3 files changed, 87 insertions(+), 9 deletions(-)
diff --git a/.clang-tidy b/.clang-tidy
index f7e376801..6530f77cf 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -134,11 +134,13 @@ Checks: >
-cert-dcl51-cpp,
-cert-dcl50-cpp,
-cert-msc50-cpp,
- -cert-msc51-cpp,
- -cert-dcl59-cpp
-WarningsAsErrors: '*'
-HeaderFilterRegex: '.*'
-#HeaderFilterRegex: '(bundles|libs|misc)/.*'
+ -cert-msc51-cpp
+# TODO re-enable check suppression (disabled to trigger check results in the GitHub Sarif report)
+# -cert-dcl59-cpp
+WarningsAsErrors: "*"
FormatStyle: file
-SystemHeaders: false
+#Note SystemHeaders not supported on ubuntu 22.04 ci (clang-tidy version 14.0), using header filter regex instead
+#HeaderFilterRegex: ".*"
+#SystemHeaders: false
+HeaderFilterRegex: "(bundles|libs|misc).*"
...
diff --git a/.github/workflows/clang-tidy-scan.yml b/.github/workflows/clang-tidy-scan.yml
new file mode 100644
index 000000000..fd1f006d2
--- /dev/null
+++ b/.github/workflows/clang-tidy-scan.yml
@@ -0,0 +1,77 @@
+name: Celix clang-tidy Scan
+
+on:
+ push:
+ pull_request:
+ schedule:
+ - cron: '0 0 * * *'
+
+env:
+ CONAN_USER_HOME: "${{ github.workspace }}/release/"
+ CONAN_USER_HOME_SHORT: "${{ github.workspace }}/release/short"
+ CONAN_HOME: "${{ github.workspace }}/release/"
+ CC: gcc
+ CXX: g++
+
+jobs:
+
+ clang-tidy-scan:
+ runs-on: ubuntu-22.04
+ timeout-minutes: 120
+ steps:
+ - name: Checkout source code
+ uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c #v3.3.0
+ - name: Install build dependencies
+ run: |
+ sudo pip install -U conan
+ sudo apt-get install -yq --no-install-recommends ninja-build clang-tidy
+ - name: Setup Conan Profile
+ run: |
+ # build profile
+ conan profile detect -f --name release
+ sed -i 's/compiler.cppstd=gnu14/compiler.cppstd=gnu17/g' `conan profile path release`
+ echo "[tool_requires]" >> `conan profile path release`
+ echo "cmake/3.26.4" >> `conan profile path release`
+
+ # host profile
+ conan profile detect -f
+ sed -i 's/build_type=Release/build_type=RelWithDebInfo/g' `conan profile path default`
+ sed -i 's/compiler.cppstd=gnu14/compiler.cppstd=gnu17/g' `conan profile path default`
+ echo "[tool_requires]" >> `conan profile path default`
+ echo "cmake/3.26.4" >> `conan profile path default`
+ - name: Conan Cache
+ id: cache-conan
+ uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf #v4.2.2
+ env:
+ cache-name: cache-conan2-modules
+ with:
+ path: ${{ env.CONAN_HOME }}
+ key: ${{ runner.os }}-test-builder-${{ env.cache-name }}-gcc-RelWithDebInfo-clang-tidy-${{ hashFiles('conanfile.py') }}
+ restore-keys: ${{ runner.os }}-test-builder-${{ env.cache-name }}-gcc-RelWithDebInfo-
+ - name: Install Dependencies and configure CMake
+ env:
+ CONAN_BUILD_OPTIONS: |
+ -o celix/*:enable_testing=True
+ -o celix/*:enable_benchmarking=True
+ -o celix/*:build_all=True
+ run: |
+ conan install . -c tools.cmake.cmaketoolchain:generator=Ninja -pr:b release -pr:h default -of build ${CONAN_BUILD_OPTIONS} -b missing
+ #CMake configure -> generate build/compile_commands.json
+ cmake --preset conan-relwithdebinfo
+ - name: Setup Rust Tools (binary install)
+ uses: cargo-bins/cargo-binstall@ec80feb9e330418e014932e5982599255eff6dbb #v1.17.4
+ - name: Install SARIF Tools
+ run: cargo binstall -y clang-tidy-sarif
+ - name: Run clang-tidy
+ run: |
+ set -o pipefail
+ run-clang-tidy -p build -quiet | tee clang-tidy-report.txt
+ - name: Convert clang-tidy output to sarif
+ if: always()
+ run: cat clang-tidy-report.txt | clang-tidy-sarif > clang-tidy-report.sarif
+ - name: upload sarif report
+ uses: github/codeql-action/upload-sarif@45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2 #4.32.2
+ if: always()
+ with:
+ sarif_file: clang-tidy-report.sarif
+ category: clang-tidy
diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml
index 9ffa48867..6eb39059b 100644
--- a/.github/workflows/ubuntu.yml
+++ b/.github/workflows/ubuntu.yml
@@ -81,7 +81,6 @@ jobs:
-o celix/*:enable_testing_on_ci=True
-o celix/*:framework_curlinit=False
-o celix/*:enable_ccache=True
- -o celix/*:enable_clang_tidy=${{ (matrix.type == 'RelWithDebInfo' && matrix.compiler[0] == 'clang') && 'True' || 'False' }}
run: |
conan build . -c tools.cmake.cmaketoolchain:generator=Ninja -pr:b release -pr:h default -of build ${CONAN_BUILD_OPTIONS} -b missing
- name: Test
@@ -147,13 +146,13 @@ jobs:
-DCMAKE_BUILD_TYPE=${{ matrix.type }}
-DENABLE_CCACHE=ON
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
- -DENABLE_GCC_ANALYZER=OFF
+ -DENABLE_GCC_ANALYZER=${{matrix.type == 'RelWithDebInfo' && 'ON' || 'OFF'}}
-G Ninja
run: |
mkdir build install
cd build
cmake ${BUILD_OPTIONS} -DCMAKE_INSTALL_PREFIX=../install ..
- ninja -j8
+ ninja -j8
ninja install
- name: Test
run: |