Skip to content

Commit e6f68e4

Browse files
committed
ci: use clang 14 in windows runner and update format-files.sh to require clang-format version >= 13 and < 18
1 parent f43c104 commit e6f68e4

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.github/workflows/ci.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ jobs:
3131
steps:
3232
- name: checkout repository
3333
uses: actions/checkout@v4
34+
- name: install clang 14
35+
uses: KyleMayes/install-llvm-action@v2
36+
with:
37+
version: "14"
3438
- name: check format
3539
run: ./format-files.sh check
3640
- name: configure

format-files.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ CLANG_FORMAT_VERSION=$(clang-format --version 2>/dev/null)
1515
if [[ $CLANG_FORMAT_VERSION =~ ([0-9]+)\. ]]; then
1616
MAJOR_VERSION=${BASH_REMATCH[1]}
1717
if (( MAJOR_VERSION < 13 )); then
18-
echo "clang-format version >= 13 required, got $MAJOR_VERSION"
18+
echo "clang-format version >= 13 and < 18 required, got $MAJOR_VERSION"
19+
exit 1
20+
elif (( MAJOR_VERSION > 18 )); then # PointerAlignment: Left, v18 wants `T C::* member` v14 wants `T C::*member`
21+
echo "clang-format version >= 13 and < 18 required, got $MAJOR_VERSION"
1922
exit 1
2023
else
2124
echo "clang-format version $MAJOR_VERSION"
@@ -34,4 +37,4 @@ fi
3437
find "${PROJ_ROOT}" -type f \
3538
\( -name "*.cpp" -o -name "*.c" -o -name "*.hpp" -o -name "*.h" \) \
3639
-not -path "${PROJ_ROOT}/build/*" \
37-
-print0 | xargs -0 clang-format $EXTRA_FLAGS --style=file --verbose -i
40+
-print0 | xargs -0 clang-format $EXTRA_FLAGS --style=file --verbose -i

0 commit comments

Comments
 (0)