-
Notifications
You must be signed in to change notification settings - Fork 1.1k
58 lines (49 loc) · 1.6 KB
/
clang-tidy.yml
File metadata and controls
58 lines (49 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: clang-tidy-check
on:
pull_request:
types: [opened, synchronize]
branches:
- main
workflow_dispatch:
permissions:
contents: read
concurrency:
group: clang-tidy-${{ github.ref }}
cancel-in-progress: true
jobs:
tidy-check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang-tidy cmake libcurl4-openssl-dev libssl-dev
- name: Configure CMake
run: |
cmake -B build \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DBUILD_ONLY="s3" \
-DENABLE_TESTING=OFF
- name: Get changed files
id: changed
env:
BASE_BRANCH: "${{ github.event.pull_request.base.ref }}"
HEAD_BRANCH: "${{ github.event.pull_request.head.ref }}"
run: |
git fetch origin "$BASE_BRANCH"
git fetch origin "$HEAD_BRANCH"
git diff --name-only --diff-filter=d origin/$BASE_BRANCH...origin/$HEAD_BRANCH \
| grep -E '\.(cpp|cc|cxx|c|h|hh|hpp)$' \
| grep -v '^generated/' > changed_files.txt || true
echo "count=$(wc -l < changed_files.txt | tr -d ' ')" >> "$GITHUB_OUTPUT"
- name: Run clang-tidy
if: steps.changed.outputs.count != '0'
run: |
echo "Running clang-tidy on changed files:"
cat changed_files.txt
xargs -a changed_files.txt clang-tidy -p build --warnings-as-errors='performance-*'