From 34f2cf7a45af498ca53f665090016b38b7ed2c70 Mon Sep 17 00:00:00 2001 From: Mike Crowe Date: Sat, 22 Feb 2025 15:33:46 +0000 Subject: [PATCH] ci: Test clang-tidy plugin The purpose of these tests is to ensure that anyone attempting to compile the clang-tidy plugin on the tested distributions will be able to and that the resulting plugin will work. Clang-tidy plugins were only introduced with Clang 16, so we can't test with any earlier versions than that. Signed-off-by: Mike Crowe --- .github/workflows/clang-tidy-plugin.yml | 60 +++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/clang-tidy-plugin.yml diff --git a/.github/workflows/clang-tidy-plugin.yml b/.github/workflows/clang-tidy-plugin.yml new file mode 100644 index 000000000..5faf6738e --- /dev/null +++ b/.github/workflows/clang-tidy-plugin.yml @@ -0,0 +1,60 @@ +name: Ubuntu + +on: + push: + branches: + - develop + - master + - release/* + pull_request: + workflow_dispatch: + +permissions: + contents: read + +jobs: + ci_test_clang_tidy: + runs-on: ubuntu-latest + strategy: + matrix: + # clang-tidy plugins require at least Clang 16. This means that + # anything older than Ubuntu 24.04 and Debian 12 can't work at all. + include: + - distro: ubuntu:24.04 + clang_version: 16 + - distro: ubuntu:24.04 + clang_version: 17 + - distro: ubuntu:24.04 + clang_version: 18 + - distro: debian:12 + clang_version: 16 + - distro: debian:12 + clang_version: 19 + - distro: debian:trixie + clang_version: 17 + - distro: debian:trixie + clang_version: 18 + - distro: debian:trixie + clang_version: 19 + container: ${{ matrix.distro }} + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: List files + run: ls -l + - name: Install packages + run: >- + echo distro=${{matrix.distro}} && + echo clang_version=${{matrix.clang_version}} && + apt-get update && + apt-get install -y + build-essential + clang-${{ matrix.clang_version }} + clang-tidy-${{ matrix.clang_version }} + libclang-${{matrix.clang_version}}-dev + cmake ninja-build + - name: Run CMake + run: cmake -S . -B build -G Ninja -DJSON_CI=On -DJSON_ClangTidyPlugin=ON + - name: Build clang-tidy plugin + run: cmake --build build --target clang_tidy_plugin/libNlohmannJsonClangTidyPlugin.so + - name: Test clang-tidy plugin + run: cd build && ctest -V --output-on-failure -R modernize-nlohmann-json-explicit-conversions-check