Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split clang-tidy workflow into two parts #65272

Merged
merged 1 commit into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions build-scripts/clang-tidy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I know why. grep returns with exit code 1 if no file is matched, and this aborts the whole shell script.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these PRs both changed files in the src folder though so it's strange for grep to fail in that case.

;;
esac

function analyze_files_in_random_order
{
if [ -n "$1" ]
Expand Down