Skip to content

Commit c09ba08

Browse files
authored
refactor(ci): extract scripts for GUI client smoke tests (firezone#3724)
(Waiting on firezone#3721) Ubuntu is headless by default and needs `xvfb` to run Tauri in CI, hence the difference. --------- Signed-off-by: Reactor Scram <[email protected]>
1 parent 4106419 commit c09ba08

File tree

3 files changed

+56
-4
lines changed

3 files changed

+56
-4
lines changed

.github/workflows/_rust.yml

+6-4
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,12 @@ jobs:
108108
run: pnpm tailwindcss -i src/input.css -o src/output.css
109109
- name: Build client
110110
run: cargo build -p firezone-gui-client
111-
- name: Run smoke test
112-
run: cargo run -p firezone-gui-client -- smoke-test
113-
- name: Test that the crash handler produces a crash dump
114-
run: bash scripts/crash-handling-smoke-test.bash
111+
- name: Run smoke tests (Linux)
112+
if: ${{ runner.os == 'Linux' }}
113+
run: bash ../../scripts/tests/smoke-test-gui-linux.sh
114+
- name: Run smoke tests (Windows)
115+
if: ${{ runner.os == 'Windows' }}
116+
run: bash ../../scripts/tests/smoke-test-gui-windows.sh
115117

116118
# This should be identical to `build-push-windows-release-artifacts` in `cd.yml` except for the Github permissions, needs tag, and uploading step
117119
build-gui:

scripts/tests/smoke-test-gui-linux.sh

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
BUNDLE_ID="dev.firezone.client"
6+
DUMP_PATH="$BUNDLE_ID/data/logs/last_crash.dmp"
7+
export FIREZONE_DISABLE_SYSTRAY=true
8+
PACKAGE=firezone-gui-client
9+
export RUST_LOG=firezone_gui_client=debug,warn
10+
export WEBKIT_DISABLE_COMPOSITING_MODE=1
11+
12+
# Run the smoke test normally
13+
xvfb-run --auto-servernum cargo run -p "$PACKAGE" -- smoke-test
14+
15+
# Delete the crash file if present
16+
rm -f "$DUMP_PATH"
17+
18+
# Fail if it returns success, this is supposed to crash
19+
xvfb-run --auto-servernum cargo run -p "$PACKAGE" -- --crash && exit 1
20+
21+
# Fail if the crash file wasn't written
22+
stat "$DUMP_PATH"
23+
rm "$DUMP_PATH"
24+
25+
# I'm not sure if the last command is handled specially, so explicitly exit with 0
26+
exit 0
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
# This script must run from an elevated shell so that Firezone won't try to elevate
3+
4+
set -euo pipefail
5+
6+
BUNDLE_ID="dev.firezone.client"
7+
DUMP_PATH="$LOCALAPPDATA/$BUNDLE_ID/data/logs/last_crash.dmp"
8+
PACKAGE=firezone-gui-client
9+
10+
# Run the smoke test normally
11+
cargo run -p "$PACKAGE" -- smoke-test
12+
13+
# Delete the crash file if present
14+
rm -f "$DUMP_PATH"
15+
16+
# Fail if it returns success, this is supposed to crash
17+
cargo run -p "$PACKAGE" -- --crash && exit 1
18+
19+
# Fail if the crash file wasn't written
20+
stat "$DUMP_PATH"
21+
rm "$DUMP_PATH"
22+
23+
# I'm not sure if the last command is handled specially, so explicitly exit with 0
24+
exit 0

0 commit comments

Comments
 (0)