diff --git a/.github/actions/setup-tauri/action.yml b/.github/actions/setup-tauri/action.yml new file mode 100644 index 000000000..2442e7039 --- /dev/null +++ b/.github/actions/setup-tauri/action.yml @@ -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 + # + - 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 + # + # 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 diff --git a/.github/workflows/_rust.yml b/.github/workflows/_rust.yml index 9adfa57f7..97f78ac07 100644 --- a/.github/workflows/_rust.yml +++ b/.github/workflows/_rust.yml @@ -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: - 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 + #- 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 - # - # 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 diff --git a/rust/windows-client/src-tauri/src/main.rs b/rust/windows-client/src-tauri/src/main.rs index 97238fdd3..f54769261 100644 --- a/rust/windows-client/src-tauri/src/main.rs +++ b/rust/windows-client/src-tauri/src/main.rs @@ -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(()) } }