diff --git a/.github/workflows/build-engine-linux.yml b/.github/workflows/build-engine-linux.yml index bc369993a2..362c7ea7d3 100644 --- a/.github/workflows/build-engine-linux.yml +++ b/.github/workflows/build-engine-linux.yml @@ -25,7 +25,7 @@ jobs: sudo apt-get install xorg-dev libglu1-mesa-dev gcc-11 g++-11 - name: Configure CMake - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_CORE_SAMPLES=ON -DBUILD_CORE_TESTS=ON -DBUILD_ENGINE_SAMPLES=ON + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_CORE_SAMPLES=ON -DBUILD_CORE_TESTS=ON -DBUILD_ENGINE_SAMPLES=ON -DUSE_CLANG_TIDY=OFF shell: bash env: CC: gcc-11 diff --git a/.github/workflows/build-engine-macos.yml b/.github/workflows/build-engine-macos.yml index 1c50614cda..8f560c4906 100644 --- a/.github/workflows/build-engine-macos.yml +++ b/.github/workflows/build-engine-macos.yml @@ -24,7 +24,7 @@ jobs: brew install glfw llvm@14 - name: Configure CMake - run: CC=$(brew --prefix llvm@14)/bin/clang CXX=$(brew --prefix llvm@14)/bin/clang++ cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DGLFW_USE_SUBMODULE=OFF -DBUILD_CORE_SAMPLES=ON -DBUILD_CORE_TESTS=ON -DBUILD_ENGINE_SAMPLES=ON + run: CC=$(brew --prefix llvm@14)/bin/clang CXX=$(brew --prefix llvm@14)/bin/clang++ cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DGLFW_USE_SUBMODULE=OFF -DBUILD_CORE_SAMPLES=ON -DBUILD_CORE_TESTS=ON -DBUILD_ENGINE_SAMPLES=ON -DUSE_CLANG_TIDY=OFF shell: bash - name: Build diff --git a/.github/workflows/build-engine-windows.yml b/.github/workflows/build-engine-windows.yml index 19e4b73912..a5f060bfe6 100644 --- a/.github/workflows/build-engine-windows.yml +++ b/.github/workflows/build-engine-windows.yml @@ -23,7 +23,7 @@ jobs: run: cmake -E make_directory ${{github.workspace}}\build - name: Configure CMake - run: cmake -B ${{github.workspace}}\build -G "Visual Studio 17 2022" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_CORE_SAMPLES=ON -DBUILD_CORE_TESTS=ON -DBUILD_ENGINE_SAMPLES=ON + run: cmake -B ${{github.workspace}}\build -G "Visual Studio 17 2022" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_CORE_SAMPLES=ON -DBUILD_CORE_TESTS=ON -DBUILD_ENGINE_SAMPLES=ON -DUSE_CLANG_TIDY=OFF - name: Build run: cmake --build ${{github.workspace}}\build --config ${{env.BUILD_TYPE}} diff --git a/.github/workflows/clang-tidy-lint.yml b/.github/workflows/clang-tidy-lint.yml new file mode 100644 index 0000000000..31def1e45a --- /dev/null +++ b/.github/workflows/clang-tidy-lint.yml @@ -0,0 +1,48 @@ +name: 🔍 Static Analysis + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + workflow_dispatch: + +env: + BUILD_TYPE: Release + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install xorg-dev libglu1-mesa-dev gcc-11 g++-11 clang-tidy + + - name: Prepare compile_commands.json + run: cmake -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_CORE_SAMPLES=ON -DBUILD_CORE_TESTS=ON -DBUILD_ENGINE_SAMPLES=ON -DUSE_CLANG_TIDY=ON + shell: bash + env: + CC: gcc-11 + CXX: g++-11 + + - name: Create results directory + run: | + mkdir clang-tidy-result + + - name: Analyze + run: | + git diff -U0 HEAD^ | clang-tidy-diff -p1 -path build -export-fixes clang-tidy-result/fixes.yml + + - name: Run clang-tidy-pr-comments action + uses: platisd/clang-tidy-pr-comments@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + clang_tidy_fixes: clang-tidy-result/fixes.yml + request_changes: true + suggestions_per_comment: 10