Skip to content

Commit 9fc91d7

Browse files
authored
Update clang format and clang tidy (#269)
1 parent bed3b05 commit 9fc91d7

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

.github/workflows/clang-format.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,29 @@ jobs:
1515
runs-on: ubuntu-22.04
1616
steps:
1717
- name: Checkout PR branch
18-
uses: actions/checkout@v3
18+
uses: actions/checkout@v4
1919
with:
2020
ref: ${{ github.event.pull_request.head.sha }}
2121
fetch-depth: 0
22+
2223
- name: Setup Python
23-
uses: actions/setup-python@v4
24+
uses: actions/setup-python@v5
2425
with:
25-
python-version: 3.7
26+
python-version: 3.10
27+
2628
- name: Install clang-format
2729
run: |
2830
curl https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
29-
echo "deb https://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" | sudo tee -a /etc/apt/sources.list
31+
os_codename="`cat /etc/os-release | grep UBUNTU_CODENAME | cut -d = -f 2`"
32+
echo "deb https://apt.llvm.org/${os_codename}/ llvm-toolchain-${os_codename}-18 main" | sudo tee -a /etc/apt/sources.list
3033
sudo apt update
31-
sudo apt install -y clang-format-15
34+
sudo apt install -y clang-format-18
35+
3236
- name: Download git-clang-format
3337
run: |
3438
wget https://raw.githubusercontent.com/llvm/llvm-project/main/clang/tools/clang-format/git-clang-format
3539
chmod +x git-clang-format
40+
3641
- name: Run git-clang-format
3742
run: |
3843
PR_BASE=$(git rev-list ${{ github.event.pull_request.head.sha }} ^${{ github.event.pull_request.base.sha }} | tail --lines 1 | xargs -I {} git rev-parse {}~1)
@@ -41,10 +46,10 @@ jobs:
4146
-c color.ui=always \
4247
-c diff.wsErrorHighlight=all \
4348
-c color.diff.whitespace='red reverse' \
44-
clang-format-15 --diff --binary clang-format-15 --commit $PR_BASE -- include/ lib/ || \
49+
clang-format-18 --diff --binary clang-format-18 --commit $PR_BASE -- include/ lib/ || \
4550
(echo "Please run the following git-clang-format locally to fix the formatting: \n
4651
git-clang-format HEAD~\n
4752
for multiple commits we should place the formatting changes in the related commit with:\n
48-
\t\tgit rebase -i -x \"git-clang-format-15 main && git commit -a --allow-empty --fixup=HEAD\" --strategy-option=theirs origin/main\n
53+
\t\tgit rebase -i -x \"git-clang-format-18 main && git commit -a --allow-empty --fixup=HEAD\" --strategy-option=theirs origin/main\n
4954
\t\t Then inspect the results with: git log --oneline\n
5055
\t\t Then squash without poluting the history with: git rebase --autosquash -i main\n" && exit 1)

.github/workflows/clang-tidy-review-post.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
steps:
2222
- name: Post review comments
2323
id: post-review
24-
uses: ZedThree/clang-tidy-review/post@v0.13.2
24+
uses: ZedThree/clang-tidy-review/post@v0.18.0
2525
with:
2626
max_comments: 10
2727

.github/workflows/clang-tidy-review.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout PR branch
18-
uses: actions/checkout@v3
18+
uses: actions/checkout@v4
1919

2020
- name: Install LLVM and Clang
21-
uses: KyleMayes/install-llvm-action@v1
21+
uses: KyleMayes/install-llvm-action@v2
2222
with:
23-
version: "16.0.0"
23+
version: "18.1.3"
2424

2525
- name: Run clang-tidy
26-
uses: ZedThree/clang-tidy-review@v0.13.2
26+
uses: ZedThree/clang-tidy-review@v0.18.0
2727
id: review
2828
with:
2929
build_dir: build
@@ -40,4 +40,4 @@ jobs:
4040
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
4141
4242
- name: Upload artifacts
43-
uses: ZedThree/clang-tidy-review/upload@v0.13.1
43+
uses: ZedThree/clang-tidy-review/upload@v0.18.0

0 commit comments

Comments
 (0)