-
Notifications
You must be signed in to change notification settings - Fork 305
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3236 from cgwalters/clang-format
ci: Only run clang-format on ubuntu-stable GH runner
- Loading branch information
Showing
4 changed files
with
37 additions
and
20 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bash | ||
# Tests that validate structure of the source code; | ||
# can be run without building it. | ||
set -euo pipefail | ||
|
||
clang_ver=$(clang-format --version) | ||
clang_min_ver=15 | ||
version_re=" version ([0-9]+)." | ||
if [[ $clang_ver =~ $version_re ]]; then | ||
if test "${BASH_REMATCH[1]}" -ge "${clang_min_ver}"; then | ||
echo -n "checking clang-format... " | ||
git ls-files '**.c' '**.cxx' '**.h' '**.hpp' | xargs clang-format --Werror --dry-run | ||
echo "ok" | ||
else | ||
echo "notice: clang-format ${clang_ver}" is too old | ||
fi | ||
else | ||
echo "failed to parse clang-format version ${clang_ver}" 1>&2 | ||
exit 1 | ||
fi |
This file contains 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
This file contains 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