Repository navigation
451 lines (435 loc) · 17.8 KB
/
Copy pathci.yml
File metadata and controls
451 lines (435 loc) · 17.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
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
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
# ggui CI (product spec §8.2, §8.3).
#
# Linux: Xvfb + software Vulkan (lavapipe), clang source-based coverage built once, the suite split
# into shards that download those binaries, git 2.36 (pinned minimum) and the distribution's latest
# git. Windows: MinGW-static and MSVC. Release packages: Linux tar.gz/zip/deb, MinGW and
# MSVC ZIPs, each checked by the package smoke scripts. No test may fail, on Linux (both git
# versions) or on either Windows toolchain. The coverage report is published but does not gate;
# COVERAGE_EXCL markers may not grow past the allowlist. Every shard runs with the UI-thread
# assertion on (the default in test builds).
# A green build of master replaces the "latest" pre-release's packages (the release job).
name: ci
on:
push:
branches: ["**"] # not tags: the release job moves the "latest" tag
pull_request:
# A newer push cancels the older run, except on master: a cancel in the release job can leave no "latest" release.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
permissions:
contents: read
env:
CPM_SOURCE_CACHE: ${{ github.workspace }}/.cache/CPM
GGUI_FIXTURE_CACHE: ${{ github.workspace }}/.cache/ggui-fixtures
SHARDS: "6"
# Timing budgets (HIST-LOAD-FAST, the 33 ms frame limit, HOOK-FAST) x3 on shared runners (software
# rendering, coverage, slow process start); the release gate runs them unscaled
# (docs/release-checklist.md).
GGUI_TIMING_SLACK: "3"
# A missing git-gg fails the selfupdate tests instead of skipping them.
GGUI_REQUIRE_GITGG: "1"
jobs:
git-min:
# Builds and caches git 2.36.0, the minimum supported version (G2).
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- uses: actions/cache@v6
id: cache
with:
path: ~/git-2.36
key: git-2.36.0-ubuntu-24.04
- if: steps.cache.outputs.cache-hit != 'true'
run: |
sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev libexpat1-dev zlib1g-dev
curl -sSLO --fail --retry 3 --retry-all-errors https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.36.0.tar.xz
# The hash is from the kernel.org sha256sums.asc file of git.
echo "af5ebfc1658464f5d0d45a2bfd884c935fb607a10cc021d95bc80778861cc1d3 git-2.36.0.tar.xz" | sha256sum -c -
tar xf git-2.36.0.tar.xz && cd git-2.36.0
make -j"$(nproc)" prefix="$HOME/git-2.36" NO_GETTEXT=1 NO_TCLTK=1 all install
linux-build:
# One instrumented build; every shard runs these binaries.
runs-on: ubuntu-24.04
timeout-minutes: 25
steps:
- uses: actions/checkout@v7
- name: Dependencies
run: |
sudo apt-get update
sudo apt-get install -y git ninja-build clang llvm lld pkg-config \
libvulkan-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev \
libxi-dev libxss-dev libxfixes-dev libxtst-dev libwayland-dev libxkbcommon-dev \
libdbus-1-dev libgtk-3-dev libssl-dev libdecor-0-dev
- uses: actions/cache@v6
with:
path: .cache/CPM
key: cpm-${{ runner.os }}-${{ hashFiles('cmake/**') }}
- uses: actions/cache@v6 # fonts downloaded by cmake/Dependencies.cmake
with:
path: build/*/fonts
key: fonts-${{ runner.os }}-${{ hashFiles('cmake/**') }}
- name: Build (clang, coverage)
run: |
cmake --preset coverage
cmake --build --preset coverage
# A tarball keeps the executable bits that upload-artifact drops.
- run: tar -C build/coverage -cf linux-bin.tar bin
- uses: actions/upload-artifact@v7
with:
name: linux-bin
path: linux-bin.tar
retention-days: 3
linux:
needs: [linux-build, git-min]
runs-on: ubuntu-24.04
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
git: [minimum, latest]
shard: [0, 1, 2, 3, 4, 5]
steps:
- uses: actions/checkout@v7
- name: Dependencies (runtime only)
run: |
# The PPA and apt are flaky: retry the whole sequence up to 3 times.
for i in 1 2 3; do
sudo add-apt-repository -y ppa:git-core/ppa && sudo apt-get update && break
[ "$i" = 3 ] && exit 1
sleep 10
done
sudo apt-get -o Acquire::Retries=3 install -y git xvfb mesa-vulkan-drivers libvulkan1 libx11-6 libxext6 \
libxrandr2 libxcursor1 libxi6 libxss1 libxfixes3 libxkbcommon0 libdecor-0-0
# lavapipe's ICD is lvp_icd.x86_64.json on older Mesa, lvp_icd.json from Mesa 25.
echo "VK_DRIVER_FILES=$(ls /usr/share/vulkan/icd.d/lvp_icd*.json | head -n1)" >> "$GITHUB_ENV"
- uses: actions/cache@v6
with:
path: ~/git-2.36
key: git-2.36.0-ubuntu-24.04
- if: matrix.git == 'minimum'
run: echo "$HOME/git-2.36/bin" >> "$GITHUB_PATH"
- run: git --version
- uses: actions/cache@v6
with:
path: .cache/ggui-fixtures
key: fixtures-large-v1
- uses: actions/download-artifact@v8
with:
name: linux-bin
- run: mkdir -p build/coverage && tar -C build/coverage -xf linux-bin.tar && rm linux-bin.tar
- name: Tests (shard ${{ matrix.shard }}/6, Xvfb, lavapipe)
env:
LLVM_PROFILE_FILE: ${{ github.workspace }}/out/profiles/%p-%m.profraw
GGUI_TEST_ARTIFACTS: ${{ github.workspace }}/out/test-artifacts
run: |
mkdir -p out/profiles
xvfb-run -a -s "-screen 0 1920x1080x24" \
build/coverage/bin/ggui --test --shard=${{ matrix.shard }}/$SHARDS
- uses: actions/upload-artifact@v7
if: always()
with:
name: linux-${{ matrix.git }}-${{ matrix.shard }}
path: out/
- uses: actions/upload-artifact@v7
if: failure()
with:
name: failures-${{ matrix.git }}-${{ matrix.shard }}
path: out/test-artifacts/
release-tests:
# The release flags (Release, hardening, static libstdc++) with the test engine on: the
# full suite in 3 shards, to catch faults that only the optimized build shows.
runs-on: ubuntu-24.04
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
shard: [0, 1, 2]
steps:
- uses: actions/checkout@v7
- name: Dependencies
run: |
for i in 1 2 3; do
sudo add-apt-repository -y ppa:git-core/ppa && sudo apt-get update && break
[ "$i" = 3 ] && exit 1
sleep 10
done
sudo apt-get -o Acquire::Retries=3 install -y git ninja-build pkg-config xvfb \
mesa-vulkan-drivers libvulkan-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev \
libxi-dev libxss-dev libxfixes-dev libxtst-dev libwayland-dev libxkbcommon-dev \
libdbus-1-dev libgtk-3-dev libssl-dev libdecor-0-dev
echo "VK_DRIVER_FILES=$(ls /usr/share/vulkan/icd.d/lvp_icd*.json | head -n1)" >> "$GITHUB_ENV"
- uses: actions/cache@v6
with:
path: .cache/CPM
key: cpm-${{ runner.os }}-${{ hashFiles('cmake/**') }}
- uses: actions/cache@v6
with:
path: build/*/fonts
key: fonts-${{ runner.os }}-${{ hashFiles('cmake/**') }}
- uses: actions/cache@v6
with:
path: .cache/ggui-fixtures
key: fixtures-large-v1
- name: Build (release-tests)
run: |
cmake --preset release-tests
cmake --build --preset release-tests
- name: Tests (shard ${{ matrix.shard }}/3, Xvfb, lavapipe)
env:
GGUI_TEST_ARTIFACTS: ${{ github.workspace }}/out/test-artifacts
run: |
mkdir -p out
xvfb-run -a -s "-screen 0 1920x1080x24" \
build/release-tests/bin/ggui --test --shard=${{ matrix.shard }}/3
- uses: actions/upload-artifact@v7
if: failure()
with:
name: failures-release-tests-${{ matrix.shard }}
path: out/test-artifacts/
coverage:
needs: linux
if: always()
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v7
- run: sudo apt-get update && sudo apt-get install -y llvm
- uses: actions/download-artifact@v8
with:
path: shards
- name: Coverage report (informational; ggui + git-gg profiles merged; COVERAGE_EXCL allowlist)
run: |
tar -C shards -xf shards/linux-bin/linux-bin.tar
bin=shards/bin
llvm-profdata merge -sparse shards/linux-latest-*/profiles/*.profraw -o coverage.profdata
llvm-cov export -format=lcov -instr-profile=coverage.profdata "$bin/ggui" -object "$bin/git-gg" \
-ignore-filename-regex='(_deps|\.cache/CPM|generated|Source/tests)' > coverage.lcov
python3 scripts/coverage_report.py --lcov coverage.lcov --root "$PWD" \
--allowlist scripts/coverage_excl_allowlist.txt --out coverage.md
- uses: actions/upload-artifact@v7
if: always()
with:
name: reports
path: coverage.md
# Windows: each toolchain is built once; its binaries run the suite in shards (like Linux).
windows-build:
runs-on: windows-2022
timeout-minutes: 50
strategy:
fail-fast: false
matrix:
toolchain: [mingw, msvc]
steps:
- uses: actions/checkout@v7
- if: matrix.toolchain == 'mingw'
uses: msys2/setup-msys2@ec48f7c5447b3140e2b088413ae3a55687bccb6e # v2
with:
msystem: MINGW64
path-type: inherit
install: >-
patch mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja
- if: matrix.toolchain == 'msvc'
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1
- uses: actions/cache@v6
with:
path: .cache/CPM
key: cpm-${{ matrix.toolchain }}-${{ hashFiles('cmake/**') }}
- uses: actions/cache@v6 # fonts downloaded by cmake/Dependencies.cmake
with:
path: build/*/fonts
key: fonts-${{ matrix.toolchain }}-${{ hashFiles('cmake/**') }}
- name: Build (mingw-x64-static)
if: matrix.toolchain == 'mingw'
shell: msys2 {0}
env:
CPM_SOURCE_CACHE: ${{ github.workspace }}/.cache/CPM
run: |
cmake --preset mingw-x64-static -DCPM_SOURCE_CACHE="$CPM_SOURCE_CACHE"
cmake --build --preset mingw-x64-static
mv build/mingw-x64-static/bin windows-bin
- name: Build (msvc-x64)
if: matrix.toolchain == 'msvc'
shell: bash
run: |
cmake --preset msvc-x64 -DCPM_SOURCE_CACHE="${{ github.workspace }}/.cache/CPM"
cmake --build --preset msvc-x64
mv build/msvc-x64/bin windows-bin
- uses: actions/upload-artifact@v7
with:
name: windows-bin-${{ matrix.toolchain }}
path: windows-bin/
retention-days: 3
windows:
needs: windows-build
runs-on: windows-2022
timeout-minutes: 70
strategy:
fail-fast: false
matrix:
toolchain: [mingw, msvc]
shard: [0, 1, 2, 3, 4, 5]
defaults:
run:
shell: bash # Git for Windows' bash; git is Git for Windows, as users have it
steps:
- uses: actions/checkout@v7
- uses: actions/download-artifact@v8
with:
name: windows-bin-${{ matrix.toolchain }}
path: bin
- uses: actions/cache@v6
with:
path: .cache/ggui-fixtures
key: fixtures-large-v1-windows
- run: git --version
- name: Tests (shard ${{ matrix.shard }}/6, headless, D3D12/WARP)
# A hang fails the job instead of holding the runner for the 6 h default.
timeout-minutes: 65
env:
GGUI_HEADLESS: "1"
run: |
mkdir -p out
bin/ggui.exe --test --shard=${{ matrix.shard }}/$SHARDS
- uses: actions/upload-artifact@v7
if: always()
with:
name: windows-${{ matrix.toolchain }}-${{ matrix.shard }}
path: |
out/
test-artifacts/
# Release packages: release presets (no test engine), CPack, then the package
# smoke checks. Packages are uploaded as artifacts.
package-linux:
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
- name: Dependencies
run: |
sudo apt-get update
sudo apt-get install -y git ninja-build pkg-config dpkg-dev desktop-file-utils unzip \
mesa-vulkan-drivers libvulkan1 libx11-dev libxext-dev libxrandr-dev libxcursor-dev \
libxi-dev libxss-dev libxfixes-dev libxtst-dev libwayland-dev libxkbcommon-dev \
libdbus-1-dev libgtk-3-dev libssl-dev libdecor-0-dev
# lavapipe's ICD is lvp_icd.x86_64.json on older Mesa, lvp_icd.json from Mesa 25.
echo "VK_DRIVER_FILES=$(ls /usr/share/vulkan/icd.d/lvp_icd*.json | head -n1)" >> "$GITHUB_ENV"
- uses: actions/cache@v6
with:
path: .cache/CPM
key: cpm-${{ runner.os }}-${{ hashFiles('cmake/**') }}
- uses: actions/cache@v6 # fonts downloaded by cmake/Dependencies.cmake
with:
path: build/*/fonts
key: fonts-${{ runner.os }}-${{ hashFiles('cmake/**') }}
- name: Build, package and check (tar.gz, zip, deb; deb installed with apt in a clean container)
run: scripts/package_smoke.sh --container ubuntu:24.04
- uses: actions/upload-artifact@v7
with:
name: package-linux
path: |
build/packages/*.tar.gz
build/packages/*.zip
build/packages/*.deb
package-mingw:
runs-on: windows-2022
timeout-minutes: 30
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v7
- uses: msys2/setup-msys2@ec48f7c5447b3140e2b088413ae3a55687bccb6e # v2
with:
msystem: MINGW64
install: >-
git patch unzip mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja
- uses: actions/cache@v6
with:
path: .cache/CPM
key: cpm-mingw-${{ hashFiles('cmake/**') }}
- uses: actions/cache@v6 # fonts downloaded by cmake/Dependencies.cmake
with:
path: build/*/fonts
key: fonts-mingw-${{ hashFiles('cmake/**') }}
- name: Build and package (mingw-x64-static-release)
env:
CPM_SOURCE_CACHE: ${{ github.workspace }}/.cache/CPM
run: |
cmake --preset mingw-x64-static-release -DCPM_SOURCE_CACHE="$CPM_SOURCE_CACHE"
cmake --build --preset mingw-x64-static-release
cpack --preset package-mingw
- name: Check the package
run: scripts/package_smoke_windows.sh build/packages/ggui-*-windows-x64-mingw.zip
- uses: actions/upload-artifact@v7
with:
name: package-mingw
path: build/packages/*.zip
package-msvc:
runs-on: windows-2022
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
- uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1
- uses: actions/cache@v6
with:
path: .cache/CPM
key: cpm-msvc-${{ hashFiles('cmake/**') }}
- uses: actions/cache@v6 # fonts downloaded by cmake/Dependencies.cmake
with:
path: build/*/fonts
key: fonts-msvc-${{ hashFiles('cmake/**') }}
- name: Build and package (msvc-x64-release)
run: |
cmake --preset msvc-x64-release -DCPM_SOURCE_CACHE="${{ github.workspace }}/.cache/CPM"
cmake --build --preset msvc-x64-release
cpack --preset package-msvc
- name: Check the package (Git Bash)
shell: bash
run: scripts/package_smoke_windows.sh build/packages/ggui-*-windows-x64-msvc.zip
- uses: actions/upload-artifact@v7
with:
name: package-msvc
path: build/packages/*.zip
# The "latest" pre-release: on master, once every build, test, coverage and package job passed,
# its tag moves to this commit and its assets are replaced with this build's packages.
release:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
needs: [linux, release-tests, coverage, windows, package-linux, package-mingw, package-msvc]
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
contents: write
concurrency:
group: release-latest
cancel-in-progress: false
steps:
- uses: actions/checkout@v7
- uses: actions/download-artifact@v8
with:
pattern: package-*
path: dist
merge-multiple: true
- name: Update the "latest" release
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
ls -l dist
# An older run that ends last, or a rerun, would publish an older commit with a later
# published_at, and the updater would offer a downgrade. Publish only the master tip.
git fetch origin master
[ "$(git rev-parse FETCH_HEAD)" = "$GITHUB_SHA" ] || { echo "not the master tip, skip"; exit 0; }
git tag -f latest "$GITHUB_SHA"
git push -f origin refs/tags/latest
notes="Built by CI from master at ${GITHUB_SHA::7} (all tests passed). Replaced on every successful master build."
# The release is made anew: an edit of the target failed with 403 (the workflow token), and self-update
# reads target_commitish, so an upload into the old release would point the updater at the wrong commit.
# The create retries: between the delete and a create, clients report a failed update check.
gh release delete latest --yes || true
for i in 1 2 3; do
gh release create latest dist/* --prerelease --title "Latest build" --notes "$notes" --target "$GITHUB_SHA" && break
[ "$i" = 3 ] && exit 1
gh release delete latest --yes || true
sleep 15
done