-
Notifications
You must be signed in to change notification settings - Fork 16
499 lines (439 loc) · 18.8 KB
/
Copy pathci.yml
File metadata and controls
499 lines (439 loc) · 18.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
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
name: CI
on:
push:
branches: [main]
tags: ["v*"]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: denoland/setup-deno@v2
with:
deno-version: v2.x
- name: Install dependencies (Linux)
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libx11-dev libxcb1-dev libxkbcommon-dev libwayland-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev
pipx install "clang-format==22.1.5"
- name: cargo fmt
run: cargo fmt --check
- name: cargo clippy
run: cargo clippy --workspace -- -D warnings
- name: clang-format
run: |
find capi cef/src webview/src -name '*.cc' -o -name '*.cpp' -o -name '*.c' -o -name '*.h' -o -name '*.mm' | \
xargs clang-format --dry-run --Werror
- name: deno fmt
run: deno fmt --check
- name: deno lint
run: deno lint
test:
name: cargo test (capi)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
prefix-key: test
# Only the capi crate has unit-testable logic (pure conversions /
# builders). The example runtimes are cdylibs and the winit/webview
# backends require display servers, so we don't run their tests in CI.
- run: cargo test -p laufey --lib
- run: cargo test -p laufey --doc
build-winit:
name: winit / ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# 22.04 keeps the glibc/libstdc++ baseline low (glibc 2.35,
# GLIBCXX_3.4.30) so binaries run on Debian 12 / Ubuntu 22.04+.
- { target: x86_64-unknown-linux-gnu, os: ubuntu-22.04 }
- { target: aarch64-unknown-linux-gnu, os: ubuntu-22.04-arm }
- { target: x86_64-pc-windows-msvc, os: windows-latest }
- { target: aarch64-pc-windows-msvc, os: windows-11-arm }
- { target: x86_64-apple-darwin, os: macos-15-intel }
- { target: aarch64-apple-darwin, os: macos-14 }
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
prefix-key: winit
# rust-cache keys on runner.os+arch only ("Linux-x64"), not the
# image version, so a cache built on the old ubuntu-latest (24.04)
# restores as a full match onto ubuntu-22.04 and poisons the target
# dir (stale fingerprints, missing dep rlibs -> E0463). Pin per image.
key: ${{ matrix.os }}
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libx11-dev libxcb1-dev libxkbcommon-dev libwayland-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev
- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: brew install llvm
- name: Install dependencies (Windows)
if: runner.os == 'Windows'
run: choco install make -y
- run: make winit
- name: Package
shell: bash
run: |
mkdir staging
if [[ "${{ runner.os }}" == "Windows" ]]; then
cp target/release/laufey_winit.exe staging/
cd staging && 7z a ../laufey-winit-${{ matrix.target }}.zip *
else
cp target/release/laufey_winit staging/
tar czf laufey-winit-${{ matrix.target }}.tar.gz -C staging .
fi
- uses: actions/upload-artifact@v7
with:
name: laufey-winit-${{ matrix.target }}
path: |
laufey-winit-${{ matrix.target }}.tar.gz
laufey-winit-${{ matrix.target }}.zip
# End-to-end native-chrome / windowing tests. See docs/e2e-testing.md.
# Drives the *same* backend-agnostic native_e2e_runtime under each backend:
# Layer 0 (all): in-process readback + event-callback + clipboard + menu/
# tray click round-trips (via the test_click_menu_item hook).
# Layer 1 (Linux, cef): D-Bus StatusNotifier/dbusmenu observer.
#
# macOS exercises all three backends (both native-chrome codebases) end to
# end. Non-macOS legs are included only where they pass reliably; the rest are
# known backend limitations under headless CI, tracked as follow-ups:
# - winit / linux : the winit backend doesn't support Linux menus and panics
# building a muda menu with no GTK init.
# - webview / linux: WebKitGTK/Xlib isn't thread-safe under the worker-thread
# runtime (xcb_xlib_threads_sequence_lost).
# - cef|webview / windows: CEF's Windows dist extraction and the WebView2
# run are flaky in this job; need hands-on debugging.
native-e2e:
name: native-e2e / ${{ matrix.backend }} / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- { os: macos-14, backend: winit }
- { os: macos-14, backend: webview }
- { os: macos-14, backend: cef }
- { os: windows-latest, backend: winit }
- { os: windows-latest, backend: webview }
- { os: ubuntu-22.04, backend: cef }
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
prefix-key: native-e2e
key: ${{ matrix.os }}-${{ matrix.backend }}
# CEF fetches a large prebuilt binary distribution; cache it.
- name: Cache CEF
if: matrix.backend == 'cef'
uses: actions/cache@v6
with:
path: vendor/cef
key: cef-${{ matrix.os }}-${{ runner.arch }}-${{ hashFiles('Makefile') }}
# Per-backend deps mirror the proven build-{winit,webview,cef} jobs, plus
# the runtime libs the *run* step needs (xvfb, dbus, libxkbcommon-x11 for
# winit). Note: the backend-common (cef/webview) tray needs no
# appindicator dev package — installing one makes cmake define
# LAUFEY_HAVE_APPINDICATOR while tray_linux.cc includes the non-ayatana
# header, breaking the build; without it the tray compiles as a stub (N/A).
- name: Install dependencies (Linux, winit)
if: runner.os == 'Linux' && matrix.backend == 'winit'
run: |
sudo apt-get update
sudo apt-get install -y make pkg-config xvfb dbus-x11 xclip \
libx11-dev libxcb1-dev libxkbcommon-dev libxkbcommon-x11-0 \
libwayland-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev
- name: Install dependencies (Linux, webview)
if: runner.os == 'Linux' && matrix.backend == 'webview'
run: |
sudo apt-get update
sudo apt-get install -y make cmake ninja-build pkg-config xvfb dbus-x11 \
libwebkit2gtk-4.1-dev libgtk-3-dev
- name: Install dependencies (Linux, cef)
if: runner.os == 'Linux' && matrix.backend == 'cef'
run: |
sudo apt-get update
sudo apt-get install -y make cmake ninja-build pkg-config xvfb dbus-x11 \
libx11-dev libxi-dev libglib2.0-dev libnss3-dev libnspr4-dev \
libatk1.0-dev libatk-bridge2.0-dev libcups2-dev libdrm-dev libgtk-3-dev \
libgbm-dev libasound2-dev libpango1.0-dev libcairo2-dev libxcomposite-dev \
libxdamage-dev libxrandr-dev libxkbcommon-dev libdbus-1-dev libxext-dev \
libxfixes-dev
- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: brew install llvm ninja
- name: Install dependencies (Windows)
if: runner.os == 'Windows'
shell: bash
run: |
choco install make ninja -y
if [ "${{ matrix.backend }}" = "webview" ]; then
nuget install Microsoft.Web.WebView2 -OutputDirectory packages
fi
# Build the Rust runtime/driver BEFORE msvc-dev-cmd: cargo's own toolchain
# detection invokes MSVC link.exe by full path, but once msvc-dev-cmd has
# run, Git bash's /usr/bin/link shadows it and the build fails.
- name: Build runtime + driver
shell: bash
run: |
cargo build --release -p native_e2e_runtime
if [ "${{ runner.os }}" = "Linux" ]; then
cargo build --release -p native_e2e_driver
fi
- uses: ilammy/msvc-dev-cmd@v1
if: runner.os == 'Windows' && matrix.backend != 'winit'
- name: Build backend
shell: bash
run: |
if [ "${{ runner.os }}" = "Windows" ] && [ "${{ matrix.backend }}" = "webview" ]; then
WEBVIEW2_ROOT="$(pwd)/$(ls -d packages/Microsoft.Web.WebView2.* | head -1)" make webview
else
make ${{ matrix.backend }}
fi
- name: Layer 0 — readback / events / clipboard / menu+tray clicks
shell: bash
run: scripts/native-e2e-run.sh ${{ matrix.backend }}
# Layer 1 (Linux D-Bus StatusNotifier/dbusmenu observer) is built above
# (compile-checked on real Linux) but not run here: the only tray impl
# that registers an SNI is the winit backend's tray-icon crate, and
# winit/linux is excluded above pending its GTK-menu fix. Re-enable the
# driver run once a tray-capable Linux leg is in the matrix.
build-webview:
name: webview / ${{ matrix.target }}
runs-on: ${{ matrix.os }}
# Keep the macOS minimum in sync with LSMinimumSystemVersion in
# webview/macos/Info.plist.in (denoland/deno#35764). Ignored on non-macOS
# runners. The webview CMakeLists also pins this; setting it here guards
# against SDK-default minos stamping regardless of build path.
env:
MACOSX_DEPLOYMENT_TARGET: "10.15"
strategy:
fail-fast: false
matrix:
include:
# 22.04 keeps the glibc/libstdc++ baseline low (glibc 2.35,
# GLIBCXX_3.4.30) so binaries run on Debian 12 / Ubuntu 22.04+.
- { target: x86_64-unknown-linux-gnu, os: ubuntu-22.04 }
- { target: aarch64-unknown-linux-gnu, os: ubuntu-22.04-arm }
- { target: x86_64-pc-windows-msvc, os: windows-latest }
- { target: aarch64-pc-windows-msvc, os: windows-11-arm }
- { target: x86_64-apple-darwin, os: macos-15-intel }
- { target: aarch64-apple-darwin, os: macos-14 }
steps:
- uses: actions/checkout@v7
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y cmake ninja-build pkg-config libwebkit2gtk-4.1-dev libgtk-3-dev
- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: brew install llvm ninja
- name: Install dependencies (Windows)
if: runner.os == 'Windows'
shell: bash
run: |
choco install make ninja -y
nuget install Microsoft.Web.WebView2 -OutputDirectory packages
- uses: ilammy/msvc-dev-cmd@v1
if: runner.os == 'Windows'
with:
# Match the MSVC toolchain to the runner arch so cl.exe targets ARM64
# on windows-11-arm; CMake then links the arm64 WebView2 loader.
arch: ${{ runner.arch == 'ARM64' && 'arm64' || 'x64' }}
- name: Build
shell: bash
run: |
if [[ "${{ runner.os }}" == "Windows" ]]; then
WEBVIEW2_ROOT="$(pwd)/$(ls -d packages/Microsoft.Web.WebView2.* | head -1)" make webview
else
make webview
fi
- name: Package
shell: bash
run: |
if [[ "${{ runner.os }}" == "macOS" ]]; then
tar czf laufey-webview-${{ matrix.target }}.tar.gz -C webview/build laufey_webview.app
elif [[ "${{ runner.os }}" == "Windows" ]]; then
cd webview/build && 7z a ../../laufey-webview-${{ matrix.target }}.zip laufey_webview.exe
else
tar czf laufey-webview-${{ matrix.target }}.tar.gz -C webview/build laufey_webview
fi
- uses: actions/upload-artifact@v7
with:
name: laufey-webview-${{ matrix.target }}
path: |
laufey-webview-${{ matrix.target }}.tar.gz
laufey-webview-${{ matrix.target }}.zip
e2e-cef-linux:
name: e2e / cef / x86_64-unknown-linux-gnu (Xvfb)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
prefix-key: e2e-cef-linux
- name: Install runtime + build deps
run: |
sudo apt-get update
sudo apt-get install -y cmake ninja-build pkg-config \
xvfb xdotool dbus-x11 \
libx11-dev libxi-dev libglib2.0-dev libnss3-dev libnspr4-dev \
libatk1.0-dev libatk-bridge2.0-dev libcups2-dev libdrm-dev \
libgtk-3-dev libgbm-dev libasound2-dev libpango1.0-dev \
libcairo2-dev libxcomposite-dev libxdamage-dev libxrandr-dev \
libxkbcommon-dev libdbus-1-dev libxext-dev libxfixes-dev
- name: Cache CEF vendor
uses: actions/cache@v6
with:
path: vendor/cef
key: cef-ubuntu-latest-${{ runner.arch }}-${{ hashFiles('Makefile') }}
- name: Build CEF backend
run: make cef
- name: Build e2e harness
run: cargo build --release -p cef_e2e_runtime
- name: Launch under Xvfb and assert
# The harness exits 0 on PASS, 1 on FAIL. `xvfb-run` provides
# the headless display; `dbus-launch` gives CEF the session
# bus it expects (Chromium probes it during startup and stalls
# for several seconds if absent).
#
# 90-second outer timeout to fail loud rather than letting CI
# block for the full 6-hour ceiling if a binding pipeline
# regression makes the harness hang forever.
run: |
export LAUFEY_BIN="$PWD/cef/build/Release/laufey"
if [ ! -x "$LAUFEY_BIN" ]; then
echo "::error::CEF backend binary not at $LAUFEY_BIN — build step changed layout?"
ls cef/build/Release || true
exit 1
fi
log_file="$RUNNER_TEMP/laufey-cef-e2e.log"
LAUFEY_CEF_LOG_SEVERITY=error timeout 90 \
xvfb-run --auto-servernum --server-args="-screen 0 1280x800x24" \
dbus-launch --exit-with-session \
"$LAUFEY_BIN" --runtime "$PWD/target/release/libcef_e2e_runtime.so" \
2>&1 | tee "$log_file"
if grep -Eq 'google_apis/gcm/engine/registration_request|DEPRECATED_ENDPOINT' "$log_file"; then
echo "::error::CEF attempted legacy GCM registration"
exit 1
fi
build-cef:
name: cef / ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# 22.04 keeps the glibc/libstdc++ baseline low (glibc 2.35,
# GLIBCXX_3.4.30) so binaries run on Debian 12 / Ubuntu 22.04+.
- { target: x86_64-unknown-linux-gnu, os: ubuntu-22.04 }
- { target: aarch64-unknown-linux-gnu, os: ubuntu-22.04-arm }
- { target: x86_64-apple-darwin, os: macos-15-intel }
- { target: aarch64-apple-darwin, os: macos-14 }
- { target: x86_64-pc-windows-msvc, os: windows-latest }
# aarch64-pc-windows-msvc (windows-11-arm) is intentionally omitted:
# CEF-on-Windows-ARM64 needs the windowsarm64 dist + arch-matched MSVC
# setup and is tracked as a separate follow-up (issue #42).
steps:
- uses: actions/checkout@v7
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y cmake ninja-build pkg-config \
libx11-dev libxi-dev libglib2.0-dev libnss3-dev libnspr4-dev \
libatk1.0-dev libatk-bridge2.0-dev libcups2-dev libdrm-dev \
libgtk-3-dev libgbm-dev libasound2-dev libpango1.0-dev \
libcairo2-dev libxcomposite-dev libxdamage-dev libxrandr-dev \
libxkbcommon-dev libdbus-1-dev libxext-dev libxfixes-dev
- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: brew install llvm ninja
- name: Install dependencies (Windows)
if: runner.os == 'Windows'
run: choco install make ninja -y
- uses: ilammy/msvc-dev-cmd@v1
if: runner.os == 'Windows'
- name: Cache CEF
uses: actions/cache@v6
with:
path: vendor/cef
key: cef-${{ matrix.os }}-${{ runner.arch }}-${{ hashFiles('Makefile') }}
- run: make cef
- name: Package
shell: bash
run: |
if [[ "${{ runner.os }}" == "macOS" ]]; then
tar czf laufey-cef-${{ matrix.target }}.tar.gz -C cef/build/Release laufey.app
elif [[ "${{ runner.os }}" == "Windows" ]]; then
cd cef/build/Release && 7z a ../../../laufey-cef-${{ matrix.target }}.zip *
else
strip --strip-unneeded cef/build/Release/libcef.so
tar czf laufey-cef-${{ matrix.target }}.tar.gz -C cef/build/Release .
fi
- uses: actions/upload-artifact@v7
with:
name: laufey-cef-${{ matrix.target }}
path: |
laufey-cef-${{ matrix.target }}.tar.gz
laufey-cef-${{ matrix.target }}.zip
release:
if: startsWith(github.ref, 'refs/tags/v')
needs: [build-winit, build-webview, build-cef]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v7
- name: Verify tag matches capi crate version
run: |
tag="${GITHUB_REF#refs/tags/v}"
crate=$(awk -F'"' '/^version = / {print $2; exit}' capi/Cargo.toml)
if [ "$tag" != "$crate" ]; then
echo "::error::Tag v$tag does not match capi crate version $crate"
exit 1
fi
- uses: actions/download-artifact@v8
with:
path: artifacts
merge-multiple: true
- name: Generate SHA256SUMS
working-directory: artifacts
run: |
shopt -s nullglob
files=(*.tar.gz *.zip)
sha256sum "${files[@]}" > SHA256SUMS
cat SHA256SUMS
- uses: dtolnay/rust-toolchain@stable
- name: Publish laufey crate to crates.io
working-directory: capi
# Non-fatal: a missing/under-scoped CARGO_REGISTRY_TOKEN, or a version
# already on crates.io, must not block the GitHub release below.
continue-on-error: true
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish
- name: Create release
uses: softprops/action-gh-release@v3
with:
files: artifacts/*
generate_release_notes: true