-
Notifications
You must be signed in to change notification settings - Fork 424
138 lines (120 loc) · 4.8 KB
/
Copy pathclang-tidy.yml
File metadata and controls
138 lines (120 loc) · 4.8 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: Clang-tidy (tiles)
on:
# push:
# branches: [main]
# paths: [ "**.cpp", "**.h", "**.c", "**/CMakeLists.txt", "**.hpp", "**.cmake", "build-scripts/**","tools/clang-tidy-plugin/**", ".github/workflows/clang-tidy.yml", "**/.clang-tidy" ]
workflow_dispatch:
pull_request:
branches: [main]
paths:
[
"**.cpp",
"**.h",
"**.c",
"**/CMakeLists.txt",
"**.hpp",
"**.cmake",
"build-scripts/**",
"tools/clang-tidy-plugin/**",
".github/workflows/clang-tidy.yml",
"**/.clang-tidy",
]
# We only care about the latest revision of a PR, so cancel all previous instances.
concurrency:
group: clang-tidy-build-${{ github.event.pull_request.number || github.ref_name }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
env:
CMAKE: 1
LLVM_VERSION: "22"
CLANG: clang++
COMPILER: clang++
TILES: 1
SOUND: 1
BUILD_PATH: "build"
AFFECTED_FILES: "affected_files.txt"
steps:
- name: checkout repository
uses: actions/checkout@v4
with: { fetch-depth: 2 }
- name: install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
gettext mold jq \
sqlite3 libsqlite3-dev zlib1g-dev libvulkan-dev mesa-vulkan-drivers xvfb \
autoconf autoconf-archive automake libtool libltdl-dev
- name: Setup LLVM lint tools
uses: aminya/setup-cpp@v1
with:
compiler: llvm-${{ env.LLVM_VERSION }}
clang-format: ${{ env.LLVM_VERSION }}
clang-tidy: ${{ env.LLVM_VERSION }}
cmake: true
ninja: true
setup-cpp: false
- name: Show LLVM tool versions
run: |
clang++ --version
clang-format --version
clang-tidy --version
llvm-config --version
#- name: Install SDL3
# run: |
# sudo apt-get install --ignore-missing libsdl3-dev libsdl3-ttf-dev libsdl3-image-dev libsdl3-mixer-dev
- name: Install SDL3-devel dependencies
run: |
sudo apt-get install libasound2-dev libpulse-dev libaudio-dev libjack-dev libsndio-dev libx11-dev \
libxext-dev libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libxtst-dev libxkbcommon-dev \
libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev \
libibus-1.0-dev libudev-dev libpipewire-0.3-dev libwayland-dev libdecor-0-dev liburing-dev \
libfreetype-dev libharfbuzz-dev \
libtiff-dev libavif-dev libwebp-dev libjpeg-dev libjxl-dev \
libflac-dev libvorbis-dev libxmp-dev libmpg123-dev libwavpack-dev
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: clang-tidy-${{ github.ref_name }}
restore-keys: |
clang-tidy-${{ github.ref_name }}
clang-tidy-main
clang-tidy-
max-size: 500M
verbose: 2
save: ${{ github.event_name != 'pull_request' }}
- name: Install shadercross
run: bash build-scripts/install-shadercross-vcpkg.sh
- name: add problem matcher
run: |
# Enable GitHub actions problem matchers
# (See https://github.com/actions/toolkit/blob/master/docs/problem-matchers.md)
echo "::add-matcher::build-scripts/problem-matchers/catch2.json"
echo "::add-matcher::build-scripts/problem-matchers/debugmsg.json"
- uses: denoland/setup-deno@v2
with: { cache: true }
- name: build clang-tidy plugin
run: |
pip install --break-system-packages lit
bash ./build-scripts/build-clang-tidy-plugin.sh
# - name: test clang-tidy plugin
# run: |
# lit -v $BUILD_PATH/tools/clang-tidy-plugin/test
# clang-tidy --version
- name: gather affected files
run: |
ref=refs/remotes/pull/${{ github.event.pull_request.number }}/merge
git fetch --no-tags --filter=blob:none --depth=2 origin "+refs/pull/${{ github.event.pull_request.number }}/merge:$ref"
deno task affected-files --base "$ref^1" --head "$ref" --output "$AFFECTED_FILES"
- name: run clang-tidy
run: bash ./build-scripts/run-clang-tidy-plugin.sh
- name: show most time consuming checks
if: always()
run: | # the folder may not exist if there is no file to analyze
if [ -d clang-tidy-trace ]
then
jq -n 'reduce(inputs.profile | to_entries[]) as {$key,$value} ({}; .[$key] += $value) | with_entries(select(.key|contains(".wall"))) | to_entries | sort_by(.value) | reverse | .[0:10] | from_entries' clang-tidy-trace/*.json
else
echo "clang-tidy-trace folder not found."
fi