Skip to content

Commit 00f68fb

Browse files
committed
workflow: Add clang-tidy reviews for all pull requests
1 parent 7b7294b commit 00f68fb

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

.clang-tidy

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
Checks: 'clang-diagnostic-*,clang-analyzer-*,performance-*,portability-*,modernize-use-nullptr'
3+
WarningsAsErrors: ''
4+
HeaderFilterRegex: ''
5+
FormatStyle: none
6+
...

.github/workflows/lint.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Lint
2+
on: [pull_request]
3+
4+
jobs:
5+
clang-tidy:
6+
runs-on: ubuntu-20.04
7+
steps:
8+
- uses: actions/checkout@v3
9+
- name: Install clang-tidy
10+
run: |
11+
sudo apt-get update
12+
sudo apt-get install -y clang-tidy build-essential pkg-config libpng-dev libjpeg-dev libtiff-dev zlib1g-dev libssl-dev libx11-dev libgl1-mesa-dev libxrandr-dev libxxf86dga-dev libxcursor-dev libfreetype6-dev libvorbis-dev libeigen3-dev libopenal-dev libode-dev libbullet-dev libgtk-3-dev libassimp-dev libopenexr-dev
13+
- name: Prepare compile_commands.json
14+
run: |
15+
cmake -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_UNITY_BUILD=OFF -DHAVE_PYTHON=OFF -DINTERROGATE_PYTHON_INTERFACE=OFF
16+
- name: Copy prebuilt files
17+
run: |
18+
for fn in **/*.prebuilt; do
19+
echo mkdir -p $(dirname "cmake/$fn");
20+
echo cp "$fn" "cmake/${fn%.*}";
21+
done
22+
- name: Create results directory
23+
run: |
24+
mkdir clang-tidy-result
25+
- name: Analyze
26+
run: |
27+
git diff -U0 HEAD^ | clang-tidy-diff -p1 -path build -export-fixes clang-tidy-result/fixes.yml
28+
- name: Post review
29+
uses: platisd/clang-tidy-pr-comments@master
30+
with:
31+
github_token: ${{ github.token }}
32+
clang_tidy_fixes: clang-tidy-result/fixes.yml
33+
request_changes: true
34+
suggestions_per_comment: 10

0 commit comments

Comments
 (0)