-
-
Notifications
You must be signed in to change notification settings - Fork 10
358 lines (332 loc) · 12.9 KB
/
ci.yaml
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
on:
pull_request:
workflow_dispatch:
name: ci
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
permissions:
contents: read
jobs:
linux-ci:
name: linux-${{ matrix.name }}
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- name: gcc-14
os: ubuntu-24.04
compiler: gcc
version: 14
bazel: -c dbg --test_timeout=120 --run_under="valgrind --leak-check=full --errors-for-leak-kinds=all --error-exitcode=1 --track-origins=yes --show-leak-kinds=all --num-callers=32" --test_tag_filters=-no-valgrind
apt: valgrind
- name: clang-18-tsan
os: ubuntu-24.04
compiler: clang
version: 18
bazel: -c dbg --config tsan --test_env=TSAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer-18 --config libfuzzer
apt: libclang-rt-18-dev llvm-18
fuzz: true
- name: clang-18-asan-ubsan
os: ubuntu-24.04
compiler: clang
version: 18
bazel: -c dbg --config asan --config ubsan --test_env=ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer-18 --config libfuzzer
apt: libclang-rt-18-dev llvm-18
fuzz: true
- name: clang-17-libc++
os: ubuntu-24.04
compiler: clang
version: 17
bazel: --config libc++
apt: libc++abi-17-dev libc++-17-dev libclang-rt-17-dev
- name: clang-18-libc++
os: ubuntu-24.04
compiler: clang
version: 18
bazel: --config libc++
apt: libc++abi-18-dev libc++-18-dev libclang-rt-18-dev
steps:
- name: Setup gcc
if: startsWith(matrix.compiler, 'gcc')
run: |
echo "CC=gcc-${{ matrix.version }}" >> $GITHUB_ENV
echo "CXX=g++-${{ matrix.version }}" >> $GITHUB_ENV
- name: Setup clang
if: startsWith(matrix.compiler, 'clang')
run: |
echo "CC=clang-${{ matrix.version }}" >> $GITHUB_ENV
echo "CXX=clang++-${{ matrix.version }}" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Install
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends ${{ matrix.compiler }}-${{ matrix.version }} ${{ matrix.apt }} libx11-dev libxi-dev
- uses: actions/cache@v4
with:
path: ~/.cache/bazel
key: ${{ matrix.name }}-${{ hashFiles('.bazelversion', 'WORKSPACE', 'third_party/**') }}
- name: Test
run: bazel test //... ${{ matrix.bazel }}
- name: Run
run: |
echo "<html><body><h1>Example</h1><p>This is an example page.</p></body></html>" >example.html
bazel run browser:tui file://$(pwd)/example.html ${{ matrix.bazel }}
- name: Fuzz test
if: ${{ matrix.fuzz }}
run: |
./bzl/run_fuzz_tests ... \
${{ matrix.bazel }} \
-- --timeout_secs=10
coverage:
name: linux-${{ matrix.compiler }}-${{ matrix.version }}-coverage
runs-on: ubuntu-24.04
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- compiler: gcc
version: 13
- compiler: clang
version: 18
bazel: --config=clang18-coverage
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/cache@v4
with:
path: ~/.cache/bazel
key: coverage-${{ matrix.compiler }}-${{ matrix.version }}-${{ hashFiles('.bazelversion', 'WORKSPACE', 'third_party/**') }}
- name: Setup (gcc)
if: startsWith(matrix.compiler, 'gcc')
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends lcov gcc-${{ matrix.version }} g++-${{ matrix.version }}
echo "CC=gcc-${{ matrix.version }}" >> $GITHUB_ENV
echo "CXX=g++-${{ matrix.version }}" >> $GITHUB_ENV
echo "GCOV=gcov-${{ matrix.version }}" >> $GITHUB_ENV
- name: Setup (clang)
if: startsWith(matrix.compiler, 'clang')
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends lcov clang-${{ matrix.version }} libclang-rt-${{ matrix.version }}-dev llvm-${{ matrix.version }}
echo "CC=clang-18" >> $GITHUB_ENV
echo "CXX=clang++-18" >> $GITHUB_ENV
- run: sudo apt-get install libx11-dev libxi-dev
- name: Coverage
run: bazel coverage ... ${{ matrix.bazel }}
- name: Summary
run: lcov --summary bazel-out/_coverage/_coverage_report.dat
- name: Upload
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# TODO(robinlinden): codecov-cli 0.7.x breaks PRs from forks w/
# "Error: Codecov token not found. Please provide Codecov token with -t flag."
# whereas in 0.6.0, it still correctly detects PRs where tokenless
# uploads are required:
# "info - 2024-06-21 21:24:10,269 -- The PR is happening in a forked
# repo. Using tokenless upload."
run: |
pipx install codecov-cli==0.6.0
codecovcli upload-process --fail-on-error --file bazel-out/_coverage/_coverage_report.dat
linux-aarch64-muslc:
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ~/.cache/bazel
key: aarch64_linux_muslc-${{ hashFiles('.bazelversion', 'WORKSPACE', 'third_party/**') }}
- run: sudo apt-get update && sudo apt-get install -y --no-install-recommends qemu-user-static binfmt-support
- run: sudo update-binfmts --enable qemu-aarch64
- run: echo "build --config=linux-aarch64-musl" >.bazelrc.local
- run: bazel test ...
- name: Run tui
run: |
echo "<html><body><h1>Example</h1><p>This is an example page.</p></body></html>" >example.html
bazel run browser:tui file://$(pwd)/example.html
# https://github.com/bytecodealliance/wasmtime
wasi-wasm:
runs-on: ubuntu-24.04
timeout-minutes: 30
env:
WASMTIME_VERSION: v24.0.0
WASMTIME_NAME: wasmtime-v24.0.0-x86_64-linux
steps:
- uses: actions/checkout@v4
- name: Set up wasmtime
run: |
wget --no-verbose --output-document=wasmtime.tar.xz https://github.com/bytecodealliance/wasmtime/releases/download/${WASMTIME_VERSION}/${WASMTIME_NAME}.tar.xz
tar -xf wasmtime.tar.xz
chmod +x ${WASMTIME_NAME}/wasmtime
mkdir -p $HOME/.cache/wasmtime
# Register wasmtime as the wasm binary format handler.
- run: echo -n ":wasm32-wasi:M::\x00asm:\xff\xff\xff\xff:$(pwd)/${WASMTIME_NAME}/wasmtime:" | sudo tee /proc/sys/fs/binfmt_misc/register
- run: echo "build --config=wasi-wasm" >.bazelrc.local
- run: bazel test ...
macos:
strategy:
fail-fast: false
matrix:
include:
- os: macos-14
- os: macos-15
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- run: bazelisk test //...
- name: Run tui
run: |
echo "<html><body><h1>Example</h1><p>This is an example page.</p></body></html>" >example.html
bazelisk run browser:tui file://$(pwd)/example.html
- run: bazelisk run browser -- --exit-after-load file://$(pwd)/example.html
windows-msvc:
runs-on: windows-2022
timeout-minutes: 40
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ~/.cache/bazel
key: windows_msvc-${{ hashFiles('.bazelversion', 'WORKSPACE', 'third_party/**') }}
- run: echo "build --disk_cache ~/.cache/bazel" >.bazelrc.local
- name: Test
run: bazel test ... -c dbg
- name: Run tui
run: |
echo "<html><body><h1>Example</h1><p>This is an example page.</p></body></html>" >example.html
python3 -m http.server --bind localhost 12345 &
bazel run browser:tui -c dbg http://localhost:12345/example.html
- run: bazel run browser -c dbg -- --exit-after-load http://localhost:12345/example.html
windows-clang-cl:
runs-on: windows-2022
timeout-minutes: 45
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ~/.cache/bazel
key: windows_clang_cl-${{ hashFiles('.bazelversion', 'WORKSPACE', 'third_party/**') }}
- run: echo "build --config clang-cl" >.bazelrc.local
- run: echo "build --disk_cache ~/.cache/bazel" >>.bazelrc.local
- run: bazel test ...
- name: Run tui
run: |
echo "<html><body><h1>Example</h1><p>This is an example page.</p></body></html>" >example.html
python3 -m http.server --bind localhost 12345 &
bazel run browser:tui http://localhost:12345/example.html
- run: bazel run browser -- --exit-after-load http://localhost:12345/example.html
pre-commit:
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Install pre-commit
run: pipx install pre-commit==3.8.0
- name: Run pre-commit
run: pre-commit run --all-files
clang-format:
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- run: sudo apt-get update && sudo apt-get install --no-install-recommends clang-format-18
- name: Format
run: find . -name "*.h" -o -name "*.cpp" | xargs clang-format-18 -style=file -i
- name: Check
run: git diff --exit-code
clang-tidy:
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ~/.cache/bazel
key: clang_tidy-${{ hashFiles('.bazelversion', 'WORKSPACE', 'third_party/**') }}
- name: Set up the llvm repository
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-add-repository "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-19 main"
- run: sudo apt-get update && sudo apt-get install --no-install-recommends clang-tidy-19 libc++abi-19-dev libc++-19-dev
- run: echo "CC=clang-19" >>$GITHUB_ENV && echo "CXX=clang++-19" >>$GITHUB_ENV
- run: |
sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-19 100
sudo update-alternatives --set clang-tidy /usr/bin/clang-tidy-19
update-alternatives --query clang-tidy
clang-tidy --version
- run: bazel build ... --config libc++ --config clang-tidy --keep_going
buildifier:
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Install
run: |
wget --output-document=buildifier https://github.com/bazelbuild/buildtools/releases/download/v7.3.1/buildifier-linux-amd64
sudo chmod +x buildifier
- name: Check
run: ./buildifier --lint=warn --warnings=all -mode diff WORKSPACE $(find . -type f -iname "*.BUILD" -or -iname BUILD -or -iname "*.bzl")
prettier:
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- run: npm install --global [email protected]
# Prettier thinks our fragment shaders are JS-something and complains
# about syntax errors.
- run: npx prettier --ignore-path .gitignore --write . '!**/*.frag'
- run: git diff --exit-code
shfmt:
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- run: wget --output-document=shfmt https://github.com/mvdan/sh/releases/download/v3.9.0/shfmt_v3.9.0_linux_amd64 && chmod +x shfmt
- run: ./shfmt -i 2 -w $(./shfmt -f .)
- run: git diff --exit-code
link-liveness:
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- run: grep --recursive --no-filename --only-matching --exclude-dir="*corpus" --exclude=WORKSPACE --exclude=*test.cpp --exclude=ci.yaml 'https://[^)(}{",# ]*' | grep -v '^https://$' | sort | uniq | xargs wget --spider --no-verbose
gitlint:
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: pipx install gitlint-core==0.19.1
- run: gitlint --commits origin/master..
# https://github.com/astral-sh/ruff
ruff:
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- run: pipx install ruff==0.6.3
- run: ruff check --output-format=github
- run: ruff format --diff
# https://github.com/python/mypy
mypy:
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- run: pipx install mypy==1.9.0
- run: mypy --strict $(find . -name "*.py")
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true