diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml index efa823439cabc..17a58898813da 100644 --- a/.github/workflows/clang-tidy.yml +++ b/.github/workflows/clang-tidy.yml @@ -39,12 +39,20 @@ jobs: needs: skip-duplicates if: ${{ needs.skip-duplicates.outputs.should_skip != 'true' }} + strategy: + fail-fast: true + matrix: + # To make the run finish in the run time limit, we split it up into two + # parts: the src directory and everything else + subset: [ 'src', 'other' ] + runs-on: ubuntu-20.04 env: CMAKE: 1 CLANG: clang++-12 COMPILER: clang++-12 CATA_CLANG_TIDY: plugin + CATA_CLANG_TIDY_SUBSET: ${{ matrix.subset }} TILES: 1 SOUND: 1 RELEASE: 1 diff --git a/build-scripts/clang-tidy.sh b/build-scripts/clang-tidy.sh index 1cd8a4169d4e6..2f97bbadfb524 100755 --- a/build-scripts/clang-tidy.sh +++ b/build-scripts/clang-tidy.sh @@ -121,6 +121,19 @@ else fi fi +printf "Subset to analyze: '%s'\n" "$CATA_CLANG_TIDY_SUBSET" + +# We might need to analyze only a subset of the files if they have been split +# into multiple jobs for efficiency +case "$CATA_CLANG_TIDY_SUBSET" in + ( src ) + tidyable_cpp_files=$(printf '%s\n' "$tidyable_cpp_files" | grep '/src/') + ;; + ( other ) + tidyable_cpp_files=$(printf '%s\n' "$tidyable_cpp_files" | grep -v '/src/') + ;; +esac + function analyze_files_in_random_order { if [ -n "$1" ]