Skip to content

Commit

Permalink
[ci] Skip clang-format for disabled directories
Browse files Browse the repository at this point in the history
Search for ".clang-format" files with "DisableFormat" lines and remove
any files whose path is below their location (i.e. their path with the
filename removed).

This reduces the runtime of the clang-format CI step by ~5 minutes,
because it takes that long for clang-format to work through the json.h
library header.
  • Loading branch information
grandchild committed Jun 29, 2024
1 parent 1d39fdb commit 5607119
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/check-and-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ jobs:
set -x -u -o pipefail
clang-format --version
git ls-files '*.c' '*.cpp' '*.h' \
| grep -vf <(grep -rl "^DisableFormat: *true" **/.clang-format \
| sed 's:/.clang-format::')
| xargs clang-format "${clang_format_args[@]}"
git diff --exit-code # i.e. fail CI on non-empty diff
Expand Down

0 comments on commit 5607119

Please sign in to comment.