diff --git a/.github/workflows/clang_tidy.yml b/.github/workflows/clang_tidy.yml new file mode 100644 index 0000000..27dd2cf --- /dev/null +++ b/.github/workflows/clang_tidy.yml @@ -0,0 +1,47 @@ +name: clang-tidy + +on: + workflow_dispatch: + + pull_request: + branches: [main] + # paths: ['**.c', '**.cpp', '**.h', '**.hpp', '**.cxx', '**.hxx', '**.cc', '**.hh', '**CMakeLists.txt', '**.cmake'] + +jobs: + clang-tidy: + runs-on: windows-latest + + # Set required permissions if using thread comments or PR reviews + permissions: + contents: read + pull-requests: write + + steps: + - name: Checkout Repository + uses: actions/checkout@v7 + with: + submodules: recursive + + - name: Set up vcpkg + uses: lukka/run-vcpkg@v11 + + - name: Configure CMake + # -DCMAKE_EXPORT_COMPILE_COMMANDS=ON tells CMake to create compile_commands.json + run: cmake -B build -S . --preset x64-windows-release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + + - name: Run clang-tidy + uses: cpp-linter/cpp-linter-action@v2 + id: linter + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + style: '' # Disable clang-format for this clang-tidy-only workflow + # Point the action to the database generated by CMake in the 'build' folder + database: 'build' + thread-comments: true + + - name: Fail workflow if checks failed + if: steps.linter.outputs.checks-failed != 0 + run: | + echo "Linter detected clang-tidy errors." + exit 1 \ No newline at end of file