mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 18:18:55 +00:00
refactor(ci): extract setup-tauri action and generalize Windows builds (#3702)
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>
This commit is contained in:
40
.github/actions/setup-tauri/action.yml
vendored
Normal file
40
.github/actions/setup-tauri/action.yml
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
# From https://tauri.app/v1/guides/getting-started/prerequisites
|
||||
name: "Setup Tauri"
|
||||
description: "Sets up the dependencies for building and testing Tauri apps"
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Apt-get update
|
||||
if: ${{ runner.os == 'Linux' }}
|
||||
run: sudo apt-get update
|
||||
shell: bash
|
||||
- name: Install Tauri build deps
|
||||
if: ${{ runner.os == 'Linux' }}
|
||||
run: sudo apt-get install libwebkit2gtk-4.0-dev libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev
|
||||
shell: bash
|
||||
- name: Install gnome-keyring
|
||||
if: ${{ runner.os == 'Linux' }}
|
||||
run: sudo apt-get install gnome-keyring
|
||||
shell: bash
|
||||
# This is only needed if we'll launch the Tauri GUI, so it's redundant for clippy / test
|
||||
# This is what the Tauri CI tests use
|
||||
# <https://github.com/tauri-apps/tauri/blob/3fb414b61ad7cfce67751230826fddfb39effec5/.github/workflows/bench.yml#L74>
|
||||
- name: Install Tauri runtime deps
|
||||
if: ${{ runner.os == 'Linux' }}
|
||||
run: sudo apt-get install at-spi2-core xvfb
|
||||
shell: bash
|
||||
- name: Download WebView2 bootstrapper
|
||||
if: ${{ runner.os == 'Windows' }}
|
||||
# This is the "Evergreen" bootstrapper from Microsoft
|
||||
# <https://developer.microsoft.com/en-us/microsoft-edge/webview2/?form=MA13LH#download>
|
||||
# Unfortunately, this makes the test non-deterministic.
|
||||
# Controlling the version would be difficult.
|
||||
run: Invoke-WebRequest -Uri https://go.microsoft.com/fwlink/p/?LinkId=2124703 -OutFile WebView2Installer.exe
|
||||
shell: pwsh
|
||||
- name: Install WebView2
|
||||
if: ${{ runner.os == 'Windows' }}
|
||||
# This downloads about 200 MB and takes about 5 minutes on my VM
|
||||
# So we could fault in WebView2 from the client exe without the MSI if we needed.
|
||||
# Currently the MSI does this and it's a little janky.
|
||||
run: Start-Process WebView2Installer.exe -ArgumentList "/install" -Wait
|
||||
shell: pwsh
|
||||
78
.github/workflows/_rust.yml
vendored
78
.github/workflows/_rust.yml
vendored
@@ -33,6 +33,7 @@ jobs:
|
||||
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 }}
|
||||
@@ -66,13 +67,24 @@ jobs:
|
||||
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>
|
||||
windows-smoke-test:
|
||||
name: windows-smoke-test
|
||||
runs-on: windows-2019
|
||||
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
|
||||
@@ -85,19 +97,7 @@ jobs:
|
||||
with:
|
||||
node-version: '20'
|
||||
- uses: ./.github/actions/setup-rust
|
||||
with:
|
||||
targets: x86_64-pc-windows-msvc
|
||||
# This is the "Evergreen" bootstrapper from Microsoft
|
||||
# <https://developer.microsoft.com/en-us/microsoft-edge/webview2/?form=MA13LH#download>
|
||||
# Unfortunately, this makes the test non-deterministic.
|
||||
# Controlling the version would be difficult.
|
||||
- name: Download WebView2 bootstrapper
|
||||
run: Invoke-WebRequest -Uri https://go.microsoft.com/fwlink/p/?LinkId=2124703 -OutFile WebView2Installer.exe
|
||||
# This downloads about 200 MB and takes about 5 minutes on my VM
|
||||
# So we could fault in WebView2 from the client exe without the MSI if we needed.
|
||||
# Currently the MSI does this and it's a little janky.
|
||||
- name: Install WebView2
|
||||
run: Start-Process WebView2Installer.exe -ArgumentList "/install" -Wait
|
||||
- uses: ./.github/actions/setup-tauri
|
||||
- name: pnpm install
|
||||
run: |
|
||||
pnpm install
|
||||
@@ -114,23 +114,24 @@ jobs:
|
||||
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-tauri:
|
||||
name: build-tauri-${{ matrix.name }}
|
||||
runs-on: windows-2019
|
||||
build-gui:
|
||||
name: build-gui-${{ matrix.runs-on }}
|
||||
runs-on: ${{ matrix.runs-on }}
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./rust/windows-client
|
||||
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:
|
||||
runs-on:
|
||||
# TODO
|
||||
# - ubuntu-20.04
|
||||
- windows-2019
|
||||
include:
|
||||
- package: firezone-windows-client
|
||||
artifact: firezone-windows-client
|
||||
name: windows-client
|
||||
# - runs-on: ubuntu-20.04
|
||||
- runs-on: windows-2019
|
||||
env:
|
||||
BINARY_DEST_PATH: ${{ matrix.artifact }}
|
||||
BINARY_DEST_PATH: firezone-windows-client
|
||||
CONNLIB_LOG_UPLOAD_INTERVAL_SECS: 300
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -138,8 +139,7 @@ jobs:
|
||||
with:
|
||||
node-version: '20'
|
||||
- uses: ./.github/actions/setup-rust
|
||||
with:
|
||||
targets: x86_64-pc-windows-msvc
|
||||
- uses: ./.github/actions/setup-tauri
|
||||
- name: Install pnpm deps
|
||||
run: pnpm install
|
||||
- name: Build release exe and MSI
|
||||
@@ -159,24 +159,26 @@ jobs:
|
||||
# This might catch regressions in #3384, depending how CI runners
|
||||
# handle exit codes
|
||||
git diff --exit-code
|
||||
- name: Save Windows client
|
||||
- name: Save GUI client
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.artifact }}-x64
|
||||
name: ${{ env.BINARY_DEST_PATH }}-x64
|
||||
path: |
|
||||
${{ github.workspace }}/rust/windows-client/${{ matrix.artifact }}-x64.exe
|
||||
${{ github.workspace }}/rust/windows-client/${{ matrix.artifact }}-x64.exe.sha256sum.txt
|
||||
- name: Save Windows installer
|
||||
${{ 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: ${{ matrix.artifact }}-x64-msi
|
||||
name: ${{ env.BINARY_DEST_PATH }}-x64-msi
|
||||
path: |
|
||||
${{ github.workspace }}/rust/windows-client/${{ matrix.artifact }}-x64.msi
|
||||
${{ github.workspace }}/rust/windows-client/${{ matrix.artifact }}-x64.msi.sha256sum.txt
|
||||
${{ 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: ${{ matrix.artifact }}-x64-pdb
|
||||
name: ${{ env.BINARY_DEST_PATH }}-x64-pdb
|
||||
path: |
|
||||
${{ github.workspace }}/rust/windows-client/${{ matrix.artifact }}-x64.pdb
|
||||
${{ github.workspace }}/rust/windows-client/${{ matrix.artifact }}-x64.pdb.sha256sum.txt
|
||||
${{ github.workspace }}/rust/windows-client/${{ env.BINARY_DEST_PATH }}-x64.pdb
|
||||
${{ github.workspace }}/rust/windows-client/${{ env.BINARY_DEST_PATH }}-x64.pdb.sha256sum.txt
|
||||
|
||||
@@ -10,7 +10,8 @@ fn main() -> anyhow::Result<()> {
|
||||
#[cfg(target_family = "unix")]
|
||||
mod client {
|
||||
pub(crate) fn run() -> anyhow::Result<()> {
|
||||
panic!("The Windows client does not compile on non-Windows platforms");
|
||||
println!("The Windows client does not compile on non-Windows platforms yet");
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user