mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 10:18:54 +00:00
refactor(ci): extract scripts for GUI client smoke tests (#3724)
(Waiting on #3721) Ubuntu is headless by default and needs `xvfb` to run Tauri in CI, hence the difference. --------- Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
This commit is contained in:
10
.github/workflows/_rust.yml
vendored
10
.github/workflows/_rust.yml
vendored
@@ -108,10 +108,12 @@ jobs:
|
||||
run: pnpm tailwindcss -i src/input.css -o src/output.css
|
||||
- name: Build client
|
||||
run: cargo build -p firezone-gui-client
|
||||
- name: Run smoke test
|
||||
run: cargo run -p firezone-gui-client -- smoke-test
|
||||
- name: Test that the crash handler produces a crash dump
|
||||
run: bash scripts/crash-handling-smoke-test.bash
|
||||
- name: Run smoke tests (Linux)
|
||||
if: ${{ runner.os == 'Linux' }}
|
||||
run: bash ../../scripts/tests/smoke-test-gui-linux.sh
|
||||
- name: Run smoke tests (Windows)
|
||||
if: ${{ runner.os == 'Windows' }}
|
||||
run: bash ../../scripts/tests/smoke-test-gui-windows.sh
|
||||
|
||||
# This should be identical to `build-push-windows-release-artifacts` in `cd.yml` except for the Github permissions, needs tag, and uploading step
|
||||
build-gui:
|
||||
|
||||
26
scripts/tests/smoke-test-gui-linux.sh
Executable file
26
scripts/tests/smoke-test-gui-linux.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
BUNDLE_ID="dev.firezone.client"
|
||||
DUMP_PATH="$BUNDLE_ID/data/logs/last_crash.dmp"
|
||||
export FIREZONE_DISABLE_SYSTRAY=true
|
||||
PACKAGE=firezone-gui-client
|
||||
export RUST_LOG=firezone_gui_client=debug,warn
|
||||
export WEBKIT_DISABLE_COMPOSITING_MODE=1
|
||||
|
||||
# Run the smoke test normally
|
||||
xvfb-run --auto-servernum cargo run -p "$PACKAGE" -- smoke-test
|
||||
|
||||
# Delete the crash file if present
|
||||
rm -f "$DUMP_PATH"
|
||||
|
||||
# Fail if it returns success, this is supposed to crash
|
||||
xvfb-run --auto-servernum cargo run -p "$PACKAGE" -- --crash && exit 1
|
||||
|
||||
# Fail if the crash file wasn't written
|
||||
stat "$DUMP_PATH"
|
||||
rm "$DUMP_PATH"
|
||||
|
||||
# I'm not sure if the last command is handled specially, so explicitly exit with 0
|
||||
exit 0
|
||||
24
scripts/tests/smoke-test-gui-windows.sh
Executable file
24
scripts/tests/smoke-test-gui-windows.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
# This script must run from an elevated shell so that Firezone won't try to elevate
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
BUNDLE_ID="dev.firezone.client"
|
||||
DUMP_PATH="$LOCALAPPDATA/$BUNDLE_ID/data/logs/last_crash.dmp"
|
||||
PACKAGE=firezone-gui-client
|
||||
|
||||
# Run the smoke test normally
|
||||
cargo run -p "$PACKAGE" -- smoke-test
|
||||
|
||||
# Delete the crash file if present
|
||||
rm -f "$DUMP_PATH"
|
||||
|
||||
# Fail if it returns success, this is supposed to crash
|
||||
cargo run -p "$PACKAGE" -- --crash && exit 1
|
||||
|
||||
# Fail if the crash file wasn't written
|
||||
stat "$DUMP_PATH"
|
||||
rm "$DUMP_PATH"
|
||||
|
||||
# I'm not sure if the last command is handled specially, so explicitly exit with 0
|
||||
exit 0
|
||||
Reference in New Issue
Block a user