-
-
Notifications
You must be signed in to change notification settings - Fork 10
300 lines (276 loc) · 10.7 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
on:
pull_request:
workflow_dispatch:
push:
branches: [master]
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-12
os: ubuntu-22.04
compiler: gcc
version: 12
bazel: --test_timeout=120 --run_under="valgrind --leak-check=full --errors-for-leak-kinds=all --error-exitcode=1 --track-origins=yes --show-leak-kinds=all"
apt: g++-12 valgrind
- name: gcc-13
os: ubuntu-22.04
compiler: gcc
version: 13
apt: g++-13
- name: clang-14-tsan
os: ubuntu-22.04
compiler: clang
version: 14
bazel: --config tsan
- name: clang-asan
os: ubuntu-22.04
compiler: clang
version: 14
bazel: --config asan
# https://github.com/llvm/llvm-project/issues/49689
- name: clang-ubsan
os: ubuntu-22.04
compiler: clang
version: 15
bazel: --config ubsan
- name: clang-17
os: ubuntu-22.04
compiler: clang
version: 17
- name: clang-15-libc++
os: ubuntu-22.04
compiler: clang
version: 15
bazel: --config libc++
apt: libc++abi-15-dev libc++-15-dev
- name: clang-17-libc++
os: ubuntu-22.04
compiler: clang
version: 17
bazel: --config libc++
apt: libc++abi-17-dev libc++-17-dev
steps:
- name: Prepare gcc install
if: startsWith(matrix.compiler, 'gcc') && matrix.version >= 13
run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test
- name: Prepare clang install
if: startsWith(matrix.compiler, 'clang') && matrix.version >= 15
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-add-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-${{ matrix.version }} main"
- 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 libgl-dev ${{ matrix.compiler }}-${{ matrix.version }} ${{ matrix.apt }}
- uses: actions/cache@v3
with:
path: ~/.cache/bazel
key: ${{ matrix.name }}-${{ hashFiles('.bazelversion', 'WORKSPACE', 'third_party/**') }}
restore-keys: ${{ matrix.name }}-
- name: Build
run: bazel build //... ${{ matrix.bazel }}
- 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 }}
linux-gcc-12-coverage:
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/cache@v3
with:
path: ~/.cache/bazel
key: coverage-${{ hashFiles('.bazelversion', 'WORKSPACE', 'third_party/**') }}
restore-keys: coverage-
- name: Install
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends libgl-dev lcov gcc-12 g++-12
- name: Setup
run: |
echo "CC=gcc-12" >> $GITHUB_ENV
echo "CXX=g++-12" >> $GITHUB_ENV
echo "GCOV=gcov-12" >> $GITHUB_ENV
- name: Coverage
run: bazel coverage ...
- name: Summary
run: lcov --summary bazel-out/_coverage/_coverage_report.dat
- name: Upload
run: |
wget --no-verbose --output-document=codecov https://github.com/codecov/uploader/releases/download/v0.7.0/codecov-linux
chmod +x codecov
./codecov -f bazel-out/_coverage/_coverage_report.dat
linux-gcc-13-no-exceptions:
runs-on: ubuntu-22.04
timeout-minutes: 30
container: gcc:13.1.0
steps:
- uses: actions/checkout@v4
- run: wget --no-verbose --output-document=bazelisk https://github.com/bazelbuild/bazelisk/releases/download/v1.18.0/bazelisk-linux-amd64 && chmod +x bazelisk
- run: ./bazelisk test etest/... --copt=-fno-exceptions
linux-aarch64-muslc:
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
with:
path: ~/.cache/bazel
key: aarch64_linux_muslc-${{ hashFiles('.bazelversion', 'WORKSPACE', 'third_party/**') }}
restore-keys: aarch64_linux_muslc-
- 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: wget --no-verbose --output-document=bazelisk https://github.com/bazelbuild/bazelisk/releases/download/v1.18.0/bazelisk-linux-amd64 && chmod +x bazelisk
- run: echo "build --config=linux-aarch64-musl" >.bazelrc.local
# TODO(robinlinden): Improve. We shouldn't be excluding targets like this.
# Include all targets except for
# * py_test targets: not fully statically linked
# * targets that depend on sfml: it pulls in host dependencies.
- run: ./bazelisk test -- $(bazel query '... except (kind("py_test", ...) union rdeps(..., @sfml//:window))')
- 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
windows-msvc:
runs-on: windows-2022
timeout-minutes: 30
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
with:
path: ~/.cache/bazel
key: windows_msvc-${{ hashFiles('WORKSPACE', 'third_party/**') }}
- run: echo "build --disk_cache ~/.cache/bazel" >.bazelrc.local
- name: Build
run: bazel build ... -c dbg
- name: Test
run: bazel test ... -c dbg
# TODO(robinlinden): This no longer runs in CI due to http://example.com
# being inaccessible.
# - name: Run
# run: bazel run browser:tui -c dbg
windows-clang-cl:
runs-on: windows-2022
timeout-minutes: 45
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
with:
path: ~/.cache/bazel
key: windows_clang_cl-${{ hashFiles('WORKSPACE', 'third_party/**') }}
- run: echo "build --config clang-cl" >.bazelrc.local
- run: echo "build --disk_cache ~/.cache/bazel" >>.bazelrc.local
- run: bazel test ...
# TODO(robinlinden): This no longer runs in CI due to http://example.com
# being inaccessible.
# - run: bazel run browser:tui
clang-format:
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- 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/jammy/ llvm-toolchain-jammy-15 main"
- run: sudo apt-get update && sudo apt-get install --no-install-recommends clang-format-15
- name: Format
run: find . -name "*.h" -o -name "*.cpp" | xargs clang-format-15 -style=file -i
- name: Check
run: git diff --exit-code
clang-tidy:
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- 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/jammy/ llvm-toolchain-jammy-16 main"
- run: sudo apt-get update && sudo apt-get install --no-install-recommends clang-tidy-16
- run: echo "CC=clang-16" >>$GITHUB_ENV && echo "CXX=clang++-16" >>$GITHUB_ENV
- run: |
sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-16 100
sudo update-alternatives --set clang-tidy /usr/bin/clang-tidy-16
update-alternatives --query clang-tidy
clang-tidy --version
- run: bazel build ... --config clang-tidy --keep_going
buildifier:
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Install
run: |
wget --output-document=buildifier https://github.com/bazelbuild/buildtools/releases/download/v6.3.3/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-22.04
timeout-minutes: 30
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-22.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- run: wget --output-document=shfmt https://github.com/mvdan/sh/releases/download/v3.7.0/shfmt_v3.7.0_linux_amd64 && chmod +x shfmt
- run: ./shfmt -i 2 -w $(./shfmt -f .)
- run: git diff --exit-code
link-liveness:
runs-on: ubuntu-22.04
timeout-minutes: 30
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
gitlint:
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: pip install gitlint==0.19.1
- run: gitlint --commits origin/master..
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true