mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 18:18:55 +00:00
This prevents duplication for different Tauri jobs like building the release packages vs testing a debug build with mock keyring. ```[tasklist] - [ ] Fix branch protection rules for changed tests ``` --------- Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
185 lines
7.2 KiB
YAML
185 lines
7.2 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-windows-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: -p firezone-linux-client -p firezone-gateway -p connlib-client-android -p snownet
|
|
- runs-on: ubuntu-22.04
|
|
packages: -p firezone-linux-client -p firezone-gateway -p connlib-client-android -p snownet
|
|
- 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-windows-client -p connlib-client-shared -p snownet
|
|
- runs-on: windows-2022
|
|
packages: -p firezone-windows-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:
|
|
# Awaiting another PR to generalize the smoke test for Ubuntu
|
|
#- 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/windows-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-windows-client
|
|
- name: Run smoke test
|
|
run: cargo run -p firezone-windows-client -- smoke-test
|
|
- name: Test that the crash handler produces a crash dump
|
|
run: bash scripts/crash-handling-smoke-test.bash
|
|
|
|
# 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/windows-client
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
runs-on:
|
|
# TODO
|
|
# - ubuntu-20.04
|
|
- windows-2019
|
|
include:
|
|
# - runs-on: ubuntu-20.04
|
|
- runs-on: windows-2019
|
|
env:
|
|
BINARY_DEST_PATH: firezone-windows-client
|
|
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: Compute SHA256 and rename
|
|
run: |
|
|
# Used for release artifact
|
|
# In release mode the name comes from tauri.conf.json
|
|
cp "../target/release/Firezone.exe" "${{ env.BINARY_DEST_PATH }}-x64.exe"
|
|
cp "../target/release/bundle/msi/*.msi" "${{ env.BINARY_DEST_PATH }}-x64.msi"
|
|
cp "../target/release/firezone_windows_client.pdb" "${{ env.BINARY_DEST_PATH }}-x64.pdb"
|
|
|
|
Get-FileHash ${{ env.BINARY_DEST_PATH }}-x64.exe -Algorithm SHA256 | Select-Object Hash > ${{ env.BINARY_DEST_PATH }}-x64.exe.sha256sum.txt
|
|
Get-FileHash ${{ env.BINARY_DEST_PATH }}-x64.msi -Algorithm SHA256 | Select-Object Hash > ${{ env.BINARY_DEST_PATH }}-x64.msi.sha256sum.txt
|
|
Get-FileHash ${{ env.BINARY_DEST_PATH }}-x64.pdb -Algorithm SHA256 | Select-Object Hash > ${{ env.BINARY_DEST_PATH }}-x64.pdb.sha256sum.txt
|
|
|
|
# This might catch regressions in #3384, depending how CI runners
|
|
# handle exit codes
|
|
git diff --exit-code
|
|
- name: Save GUI client
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ env.BINARY_DEST_PATH }}-x64
|
|
path: |
|
|
${{ github.workspace }}/rust/windows-client/${{ env.BINARY_DEST_PATH }}-x64.exe
|
|
${{ github.workspace }}/rust/windows-client/${{ env.BINARY_DEST_PATH }}-x64.exe.sha256sum.txt
|
|
- name: Save Windows MSI installer
|
|
if: ${{ runner.os == 'Windows' }}
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ env.BINARY_DEST_PATH }}-x64-msi
|
|
path: |
|
|
${{ github.workspace }}/rust/windows-client/${{ env.BINARY_DEST_PATH }}-x64.msi
|
|
${{ github.workspace }}/rust/windows-client/${{ env.BINARY_DEST_PATH }}-x64.msi.sha256sum.txt
|
|
- name: Save Windows debug symbols
|
|
if: ${{ runner.os == 'Windows' }}
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ env.BINARY_DEST_PATH }}-x64-pdb
|
|
path: |
|
|
${{ github.workspace }}/rust/windows-client/${{ env.BINARY_DEST_PATH }}-x64.pdb
|
|
${{ github.workspace }}/rust/windows-client/${{ env.BINARY_DEST_PATH }}-x64.pdb.sha256sum.txt
|