-
Notifications
You must be signed in to change notification settings - Fork 4
75 lines (69 loc) · 2.4 KB
/
Copy pathclang-tidy.yml
File metadata and controls
75 lines (69 loc) · 2.4 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Clang Tidy
on:
schedule:
- cron: "0 1 * * *"
push:
branches: [main]
paths:
- ".github/workflows/clang-tidy.yml" # This file
- "**/*.cc"
- "**/*.h"
- "**/CMakeLists.txt"
- "CMakePresets.json"
- "cmake/**"
- "**/*.j2"
pull_request:
branches: [main]
paths:
- ".github/workflows/clang-tidy.yml" # This file
- "**/*.cc"
- "**/*.h"
- "**/CMakeLists.txt"
- "CMakePresets.json"
- "cmake/**"
- "**/*.j2"
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Debug
COMPILER_VERSION: 21
UV_FROZEN: 1
jobs:
clang-tidy:
# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows or Mac. You can convert this to a matrix build if you need
# cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: seanmiddleditch/gha-setup-ninja@master
- name: Install Clang
shell: bash
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh ${{ env.COMPILER_VERSION }} all
# We need to update symlink otherwise we end up with miss matched clang/clang++ and clang-tidy versions.
sudo rm /usr/bin/clang
sudo rm /usr/bin/clang++
sudo rm /usr/bin/clang-tidy
sudo ln -s /usr/bin/clang-${{ env.COMPILER_VERSION }} /usr/bin/clang
sudo ln -s /usr/bin/clang++-${{ env.COMPILER_VERSION }} /usr/bin/clang++
sudo ln -s /usr/bin/clang-tidy-${{ env.COMPILER_VERSION }} /usr/bin/clang-tidy
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: "3.12"
- name: Set up Python
run: uv sync
- uses: reviewdog/action-setup@v1.5.0
with:
reviewdog_version: latest # Optional. [latest,nightly,v.X.Y.Z]
- name: Run CMake
run: |
./scripts/cmake.sh --debug -DCLANG_TIDY_ENABLE=1 2>&1 | tee build.log
- name: Run reviewdog
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cat build.log | reviewdog -reporter=github-pr-review -efm="%W%f:%l:%c: warning: %m" -efm="%E%f:%l:%c: error: %m"