Repository navigation
371 lines (306 loc) · 12.2 KB
/
Copy pathlint.yml
File metadata and controls
371 lines (306 loc) · 12.2 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
# Eggs.Stacktrace
#
# Copyright (c) 2026 Agustin Berge
#
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt
name: lint
on:
push:
branches: [ main, feature/** ]
pull_request:
types: [opened, synchronize, reopened]
jobs:
orphan-sources-configure:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- name: Install CMake
uses: lukka/get-cmake@latest
with:
cmakeVersion: "4.4.0"
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: Enable CMake File API (codemodel-v2)
shell: bash
run: |
mkdir -p build/lint/.cmake/api/v1/query
touch build/lint/.cmake/api/v1/query/codemodel-v2
- name: Configure
run: cmake -S . -B build/lint
- name: Record referenced source files
run: python .github/scripts/lint/check_orphan_sources.py --dump-referenced referenced-${{ matrix.os }}.json build/lint
- uses: actions/upload-artifact@v6
with:
name: orphan-sources-referenced-${{ matrix.os }}
path: referenced-${{ matrix.os }}.json
if-no-files-found: error
orphan-sources:
needs: orphan-sources-configure
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/download-artifact@v7
with:
pattern: orphan-sources-referenced-*
path: referenced
merge-multiple: true
- name: Check every header/source file is referenced by a CMake target on some platform
run: python3 .github/scripts/lint/check_orphan_sources.py referenced/*.json
clang-tidy:
name: clang-tidy (clang-22)
runs-on: ubuntu-24.04
timeout-minutes: 10
env:
EGGS_STACKTRACE_SOURCE_DIR: ${{ github.workspace }}
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Install CMake
uses: lukka/get-cmake@latest
with:
cmakeVersion: "4.4.0"
- name: Set up APT package cache
run: |
mkdir -p ~/.cache/apt/archives/partial
echo "Dir::Cache::archives \"$HOME/.cache/apt/archives\";" \
| sudo tee /etc/apt/apt.conf.d/99user-cache
- name: Cache APT packages
continue-on-error: true
uses: actions/cache@v5
with:
path: ~/.cache/apt/archives
key: apt-ubuntu-24.04-clang-tidy-22-${{ hashFiles('.github/workflows/lint.yml') }}
restore-keys: apt-ubuntu-24.04-clang-tidy-22-
- name: Install Clang 22 + clang-tidy
run: |
wget -q https://apt.llvm.org/llvm.sh
sudo bash llvm.sh 22
sudo apt-get install -y clang-tidy-22
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-22 200
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-22 200
sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-22 200
- name: Fix APT cache permissions
if: always()
run: sudo rm -rf ~/.cache/apt/archives/lock ~/.cache/apt/archives/partial
- name: Configure
run: cmake --preset dev-clang -B build/clang-tidy
- name: Run clang-tidy
run: python3 .github/scripts/lint/clang-tidy-run.py
build/clang-tidy build/clang-tidy/clang-tidy.sarif
- name: Upload SARIF
uses: actions/upload-artifact@v6
with:
name: clang-tidy.sarif
path: build/clang-tidy/clang-tidy.sarif
retention-days: 7
- name: Determine diff base
id: diff-base
run: |
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
if git rev-parse --verify -q HEAD^ > /dev/null; then
echo "ref=HEAD^" >> "$GITHUB_OUTPUT"
fi
else
git fetch origin main
echo "ref=origin/main" >> "$GITHUB_OUTPUT"
fi
- name: Check warnings on changed lines
if: steps.diff-base.outputs.ref != ''
run: python3 .github/scripts/lint/warn-everything-check-changed.py
build/clang-tidy/clang-tidy.sarif ${{ steps.diff-base.outputs.ref }} clang-tidy
clang-tidy-win32:
name: clang-tidy win32 (clang-22)
runs-on: windows-2025-vs2026
timeout-minutes: 15
env:
EGGS_STACKTRACE_SOURCE_DIR: ${{ github.workspace }}
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Install CMake
uses: lukka/get-cmake@latest
with:
cmakeVersion: "4.4.0"
- name: Install LLVM 22
run: choco upgrade llvm --version=22.1.0 --allow-downgrade -y --no-progress
- name: Set up MSVC environment
shell: pwsh
run: |
$vsPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" `
-latest -property installationPath
$vcvars = "$vsPath\VC\Auxiliary\Build\vcvars64.bat"
cmd /c "`"$vcvars`" && set" | ForEach-Object {
if ($_ -match '^([^=]+)=(.*)$') {
"$($Matches[1])=$($Matches[2])" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
}
}
# Ahead of any clang-tidy bundled with Visual Studio.
"C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Configure
run: |
clang-tidy --version
cmake --preset dev-msvc -B build/clang-tidy
- name: Run clang-tidy
run: python .github/scripts/lint/clang-tidy-run.py
build/clang-tidy build/clang-tidy/clang-tidy.sarif
- name: Upload SARIF
uses: actions/upload-artifact@v6
with:
name: clang-tidy-win32.sarif
path: build/clang-tidy/clang-tidy.sarif
retention-days: 7
- name: Determine diff base
id: diff-base
shell: bash
run: |
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
if git rev-parse --verify -q HEAD^ > /dev/null; then
echo "ref=HEAD^" >> "$GITHUB_OUTPUT"
fi
else
git fetch origin main
echo "ref=origin/main" >> "$GITHUB_OUTPUT"
fi
- name: Check warnings on changed lines
if: steps.diff-base.outputs.ref != ''
run: python .github/scripts/lint/warn-everything-check-changed.py
build/clang-tidy/clang-tidy.sarif ${{ steps.diff-base.outputs.ref }} clang-tidy-win32
warn-everything:
name: -Weverything (clang-22)
runs-on: ubuntu-24.04
timeout-minutes: 6
env:
EGGS_STACKTRACE_SOURCE_DIR: ${{ github.workspace }}
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Install CMake
uses: lukka/get-cmake@latest
with:
cmakeVersion: "4.4.0"
- name: Set up APT package cache
run: |
mkdir -p ~/.cache/apt/archives/partial
echo "Dir::Cache::archives \"$HOME/.cache/apt/archives\";" \
| sudo tee /etc/apt/apt.conf.d/99user-cache
- name: Cache APT packages
continue-on-error: true
uses: actions/cache@v5
with:
path: ~/.cache/apt/archives
key: apt-ubuntu-24.04-clang-22-${{ hashFiles('.github/workflows/lint.yml') }}
restore-keys: apt-ubuntu-24.04-clang-22-
- name: Install Clang 22
run: |
wget -q https://apt.llvm.org/llvm.sh
sudo bash llvm.sh 22
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-22 200
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-22 200
- name: Install libstdc++-16
run: |
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install -y g++-16
- name: Fix APT cache permissions
if: always()
run: sudo rm -rf ~/.cache/apt/archives/lock ~/.cache/apt/archives/partial
- name: Configure
run: cmake --preset dev-clang -B build/warn-everything
-DCMAKE_COMPILE_WARNING_AS_ERROR=OFF
-DCMAKE_CXX_COMPILER_LAUNCHER="python3;${{ github.workspace }}/.github/scripts/lint/warn-everything-launcher.py"
-DCMAKE_CXX_FLAGS_INIT="--gcc-install-dir=/usr/lib/gcc/x86_64-linux-gnu/16
-Weverything
-Wno-c++98-compat -Wno-c++98-compat-pedantic
-Wno-c++11-compat
-Wno-c++14-compat
-Wno-pre-c++14-compat -Wno-pre-c++14-compat-pedantic
-Wno-c++17-compat -Wno-c++17-compat-mangling
-Wno-pre-c++17-compat -Wno-pre-c++17-compat-pedantic
-Wno-c++20-compat
-Wno-pre-c++20-compat -Wno-pre-c++20-compat-pedantic
-Wno-pre-c++23-compat -Wno-pre-c++23-compat-pedantic
-Wno-unsafe-buffer-usage"
- name: Build (Debug)
run: cmake --build build/warn-everything --config Debug -- -k 0
- name: Merge SARIF fragments
run: python3 .github/scripts/lint/warn-everything-merge-sarif.py
build/warn-everything build/warn-everything/warn-everything.sarif
- name: Upload SARIF
uses: actions/upload-artifact@v6
with:
name: warn-everything.sarif
path: build/warn-everything/warn-everything.sarif
retention-days: 7
- name: Determine diff base
id: diff-base
run: |
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
if git rev-parse --verify -q HEAD^ > /dev/null; then
echo "ref=HEAD^" >> "$GITHUB_OUTPUT"
fi
else
git fetch origin main
echo "ref=origin/main" >> "$GITHUB_OUTPUT"
fi
- name: Check warnings on changed lines
if: steps.diff-base.outputs.ref != ''
run: python3 .github/scripts/lint/warn-everything-check-changed.py
build/warn-everything/warn-everything.sarif ${{ steps.diff-base.outputs.ref }}
- name: Check warnings from headers
run: python3 .github/scripts/lint/warn-everything-check-headers.py
build/warn-everything/warn-everything.sarif
include-cleaner:
name: clang-include-cleaner (clang-22)
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v5
- name: Install CMake
uses: lukka/get-cmake@latest
with:
cmakeVersion: "4.4.0"
- name: Set up APT package cache
run: |
mkdir -p ~/.cache/apt/archives/partial
echo "Dir::Cache::archives \"$HOME/.cache/apt/archives\";" \
| sudo tee /etc/apt/apt.conf.d/99user-cache
- name: Cache APT packages
continue-on-error: true
uses: actions/cache@v5
with:
path: ~/.cache/apt/archives
key: apt-ubuntu-24.04-clang-tools-22-${{ hashFiles('.github/workflows/lint.yml') }}
restore-keys: apt-ubuntu-24.04-clang-tools-22-
- name: Install Clang 22
run: |
wget -q https://apt.llvm.org/llvm.sh
sudo bash llvm.sh 22
sudo apt-get install -y clang-tools-22
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-22 200
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-22 200
sudo update-alternatives --install /usr/bin/clang-include-cleaner \
clang-include-cleaner /usr/bin/clang-include-cleaner-22 200
- name: Install libstdc++-16
run: |
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install -y g++-16
- name: Fix APT cache permissions
if: always()
run: sudo rm -rf ~/.cache/apt/archives/lock ~/.cache/apt/archives/partial
- name: Configure
run: cmake --preset dev-clang -B build/include-cleaner
-DCMAKE_CXX_FLAGS_INIT=--gcc-install-dir=/usr/lib/gcc/x86_64-linux-gnu/16
- name: Check includes
run: python3 .github/scripts/lint/check_include_cleaner.py build/include-cleaner