-
Notifications
You must be signed in to change notification settings - Fork 11
285 lines (281 loc) · 10.3 KB
/
clang-tidy.yml
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
name: OnDemand Clang Tidy
on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
tags:
description: 'Test scenario tags'
required: false
type: boolean
schedule:
- cron: '0 16 * * *'
env:
CACHE_EPOCH: 131-1
GOPROXY: direct
jobs:
win-clang-tidy:
runs-on: windows-2022
if: ${{ github.event_name != 'release' }}
strategy:
fail-fast: false
matrix:
arch: [x64, x86]
build_type: [Release]
crt-linkage: [dynamic]
env:
BUILD_TYPE: '${{ matrix.build_type }}'
defaults:
run:
shell: cmd
steps:
- uses: actions/checkout@v4
- name: Checkout with shallow submodules
run: |
# unshallow must come first otherwise submodule may be get unshallowed
git fetch --tags --unshallow
git submodule update --init --depth 1
- name: Cache toolchain, nasm, nsis and wixtoolset 3
id: toolchain-cache
uses: actions/cache@v4
with:
path: |
third_party/nasm
third_party/llvm-build/Release+Asserts
third_party/wix311
third_party/nsis
key: ${{ runner.os }}-toolchain-nsis-${{ hashFiles('CLANG_REVISION') }}-v${{ env.CACHE_EPOCH }}
- uses: actions/setup-go@v5
with:
go-version: '>=1.20.0'
cache-dependency-path: |
tools/go.sum
third_party/boringssl/src/go.sum
- name: Build build tool
run: |
cd tools
go build
- name: "Install dependency: clang, nasm, nsis and wixtoolset 3"
if: ${{ steps.toolchain-cache.outputs.cache-hit != 'true' }}
run: |
scripts\download-toolchain.bat
- name: "Install dependency: cmake (chocolatey)"
run: |
REM choco install -y cmake.portable --version=3.29.8
cmake --version
- name: "Install dependency: ninja (chocolatey)"
run: |
choco install -y ninja
ninja --version
- name: Build Binary
run: |
set VCToolsVersion=
set Winsdk=10.0.22621.0
set "WindowsSDKVersion=%Winsdk%\"
if "${{ matrix.arch }}" == "arm64" (call :SetNewVCToolsVersion)
set vsdevcmd=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat
set "VSCMD_START_DIR=%CD%"
set Platform=${{ matrix.arch }}
call "%vsdevcmd%" -arch=%Platform% -host_arch=amd64 -winsdk=%Winsdk% -no_logo -vcvars_ver=%VCToolsVersion%
tools\build -clang-tidy-mode -msvc-tgt-arch=${{ matrix.arch }} -msvc-crt-linkage=${{ matrix.crt-linkage }} -build-test -build-benchmark -no-packaging || exit /b
exit /b 0
:SetNewVCToolsVersion
set VCToolsVersion=
mingw64-clang-tidy:
runs-on: ubuntu-22.04
if: ${{ github.event_name != 'release' }}
strategy:
fail-fast: false
matrix:
build_type: [Release]
include:
- arch: i686
variant: msvcrt
- arch: x86_64
variant: ucrt
- arch: aarch64
variant: ucrt
env:
BUILD_TYPE: '${{ matrix.build_type }}'
steps:
- uses: actions/checkout@v4
- name: Checkout with shallow submodules
run: |
# unshallow must come first otherwise submodule may be get unshallowed
git fetch --tags --unshallow
git submodule update --init --depth 1
- name: Cache toolchain
id: toolchain-cache
uses: actions/cache@v4
with:
path: |
third_party/llvm-build/Release+Asserts
key: ${{ runner.os }}-toolchain-${{ hashFiles('CLANG_REVISION') }}-v${{ env.CACHE_EPOCH }}
- name: Cache mingw64 llvm sysroot
id: sysroot-cache
uses: actions/cache@v4
with:
path: |
third_party/llvm-mingw-20240619-${{ matrix.variant }}-ubuntu-20.04-x86_64
key: ${{ runner.os }}-mingw64-sysroot-third_party-llvm-20240619-${{ matrix.variant }}-v1
- uses: actions/setup-go@v5
with:
go-version: '>=1.20.0'
cache-dependency-path: |
tools/go.sum
third_party/boringssl/src/go.sum
- name: Build build tool
run: |
cd tools
go build
- name: "Install dependency: prebuilt clang and clang-tidy binaries"
if: ${{ steps.toolchain-cache.outputs.cache-hit != 'true' }}
run: |
./scripts/download-clang-prebuilt-binaries.py
rm -f third_party/llvm-build/Release+Asserts/*.tgz
- name: "Install dependency: llvm-mingw sysroot"
if: ${{ steps.sysroot-cache.outputs.cache-hit != 'true' }}
run: |
pushd third_party
curl -L -O https://github.com/mstorsjo/llvm-mingw/releases/download/20240619/llvm-mingw-20240619-${{ matrix.variant }}-ubuntu-20.04-x86_64.tar.xz
tar -xf llvm-mingw-20240619-${{ matrix.variant }}-ubuntu-20.04-x86_64.tar.xz
rm -vf llvm-mingw-*.xz
popd
- name: Change ubuntu mirror
run: |
sudo sed -i 's/azure.archive.ubuntu.com/azure.archive.ubuntu.com/g' /etc/apt/sources.list
sudo apt-get update -qq
- name: Populate depedencies
run: |
sudo apt-get update -qq
sudo apt-get install -y cmake ninja-build nasm zip nsis locales-all
- name: Populate dependencie (cmake, overwrite)
run: |
curl -L -O https://github.com/Kitware/CMake/releases/download/v3.29.8/cmake-3.29.8-linux-x86_64.tar.gz
sudo tar -C /usr/local --strip-components=1 -xf cmake-3.29.8-linux-x86_64.tar.gz
cmake --version
rm -f *.tar.gz
- name: Patch libcxx for windows xp
if: ${{ matrix.arch == 'i686' || matrix.arch == 'x86_64' }}
run: |
pushd third_party/libc++/trunk
patch -p1 < ../winxp.patch
popd
pushd third_party/libc++abi/trunk
patch -p1 < ../winxp.patch
popd
echo "BUILD_OPTIONS=-mingw-allow-xp -enable-lto=false" >> $GITHUB_ENV
- name: Build Binary
run: |
# fix cpack error on C.UTF-8 locale
# see https://github.com/lightspark/lightspark/discussions/604#discussioncomment-1034262
export LC_ALL=en_US.UTF-8
./tools/build --variant gui --arch ${{ matrix.arch }} --system mingw \
-build-test -build-benchmark -clang-tidy-mode \
-mingw-dir $PWD/third_party/llvm-mingw-20240619-${{ matrix.variant }}-ubuntu-20.04-x86_64 \
${{ env.BUILD_OPTIONS }}
linux-clang-tidy:
runs-on: ubuntu-20.04
if: ${{ github.event_name != 'release' }}
strategy:
fail-fast: false
matrix:
build_type: [Release]
env:
BUILD_TYPE: '${{ matrix.build_type }}'
steps:
- uses: actions/checkout@v4
- name: Checkout with shallow submodules
run: |
# unshallow must come first otherwise submodule may be get unshallowed
git fetch --tags --unshallow
git submodule update --init --depth 1
- name: Cache toolchain
id: toolchain-cache
uses: actions/cache@v4
with:
path: |
third_party/llvm-build/Release+Asserts
key: ${{ runner.os }}-toolchain-${{ hashFiles('CLANG_REVISION') }}-v${{ env.CACHE_EPOCH }}
- uses: actions/setup-go@v5
with:
go-version: '>=1.20.0'
cache-dependency-path: |
tools/go.sum
third_party/boringssl/src/go.sum
- name: Build build tool
run: |
cd tools
go build
- name: "Install dependency: prebuilt clang and clang-tidy binaries"
if: ${{ steps.toolchain-cache.outputs.cache-hit != 'true' }}
run: |
./scripts/download-clang-prebuilt-binaries.py
rm -f third_party/llvm-build/Release+Asserts/*.tgz
- name: Change ubuntu mirror
run: |
sudo sed -i 's/azure.archive.ubuntu.com/azure.archive.ubuntu.com/g' /etc/apt/sources.list
sudo apt-get update -qq
- name: Populate depedencies
run: sudo apt-get update -qq && sudo apt-get install -y cmake ninja-build libgtk-3-dev gettext
- name: Populate dependencie (cmake, overwrite)
run: |
curl -L -O https://github.com/Kitware/CMake/releases/download/v3.29.8/cmake-3.29.8-linux-x86_64.tar.gz
sudo tar -C /usr/local --strip-components=1 -xf cmake-3.29.8-linux-x86_64.tar.gz
cmake --version
rm -f *.tar.gz
- name: Populate depedencies (test purposes)
run: sudo apt-get update -qq && sudo apt-get install -y libcurl4-openssl-dev
- name: Build Binary
run: |
./tools/build -clang-tidy-mode -build-test -build-benchmark -no-packaging
mac-clang-tidy:
runs-on: macos-15
if: ${{ github.event_name != 'release' }}
strategy:
fail-fast: false
matrix:
build_type: [Release]
env:
BUILD_TYPE: '${{ matrix.build_type }}'
steps:
- uses: actions/checkout@v4
- name: Checkout with shallow submodules
run: |
# unshallow must come first otherwise submodule may be get unshallowed
git fetch --tags --unshallow
git submodule update --init --depth 1
- name: Cache toolchain
id: toolchain-cache
uses: actions/cache@v4
with:
path: |
third_party/llvm-build/Release+Asserts
key: ${{ runner.os }}-toolchain-arm64-${{ hashFiles('CLANG_REVISION') }}-v${{ env.CACHE_EPOCH }}
- uses: actions/setup-go@v5
with:
go-version: '>=1.20.0'
cache-dependency-path: |
tools/go.sum
third_party/boringssl/src/go.sum
- name: Build build tool
run: |
cd tools
go build
- name: "Install dependency: prebuilt clang and clang-tidy binaries"
if: ${{ steps.toolchain-cache.outputs.cache-hit != 'true' }}
run: |
./scripts/download-clang-prebuilt-binaries.py
rm -f third_party/llvm-build/Release+Asserts/*.tgz
- name: Populate depedencies
run: brew install ninja cmake p7zip
- name: Build Binary
run: |
./tools/build -clang-tidy-mode -build-test -build-benchmark -no-packaging