mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 10:18:54 +00:00
Splits up platform-specific modules into `linux.rs` and `windows.rs` submodules, or `imp` modules within the parent module, so that we can compile all the platform-independent code (e.g. Tauri calls, `run_controller`) for Linux. This will show the Tauri GUI on Linux:  --------- Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
181 lines
6.3 KiB
YAML
181 lines
6.3 KiB
YAML
name: Rust
|
|
on:
|
|
workflow_call:
|
|
|
|
defaults:
|
|
run:
|
|
working-directory: ./rust
|
|
|
|
permissions:
|
|
contents: 'read'
|
|
id-token: 'write'
|
|
|
|
jobs:
|
|
static-analysis:
|
|
name: static-analysis-${{ matrix.runs-on }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
runs-on:
|
|
# We only need to run static analysis checks per OS family
|
|
- ubuntu-22.04
|
|
- macos-14
|
|
- windows-2022
|
|
# TODO: https://github.com/rust-lang/cargo/issues/5220
|
|
include:
|
|
- runs-on: ubuntu-22.04
|
|
packages: # Intentionally blank as a package catch-all linter
|
|
- runs-on: macos-14
|
|
packages: -p connlib-client-apple -p snownet
|
|
- runs-on: windows-2022
|
|
packages: -p connlib-client-shared -p firezone-gui-client -p snownet
|
|
runs-on: ${{ matrix.runs-on }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: ./.github/actions/setup-rust
|
|
- uses: ./.github/actions/setup-tauri
|
|
- run: cargo fmt -- --check
|
|
- run: |
|
|
cargo doc --all-features --no-deps --document-private-items ${{ matrix.packages }}
|
|
env:
|
|
RUSTDOCFLAGS: "-D warnings"
|
|
- run: |
|
|
cargo clippy --all-targets --all-features ${{ matrix.packages }} -- -D warnings
|
|
|
|
test:
|
|
name: test-${{ matrix.runs-on }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
# TODO: https://github.com/rust-lang/cargo/issues/5220
|
|
include:
|
|
- runs-on: ubuntu-20.04
|
|
packages: --workspace
|
|
- runs-on: ubuntu-22.04
|
|
packages: --workspace
|
|
- runs-on: macos-12
|
|
packages: -p connlib-client-apple -p snownet
|
|
- runs-on: macos-13
|
|
packages: -p connlib-client-apple -p snownet
|
|
- runs-on: macos-14
|
|
packages: -p connlib-client-apple -p snownet
|
|
- runs-on: windows-2019
|
|
packages: -p firezone-gui-client -p connlib-client-shared -p snownet
|
|
- runs-on: windows-2022
|
|
packages: -p firezone-gui-client -p connlib-client-shared -p snownet
|
|
runs-on: ${{ matrix.runs-on }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: ./.github/actions/setup-rust
|
|
- uses: ./.github/actions/setup-tauri
|
|
- run: cargo test --all-features ${{ matrix.packages }}
|
|
|
|
# Runs the Windows client smoke test, built in debug mode. We can't run it in release
|
|
# mode because of a known issue: <https://github.com/firezone/firezone/blob/456e044f882c2bb314e19cc44c0d19c5ad817b7c/rust/windows-client/src-tauri/src/client.rs#L162-L164>
|
|
gui-smoke-test:
|
|
name: gui-smoke-test-${{ matrix.runs-on }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- runs-on: ubuntu-20.04
|
|
# Broken on 22.04 <https://github.com/firezone/firezone/issues/3699>
|
|
#- runs-on: ubuntu-22.04
|
|
- runs-on: windows-2019
|
|
- runs-on: windows-2022
|
|
runs-on: ${{ matrix.runs-on }}
|
|
defaults:
|
|
run:
|
|
working-directory: ./rust/gui-client
|
|
env:
|
|
CONNLIB_LOG_UPLOAD_INTERVAL_SECS: 300
|
|
# The Windows client ignores RUST_LOG because it uses a settings file instead
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: ./.github/actions/setup-node
|
|
with:
|
|
node-version: '20'
|
|
- uses: ./.github/actions/setup-rust
|
|
- uses: ./.github/actions/setup-tauri
|
|
- name: pnpm install
|
|
run: |
|
|
pnpm install
|
|
cp "node_modules/flowbite/dist/flowbite.min.js" "src/"
|
|
- name: Compile TypeScript
|
|
run: pnpm tsc
|
|
- name: Compile Tailwind
|
|
run: pnpm tailwindcss -i src/input.css -o src/output.css
|
|
- name: Build client
|
|
run: cargo build -p firezone-gui-client
|
|
- 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:
|
|
name: build-gui-${{ matrix.runs-on }}
|
|
runs-on: ${{ matrix.runs-on }}
|
|
defaults:
|
|
run:
|
|
working-directory: ./rust/gui-client
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- runs-on: ubuntu-20.04
|
|
binary-dest-path: firezone-linux-gui-client
|
|
rename-script: ../../scripts/build/tauri-rename-ubuntu.sh
|
|
- runs-on: windows-2019
|
|
binary-dest-path: firezone-windows-client
|
|
rename-script: ../../scripts/build/tauri-rename-windows.sh
|
|
env:
|
|
BINARY_DEST_PATH: ${{ matrix.binary-dest-path }}
|
|
CONNLIB_LOG_UPLOAD_INTERVAL_SECS: 300
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: ./.github/actions/setup-node
|
|
with:
|
|
node-version: '20'
|
|
- uses: ./.github/actions/setup-rust
|
|
- uses: ./.github/actions/setup-tauri
|
|
- name: Install pnpm deps
|
|
run: pnpm install
|
|
- name: Build release exe and MSI
|
|
run: pnpm build
|
|
- name: Rename artifacts and compute SHA256
|
|
shell: bash
|
|
run: ${{ matrix.rename-script }}
|
|
- name: Save Linux client
|
|
if: ${{ runner.os == 'Linux' }}
|
|
uses: ./.github/actions/upload-gui-artifact
|
|
with:
|
|
base: ${{ env.BINARY_DEST_PATH }}-amd64
|
|
- name: Save Linux AppImage
|
|
if: ${{ runner.os == 'Linux' }}
|
|
uses: ./.github/actions/upload-gui-artifact
|
|
with:
|
|
base: ${{ env.BINARY_DEST_PATH }}_amd64.AppImage
|
|
- name: Save Linux deb package
|
|
if: ${{ runner.os == 'Linux' }}
|
|
uses: ./.github/actions/upload-gui-artifact
|
|
with:
|
|
base: ${{ env.BINARY_DEST_PATH }}_amd64.deb
|
|
- name: Save Windows client
|
|
if: ${{ runner.os == 'Windows' }}
|
|
uses: ./.github/actions/upload-gui-artifact
|
|
with:
|
|
base: ${{ env.BINARY_DEST_PATH }}-x64.exe
|
|
- name: Save Windows MSI installer
|
|
if: ${{ runner.os == 'Windows' }}
|
|
uses: ./.github/actions/upload-gui-artifact
|
|
with:
|
|
base: ${{ env.BINARY_DEST_PATH }}-x64.msi
|
|
- name: Save Windows debug symbols
|
|
if: ${{ runner.os == 'Windows' }}
|
|
uses: ./.github/actions/upload-gui-artifact
|
|
with:
|
|
base: ${{ env.BINARY_DEST_PATH }}-x64.pdb
|