[CI] Enable automatic NOLINT check #739
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Static analysis | |
| on: [pull_request] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/master' && github.event_name != 'merge_group' && !startsWith(github.ref, 'refs/heads/gh-readonly-queue') }} # yamllint disable-line | |
| jobs: | |
| clang-tidy: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: ccache | |
| uses: hendrikmuhs/ccache-action@v1.2 | |
| with: | |
| key: ${{ runner.os }}-clang | |
| - uses: ZedThree/clang-tidy-review@v0.21.0 | |
| id: review | |
| with: | |
| build_dir: build | |
| apt_packages: mpich,libmpich*,mpi*,openmpi-bin,ninja-build,libomp-19-dev,valgrind,libopencv-dev | |
| cmake_command: > | |
| cmake -S . -B build | |
| -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache | |
| -D USE_FUNC_TESTS=ON -D USE_PERF_TESTS=ON | |
| -G Ninja | |
| -D USE_SEQ=ON -D USE_MPI=ON | |
| -D USE_OMP=ON -D USE_TBB=ON -D USE_STL=ON | |
| -D CMAKE_BUILD_TYPE=RELEASE -DCMAKE_EXPORT_COMPILE_COMMANDS=ON | |
| -D USE_SYSTEM_OPENCV=ON | |
| config_file: .clang-tidy | |
| exclude: 3rdparty | |
| split_workflow: true | |
| clang_tidy_version: "19" | |
| lgtm_comment_body: "" | |
| env: | |
| CC: clang-19 | |
| CXX: clang++-19 | |
| - if: steps.review.outputs.total_comments > 0 | |
| run: | | |
| echo "clang-tidy run has failed. See previous 'Run clang-tidy' stage logs" | |
| exit 1 | |
| clang-tidy-for-gcc-build: | |
| needs: | |
| - clang-tidy | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: ccache | |
| uses: hendrikmuhs/ccache-action@v1.2 | |
| with: | |
| key: ${{ runner.os }}-gcc | |
| - uses: ZedThree/clang-tidy-review@v0.21.0 | |
| id: review | |
| with: | |
| build_dir: build | |
| apt_packages: mpich,libmpich*,mpi*,openmpi-bin,ninja-build,libomp-19-dev,valgrind,libopencv-dev | |
| cmake_command: > | |
| cmake -S . -B build | |
| -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache | |
| -G Ninja | |
| -D USE_FUNC_TESTS=ON -D USE_PERF_TESTS=ON | |
| -D USE_SEQ=ON -D USE_MPI=ON | |
| -D USE_OMP=ON -D USE_TBB=ON -D USE_STL=ON | |
| -D CMAKE_BUILD_TYPE=RELEASE -DCMAKE_EXPORT_COMPILE_COMMANDS=ON | |
| -D USE_SYSTEM_OPENCV=ON | |
| config_file: .clang-tidy | |
| exclude: 3rdparty | |
| split_workflow: true | |
| clang_tidy_version: "19" | |
| lgtm_comment_body: "" | |
| - if: steps.review.outputs.total_comments > 0 | |
| run: | | |
| echo "clang-tidy run has failed. See previous 'Run clang-tidy' stage logs" | |
| exit 1 | |
| nolint-check: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Search for NOLINT | |
| run: | | |
| git fetch origin ${{ github.event.pull_request.base.ref }} | |
| CHANGED_FILES="$(git diff --name-only origin/${{ github.event.pull_request.base.ref }} HEAD)" | |
| for file in $CHANGED_FILES; do | |
| if grep -n "NOLINT" "$file"; then | |
| echo "::error::Found 'NOLINT' in $file." | |
| exit 1 | |
| fi | |
| done | |
| echo "No 'NOLINT' markers found in changed files." |