From e05cbbe0a09791e9eccbadc63d9071684c952d9c Mon Sep 17 00:00:00 2001 From: Reactor Scram Date: Wed, 20 Mar 2024 09:11:41 -0500 Subject: [PATCH] build(gui-client/linux): include an empty `firezone-tunnel` binary with the Tauri deb package (#4220) I thought this was going to use `cargo-deb` but it was actually easy with the Tauri deb bundling we already use. ```[tasklist] ### Before merging - [x] Make sure every file in the Tauri deb is also in our deb (e.g. icons) ``` --- .github/workflows/_tauri.yml | 2 +- rust/gui-client/src-tauri/Cargo.toml | 1 + rust/gui-client/src-tauri/src/bin/firezone-tunnel.rs | 3 +++ scripts/build/tauri-rename-ubuntu.sh | 10 ++++++++++ scripts/build/tauri-rename-windows.sh | 5 ++--- scripts/tests/smoke-test-gui-windows.sh | 6 +++--- 6 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 rust/gui-client/src-tauri/src/bin/firezone-tunnel.rs diff --git a/.github/workflows/_tauri.yml b/.github/workflows/_tauri.yml index f596059e3..ca2f4be3c 100644 --- a/.github/workflows/_tauri.yml +++ b/.github/workflows/_tauri.yml @@ -64,7 +64,7 @@ jobs: shell: bash # AzureSignTool >= 5 needs .NET 8. windows-2019 runner only has .NET 7. run: dotnet tool install --global AzureSignTool --version 4.0.1 - - name: Build release exe and MSI + - name: Build release exe and MSI / deb # Signs the exe before bundling it into the MSI run: pnpm build # We need to sign the exe inside the MSI. Currently diff --git a/rust/gui-client/src-tauri/Cargo.toml b/rust/gui-client/src-tauri/Cargo.toml index 653ae29aa..8eb22342e 100644 --- a/rust/gui-client/src-tauri/Cargo.toml +++ b/rust/gui-client/src-tauri/Cargo.toml @@ -4,6 +4,7 @@ name = "firezone-gui-client" version = "1.0.0" description = "Firezone" edition = "2021" +default-run = "firezone-gui-client" [build-dependencies] anyhow = { version = "1.0" } diff --git a/rust/gui-client/src-tauri/src/bin/firezone-tunnel.rs b/rust/gui-client/src-tauri/src/bin/firezone-tunnel.rs new file mode 100644 index 000000000..908bf4658 --- /dev/null +++ b/rust/gui-client/src-tauri/src/bin/firezone-tunnel.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Firezone Tunnel"); +} diff --git a/scripts/build/tauri-rename-ubuntu.sh b/scripts/build/tauri-rename-ubuntu.sh index 272b05078..0d62d7966 100755 --- a/scripts/build/tauri-rename-ubuntu.sh +++ b/scripts/build/tauri-rename-ubuntu.sh @@ -23,3 +23,13 @@ function make_hash() { make_hash "$BINARY_DEST_PATH"-amd64 make_hash "$BINARY_DEST_PATH"-amd64.dwp make_hash "$BINARY_DEST_PATH"_amd64.deb + +# TODO: There must be a better place to put this +# Test the deb package, since this script is the easiest place to get a release build +sudo dpkg --install "$BINARY_DEST_PATH"_amd64.deb + +# Debug-print the files. The icons and both binaries should be in here +dpkg --listfiles firezone +which firezone firezone-tunnel +firezone-tunnel +firezone || true diff --git a/scripts/build/tauri-rename-windows.sh b/scripts/build/tauri-rename-windows.sh index 6909ad8c6..7f0e64c5c 100755 --- a/scripts/build/tauri-rename-windows.sh +++ b/scripts/build/tauri-rename-windows.sh @@ -6,10 +6,9 @@ ls ../target/release ../target/release/bundle/msi # Used for release artifact # In release mode the name comes from tauri.conf.json -# Using a glob for the source, there will only be one exe, msi, and pdb anyway -cp ../target/release/*.exe "$BINARY_DEST_PATH-x64.exe" +cp ../target/release/Firezone.exe "$BINARY_DEST_PATH-x64.exe" cp ../target/release/bundle/msi/*.msi "$BINARY_DEST_PATH-x64.msi" -cp ../target/release/*.pdb "$BINARY_DEST_PATH-x64.pdb" +cp ../target/release/firezone_gui_client.pdb "$BINARY_DEST_PATH-x64.pdb" function make_hash() { sha256sum "$1"> "$1.sha256sum.txt" diff --git a/scripts/tests/smoke-test-gui-windows.sh b/scripts/tests/smoke-test-gui-windows.sh index a5caf032c..94fd7b7d3 100755 --- a/scripts/tests/smoke-test-gui-windows.sh +++ b/scripts/tests/smoke-test-gui-windows.sh @@ -32,13 +32,13 @@ function smoke_test() { done # Run the smoke test normally - cargo run -p "$PACKAGE" -- smoke-test + cargo run --bin "$PACKAGE" -- smoke-test # Note the device ID DEVICE_ID_1=$(cat "$DEVICE_ID_PATH") # Run the test again and make sure the device ID is not changed - cargo run -p "$PACKAGE" -- smoke-test + cargo run --bin "$PACKAGE" -- smoke-test DEVICE_ID_2=$(cat "$DEVICE_ID_PATH") if [ "$DEVICE_ID_1" != "$DEVICE_ID_2" ] @@ -66,7 +66,7 @@ function crash_test() { rm -f "$DUMP_PATH" # Fail if it returns success, this is supposed to crash - cargo run -p "$PACKAGE" -- --crash && exit 1 + cargo run --bin "$PACKAGE" -- --crash && exit 1 # Fail if the crash file wasn't written stat "$DUMP_PATH"