Fix Windows Rust CI cache: full target, Cargo registry, explicit save.

Cache the entire windows-setup target tree plus ~/.cargo; split restore/save; skip cargo build when all release binaries are present.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-14 16:13:24 +03:00
Unverified
parent 7d7e78c534
commit 727aba5bb6
3 changed files with 45 additions and 17 deletions
@@ -1,18 +1,21 @@
name: Cache Windows installer Rust binaries name: Restore Windows Rust build cache
description: Restore or save compiled windows-setup release executables description: Restore Cargo registry, git checkouts, and the windows-setup target directory
outputs: outputs:
cache-hit: cache-hit:
description: Whether Rust installer tools were restored from cache description: Whether an exact cache key match was restored
value: ${{ steps.cache.outputs.cache-hit }} value: ${{ steps.cache.outputs.cache-hit }}
runs: runs:
using: composite using: composite
steps: steps:
- uses: actions/cache@v5 - uses: actions/cache/restore@v5
id: cache id: cache
with: with:
path: app/desktop/windows-setup/target/release path: |
key: windows-rust-tools-v1-${{ hashFiles('app/desktop/windows-setup/Cargo.lock') }} ~/.cargo/registry
~/.cargo/git
app/desktop/windows-setup/target
key: windows-rust-${{ runner.os }}-v2-${{ hashFiles('app/desktop/windows-setup/Cargo.lock', 'app/desktop/windows-setup/Cargo.toml', 'app/desktop/windows-setup/**/src/**', 'app/desktop/windows-setup/**/build.rs') }}
restore-keys: | restore-keys: |
windows-rust-tools-v1- windows-rust-${{ runner.os }}-v2-
@@ -0,0 +1,14 @@
name: Save Windows Rust build cache
description: Save Cargo registry, git checkouts, and the windows-setup target directory
runs:
using: composite
steps:
- uses: actions/cache/save@v5
continue-on-error: true
with:
key: windows-rust-${{ runner.os }}-v2-${{ hashFiles('app/desktop/windows-setup/Cargo.lock', 'app/desktop/windows-setup/Cargo.toml', 'app/desktop/windows-setup/**/src/**', 'app/desktop/windows-setup/**/build.rs') }}
path: |
~/.cargo/registry
~/.cargo/git
app/desktop/windows-setup/target
+21 -10
View File
@@ -146,21 +146,32 @@ jobs:
- uses: dtolnay/rust-toolchain@stable - uses: dtolnay/rust-toolchain@stable
with: with:
targets: x86_64-pc-windows-msvc targets: x86_64-pc-windows-msvc
- name: Cache Cargo registry
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
key: cargo-registry-${{ runner.os }}-${{ hashFiles('app/desktop/windows-setup/Cargo.lock') }}
restore-keys: |
cargo-registry-${{ runner.os }}-
- uses: ./.github/actions/cache-windows-rust-tools - uses: ./.github/actions/cache-windows-rust-tools
id: rust-tools-cache id: rust-tools-cache
- name: Verify Windows Rust binaries
id: rust-binaries
shell: bash
run: |
ready=true
for exe in \
FromChat-Installer.exe \
FromChat-Installer-Helper.exe \
fromchat-portable-launcher.exe \
fromchat-pack.exe \
fromchat-icon-patch.exe
do
if [[ ! -f "app/desktop/windows-setup/target/release/$exe" ]]; then
echo "Missing $exe"
ready=false
fi
done
echo "ready=$ready" >> "$GITHUB_OUTPUT"
- name: Build Windows installer Rust tooling - name: Build Windows installer Rust tooling
if: steps.rust-tools-cache.outputs.cache-hit != 'true' if: steps.rust-binaries.outputs.ready != 'true'
shell: bash shell: bash
run: ./gradlew :app:desktop:buildWindowsSetupRust --no-daemon --console=plain run: ./gradlew :app:desktop:buildWindowsSetupRust --no-daemon --console=plain
- uses: ./.github/actions/save-windows-rust-cache
if: always()
- uses: actions/upload-artifact@v5 - uses: actions/upload-artifact@v5
with: with:
name: windows-rust-tools name: windows-rust-tools