From c4c2856f17e7913fd01b3b7357c28c0111b00a88 Mon Sep 17 00:00:00 2001 From: Darkatse <39111369+Darkatse@users.noreply.github.com> Date: Fri, 9 Oct 2026 23:45:27 -0400 Subject: [PATCH] ci: build portable binaries in their own jobs and keep Rust caches reusable The Windows release job built the bundles and then the portable binary, so the portable link sat on the Canary critical path (56 min on 2026-10-08). Build the portable binaries in a separate matrix job; they build their own frontend and, on Canary, restore the desktop release cache of the same platform. The repository cache was at its 10 GB limit and dev had lost every desktop cache: Canary built from scratch (Windows 55 min cold against 36 min warm). The default rust-cache key ignored the matrix, so release and debug builds on one runner shared a key. Give each Canary release build its own key and leave the debug builds uncached. Stable and pull requests no longer cache: caches saved under a tag or a PR ref are not reused by later runs and only evicted dev's. Validation: workflows parse; jobs, steps and publish dependencies checked. Cache budget to confirm after the next Canary runs. --- .github/workflows/canary-release.yml | 67 ++++++++++++++++++++------- .github/workflows/pr-quality-gate.yml | 10 ---- .github/workflows/stable-release.yml | 66 ++++++++++++++++---------- 3 files changed, 93 insertions(+), 50 deletions(-) diff --git a/.github/workflows/canary-release.yml b/.github/workflows/canary-release.yml index 2cf21a23..1bbc6dee 100644 --- a/.github/workflows/canary-release.yml +++ b/.github/workflows/canary-release.yml @@ -77,38 +77,32 @@ jobs: - platform: windows-latest target_args: "" artifact_prefix: "" - portable: true - portable_name: windows-x64 + cache_key: windows-x64 - platform: windows-latest target_args: --debug --bundles nsis --features devtools-pilot artifact_prefix: debug- - portable: false - platform: macos-latest target_args: --target x86_64-apple-darwin artifact_prefix: "" - portable: false + cache_key: macos-x64 - platform: macos-latest target_args: --target x86_64-apple-darwin --debug --bundles dmg --features devtools-pilot artifact_prefix: debug- - portable: false - platform: macos-latest target_args: --target aarch64-apple-darwin artifact_prefix: "" - portable: false + cache_key: macos-arm64 - platform: macos-latest target_args: --target aarch64-apple-darwin --debug --bundles dmg --features devtools-pilot artifact_prefix: debug- - portable: false - platform: ubuntu-22.04 target_args: --bundles appimage,deb,rpm artifact_prefix: "" - portable: true - portable_name: linux-x64 + cache_key: linux-x64 - platform: ubuntu-22.04-arm target_args: --bundles deb,rpm artifact_prefix: "" - portable: true - portable_name: linux-arm64 + cache_key: linux-arm64 runs-on: ${{ matrix.platform }} steps: @@ -128,8 +122,10 @@ jobs: targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} - uses: swatinem/rust-cache@v2 + if: matrix.cache_key with: workspaces: "src-tauri -> target" + shared-key: release-${{ matrix.cache_key }} - uses: pnpm/setup@v2 with: @@ -183,15 +179,54 @@ jobs: uploadUpdaterSignatures: false workflowArtifactNamePattern: 'TauriTavern-${{ needs.prepare.outputs.asset_time }}-canary-${{ matrix.artifact_prefix }}[platform]-[arch]-[bundle]' + portable: + needs: prepare + strategy: + fail-fast: false + matrix: + include: + - platform: windows-latest + name: windows-x64 + - platform: ubuntu-22.04 + name: linux-x64 + - platform: ubuntu-22.04-arm + name: linux-arm64 + + runs-on: ${{ matrix.platform }} + steps: + - uses: actions/checkout@v7 + + - name: Install Linux dependencies + if: startsWith(matrix.platform, 'ubuntu-22.04') + run: | + sudo apt-get update + sudo apt-get install -y --no-install-recommends \ + libdbus-1-dev libwebkit2gtk-4.1-dev librsvg2-dev pkg-config + + - uses: dtolnay/rust-toolchain@stable + + # Restores the desktop release cache; `name` must equal that entry's `cache_key`. + - uses: swatinem/rust-cache@v2 + with: + workspaces: "src-tauri -> target" + shared-key: release-${{ matrix.name }} + save-if: false + + - uses: pnpm/setup@v2 + with: + runtime: node@22 + cache: true + install: false + + - run: pnpm install --frozen-lockfile + - name: Build portable binary - if: matrix.portable - run: node scripts/build-portable.mjs --skip-web-build --output-dir portable + run: node scripts/build-portable.mjs --output-dir portable - name: Upload portable binary - if: matrix.portable uses: actions/upload-artifact@v7 with: - name: TauriTavern-${{ needs.prepare.outputs.asset_time }}-canary-${{ matrix.portable_name }}-portable + name: TauriTavern-${{ needs.prepare.outputs.asset_time }}-canary-${{ matrix.name }}-portable path: portable/* if-no-files-found: error @@ -530,7 +565,7 @@ jobs: retention-days: 7 publish: - needs: [prepare, desktop, mobile, ohos, notes] + needs: [prepare, desktop, portable, mobile, ohos, notes] # Wait for experimental HAPs, but publish the other platforms if OHOS fails. if: ${{ !cancelled() && needs.prepare.result == 'success' && needs.desktop.result == 'success' && needs.mobile.result == 'success' && needs.notes.result == 'success' }} runs-on: ubuntu-latest diff --git a/.github/workflows/pr-quality-gate.yml b/.github/workflows/pr-quality-gate.yml index 6a67ab42..3de843bd 100644 --- a/.github/workflows/pr-quality-gate.yml +++ b/.github/workflows/pr-quality-gate.yml @@ -45,11 +45,6 @@ jobs: with: components: clippy - - name: Cache Rust build artifacts - uses: swatinem/rust-cache@v2 - with: - workspaces: "src-tauri -> target" - - name: Setup pnpm and Node.js uses: pnpm/setup@v2 with: @@ -121,11 +116,6 @@ jobs: echo "BINDGEN_EXTRA_CLANG_ARGS_aarch64_linux_android=--sysroot=$sysroot" } >> "$GITHUB_ENV" - - name: Cache Rust build artifacts - uses: swatinem/rust-cache@v2 - with: - workspaces: "src-tauri -> target" - - name: Check ${{ matrix.name }} Rust target run: >- cargo check diff --git a/.github/workflows/stable-release.yml b/.github/workflows/stable-release.yml index 1c98eace..0ff7126f 100644 --- a/.github/workflows/stable-release.yml +++ b/.github/workflows/stable-release.yml @@ -88,38 +88,27 @@ jobs: - platform: windows-latest target_args: "" artifact_prefix: "" - portable: true - portable_name: windows-x64 - platform: windows-latest target_args: --debug --bundles nsis --features devtools-pilot artifact_prefix: debug- - portable: false - platform: macos-latest target_args: --target x86_64-apple-darwin artifact_prefix: "" - portable: false - platform: macos-latest target_args: --target x86_64-apple-darwin --debug --bundles dmg --features devtools-pilot artifact_prefix: debug- - portable: false - platform: macos-latest target_args: --target aarch64-apple-darwin artifact_prefix: "" - portable: false - platform: macos-latest target_args: --target aarch64-apple-darwin --debug --bundles dmg --features devtools-pilot artifact_prefix: debug- - portable: false - platform: ubuntu-22.04 target_args: --bundles appimage,deb,rpm artifact_prefix: "" - portable: true - portable_name: linux-x64 - platform: ubuntu-22.04-arm target_args: --bundles deb,rpm artifact_prefix: "" - portable: true - portable_name: linux-arm64 runs-on: ${{ matrix.platform }} env: @@ -143,10 +132,6 @@ jobs: with: targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} - - uses: swatinem/rust-cache@v2 - with: - workspaces: "src-tauri -> target" - - uses: pnpm/setup@v2 with: runtime: node@22 @@ -182,15 +167,52 @@ jobs: uploadUpdaterSignatures: false workflowArtifactNamePattern: 'TauriTavern-${{ needs.prepare.outputs.version }}-${{ matrix.artifact_prefix }}[platform]-[arch]-[bundle]' + portable: + needs: prepare + strategy: + fail-fast: false + matrix: + include: + - platform: windows-latest + name: windows-x64 + - platform: ubuntu-22.04 + name: linux-x64 + - platform: ubuntu-22.04-arm + name: linux-arm64 + + runs-on: ${{ matrix.platform }} + env: + TAURITAVERN_BUILD_BRANCH: main + TAURITAVERN_BUILD_REVISION: ${{ needs.prepare.outputs.commit }} + steps: + - uses: actions/checkout@v7 + with: + ref: ${{ needs.prepare.outputs.tag }} + + - name: Install Linux dependencies + if: startsWith(matrix.platform, 'ubuntu-22.04') + run: | + sudo apt-get update + sudo apt-get install -y --no-install-recommends \ + libdbus-1-dev libwebkit2gtk-4.1-dev librsvg2-dev pkg-config + + - uses: dtolnay/rust-toolchain@stable + + - uses: pnpm/setup@v2 + with: + runtime: node@22 + cache: true + install: false + + - run: pnpm install --frozen-lockfile + - name: Build portable binary - if: matrix.portable - run: node scripts/build-portable.mjs --skip-web-build --output-dir portable + run: node scripts/build-portable.mjs --output-dir portable - name: Upload portable binary - if: matrix.portable uses: actions/upload-artifact@v7 with: - name: TauriTavern-${{ needs.prepare.outputs.version }}-${{ matrix.portable_name }}-portable + name: TauriTavern-${{ needs.prepare.outputs.version }}-${{ matrix.name }}-portable path: portable/* if-no-files-found: error @@ -320,10 +342,6 @@ jobs: echo "BINDGEN_EXTRA_CLANG_ARGS_armv7_linux_androideabi=--sysroot=$sysroot" } >> "$GITHUB_ENV" - - uses: swatinem/rust-cache@v2 - with: - workspaces: "src-tauri -> target" - - uses: pnpm/setup@v2 with: runtime: node@22 @@ -445,7 +463,7 @@ jobs: APPLE_API_KEY_P8: ${{ secrets.APPLE_API_KEY_P8 }} publish-release: - needs: [prepare, desktop, mobile] + needs: [prepare, desktop, portable, mobile] runs-on: ubuntu-latest permissions: actions: read