Skip to content

Commit 213eef1

Browse files
committed
[ci] Add clang-tidy support
Fixes #26.
1 parent d7e4f32 commit 213eef1

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Post clang-tidy review comments
2+
3+
on:
4+
workflow_run:
5+
workflows: ["clang-tidy-review"]
6+
types:
7+
- completed
8+
9+
permissions:
10+
checks: write
11+
pull-requests: write
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Post review comments
23+
id: post-review
24+
uses: ZedThree/clang-tidy-review/[email protected]
25+
with:
26+
max_comments: 10
27+
28+
# If there are any comments, fail the check
29+
- if: steps.post-review.outputs.total_comments > 0
30+
run: exit 1
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: clang-tidy-review
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '**.h'
7+
- '**.hpp'
8+
- '**.cpp'
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
review:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout PR branch
19+
uses: actions/checkout@v3
20+
21+
- name: Install LLVM and Clang
22+
uses: KyleMayes/install-llvm-action@v1
23+
with:
24+
version: "12.0.0"
25+
26+
- name: Run clang-tidy
27+
uses: ZedThree/[email protected]
28+
id: review
29+
with:
30+
build_dir: build
31+
apt_packages: libxml2,libxml2-dev,libtinfo-dev,zlib1g-dev,libzstd-dev
32+
exclude: "test/*,unittests/*,benchmark/*,demos/*"
33+
split_workflow: true
34+
cmake_command: >
35+
pip install cmake lit &&
36+
cmake --version &&
37+
git config --global --add safe.directory /github/workspace &&
38+
cmake . -B build -DLLVM_DIR="$GITHUB_WORKSPACE/llvm"
39+
-DClang_DIR="$GITHUB_WORKSPACE/llvm"
40+
-DCMAKE_BUILD_TYPE="Release"
41+
-DLLVM_EXTERNAL_LIT="`which lit`"
42+
-DCMAKE_EXPORT_COMPILE_COMMANDS=On
43+
44+
- name: Upload artifacts
45+
uses: ZedThree/clang-tidy-review/[email protected]

0 commit comments

Comments
 (0)