Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(ci): use the same test framework for headless client and IPC service #4943

Merged
merged 8 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/_rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-rust
- run: cargo build -p firezone-headless-client
name: "cargo build"
shell: bash
- uses: ./.github/actions/setup-tauri
ReactorScram marked this conversation as resolved.
Show resolved Hide resolved
- run: scripts/tests/${{ matrix.test }}.sh
name: "test script"
shell: bash
Expand Down
12 changes: 10 additions & 2 deletions scripts/build/tauri-rename-ubuntu.sh
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was originally going to merge the linux-group test into this, and I left the refactoring of this file.

Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
#!/usr/bin/env bash
set -euox pipefail

FZ_GROUP="firezone-client"
SERVICE_NAME=firezone-client-ipc

function debug_exit() {
systemctl status "$SERVICE_NAME"
exit 1
}

# For debugging
ls ../target/release ../target/release/bundle/deb

Expand Down Expand Up @@ -40,5 +48,5 @@ stat /usr/share/icons/hicolor/512x512/apps/firezone-client-gui.png
firezone-client-gui --help | grep "Usage: firezone-client-gui"

# Try to start the IPC service
sudo groupadd --force firezone-client
sudo systemctl start firezone-client-ipc || systemctl status firezone-client-ipc
sudo groupadd --force "$FZ_GROUP"
sudo systemctl start "SERVICE_NAME" || debug_exit
6 changes: 5 additions & 1 deletion scripts/tests/linux-group.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ SERVICE_NAME=firezone-client-ipc
SOCKET=/run/dev.firezone.client/ipc.sock
export RUST_LOG=info

cd rust || exit 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious why the explicit exit 1 here and not set -e at the top?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The shellcheck pre-commit lint doesn't seem to be aware of lib.sh, so it actually doesn't know we're using set -euox pipefail at all. If I remove this, it errors and won't let me commit.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hopefully that doesn't cause shellcheck to report any false negatives anywhere else 😨

cargo build --bin "$BINARY_NAME"
cd ..

# Copy the Linux Client out of the build dir
sudo cp "rust/target/debug/firezone-headless-client" "/usr/bin/$BINARY_NAME"
sudo cp "rust/target/debug/$BINARY_NAME" "/usr/bin/$BINARY_NAME"

# Set up the systemd service
sudo cp "rust/gui-client/src-tauri/deb_files/$SERVICE_NAME.service" /usr/lib/systemd/system/
Expand Down
8 changes: 6 additions & 2 deletions scripts/tests/token-path.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

source "./scripts/tests/lib.sh"

BINARY_NAME=firezone-linux-client
BINARY_NAME=firezone-headless-client
TOKEN="n.SFMyNTY.g2gDaANtAAAAJGM4OWJjYzhjLTkzOTItNGRhZS1hNDBkLTg4OGFlZjZkMjhlMG0AAAAkN2RhN2QxY2QtMTExYy00NGE3LWI1YWMtNDAyN2I5ZDIzMGU1bQAAACtBaUl5XzZwQmstV0xlUkFQenprQ0ZYTnFJWktXQnMyRGR3XzJ2Z0lRdkZnbgYAGUmu74wBYgABUYA.UN3vSLLcAMkHeEh5VHumPOutkuue8JA6wlxM9JxJEPE"
TOKEN_PATH="token"

sudo cp "rust/target/debug/firezone-headless-client" "/usr/bin/$BINARY_NAME"
cd rust || exit 1
cargo build -p "$BINARY_NAME"
cd ..

sudo cp "rust/target/debug/$BINARY_NAME" "/usr/bin/$BINARY_NAME"

# Fails because there's no token yet
sudo "$BINARY_NAME" --check standalone && exit 1
Expand Down
Loading