mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-28 02:18:50 +00:00
It doesn't run with `--example` because Tauri's build process doesn't seem to be compatible with that. But it does build the permissions test exe in CI. I might change that a general test exe later so that I don't have to add more build targets. It adds about 5 minutes to the CI, sccache only seems to speed up the build for the 2nd exe a tiny bit.
164 lines
5.4 KiB
YAML
164 lines
5.4 KiB
YAML
name: Rust
|
|
on:
|
|
workflow_call:
|
|
|
|
defaults:
|
|
run:
|
|
working-directory: ./rust
|
|
|
|
permissions:
|
|
contents: 'read'
|
|
id-token: 'write'
|
|
|
|
jobs:
|
|
static-analysis:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
runs-on:
|
|
# We only need to run static analysis checks per OS family
|
|
- ubuntu-22.04
|
|
- macos-13
|
|
- 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-13
|
|
packages: -p connlib-client-apple
|
|
- runs-on: windows-2022
|
|
packages: -p connlib-client-shared -p firezone-windows-client
|
|
runs-on: ${{ matrix.runs-on }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: ./.github/actions/setup-rust
|
|
- 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:
|
|
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
|
|
- runs-on: ubuntu-22.04
|
|
packages: -p firezone-linux-client -p firezone-gateway -p connlib-client-android
|
|
- runs-on: macos-12
|
|
packages: -p connlib-client-apple
|
|
- runs-on: macos-13
|
|
packages: -p connlib-client-apple
|
|
- runs-on: windows-2019
|
|
packages: -p firezone-windows-client -p connlib-client-shared
|
|
- runs-on: windows-2022
|
|
packages: -p firezone-windows-client -p connlib-client-shared
|
|
runs-on: ${{ matrix.runs-on }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: ./.github/actions/setup-rust
|
|
- run: cargo test --all-features ${{ matrix.packages }}
|
|
|
|
# TODO: Remove when windows build works reliably in cd.yml
|
|
# These `temp-` jobs serve as a sanity check to early exit if there's an issue in the workflow
|
|
temp-build-windows-artifacts:
|
|
runs-on: windows-2019
|
|
defaults:
|
|
run:
|
|
working-directory: ./rust
|
|
strategy:
|
|
fail-fast: false
|
|
# The matrix is 1x1 to match the style of build-push-linux-release-artifacts
|
|
# In the future we could try to cross-compile aarch64-windows here.
|
|
matrix:
|
|
name:
|
|
- package: hello-world
|
|
artifact: hello-world
|
|
env:
|
|
BINARY_DEST_PATH: ${{ matrix.name.artifact }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: ./.github/actions/setup-rust
|
|
with:
|
|
targets: x86_64-pc-windows-msvc
|
|
- name: Build release binaries
|
|
run: |
|
|
cargo `
|
|
build `
|
|
--release -p ${{ matrix.name.package }}
|
|
cp target/release/${{ matrix.name.package }}.exe "${{ env.BINARY_DEST_PATH }}-x64.exe"
|
|
pwd
|
|
ls *.exe
|
|
- name: Save build artifacts
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: ${{ matrix.name.artifact }}-x64.exe
|
|
path: ${{ github.workspace }}/rust/${{ env.BINARY_DEST_PATH }}-x64.exe
|
|
|
|
# This should be identical to `build-push-windows-release-artifacts` in `cd.yml` except for the permissions, needs, and uploading step
|
|
# TODO: Get rid of "temp" and figure out what to do with this
|
|
temp-build-tauri:
|
|
runs-on: windows-2019
|
|
defaults:
|
|
run:
|
|
working-directory: ./rust
|
|
strategy:
|
|
fail-fast: false
|
|
# The matrix is 1x1 to match the style of build-push-linux-release-artifacts
|
|
# In the future we could try to cross-compile aarch64-windows here.
|
|
matrix:
|
|
name:
|
|
- package: firezone-windows-client
|
|
artifact: windows-client
|
|
env:
|
|
BINARY_DEST_PATH: windows-client
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: ./.github/actions/setup-rust
|
|
with:
|
|
targets: x86_64-pc-windows-msvc
|
|
- name: Build release binaries
|
|
run: |
|
|
npm install -g @tauri-apps/cli
|
|
|
|
# NPM installs tauri-cli to somewhere in $PATH
|
|
tauri build
|
|
|
|
# Used for release artifact
|
|
cp target/release/firezone-windows-client.exe "windows-client-x64.exe"
|
|
|
|
# There's an MSI and NSIS installer too, but their names include the version so I'll try those later.
|
|
|
|
cd windows-client/examples/permissions-test
|
|
|
|
# Hopefully sccache speeds this up.
|
|
tauri build
|
|
|
|
cp src-tauri/target/release/windows-permissions-test.exe "windows-permissions-test-x64.exe"
|
|
|
|
- name: Save Windows client
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: windows-client-x64.exe
|
|
path: ${{ github.workspace }}/rust/windows-client-x64.exe
|
|
- name: Save Windows permissions test
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: windows-permissions-test-x64.exe
|
|
path: ${{ github.workspace }}/rust/windows-client/examples/permissions-test/windows-permissions-test-x64.exe
|
|
|
|
smoke-test-relay:
|
|
runs-on: ubuntu-22.04
|
|
defaults:
|
|
run:
|
|
working-directory: ./rust/relay
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: ./.github/actions/setup-rust
|
|
- run: ./run_smoke_test.sh
|