From 727aba5bb69fd667ef59d5b27d170aed73a91270 Mon Sep 17 00:00:00 2001 From: denis0001-dev Date: Mon, 14 Sep 2026 16:13:24 +0300 Subject: [PATCH] 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 --- .../cache-windows-rust-tools/action.yml | 17 +++++----- .../save-windows-rust-cache/action.yml | 14 +++++++++ .github/workflows/release.yml | 31 +++++++++++++------ 3 files changed, 45 insertions(+), 17 deletions(-) create mode 100644 .github/actions/save-windows-rust-cache/action.yml diff --git a/.github/actions/cache-windows-rust-tools/action.yml b/.github/actions/cache-windows-rust-tools/action.yml index 0fbf87f..021c88a 100644 --- a/.github/actions/cache-windows-rust-tools/action.yml +++ b/.github/actions/cache-windows-rust-tools/action.yml @@ -1,18 +1,21 @@ -name: Cache Windows installer Rust binaries -description: Restore or save compiled windows-setup release executables +name: Restore Windows Rust build cache +description: Restore Cargo registry, git checkouts, and the windows-setup target directory outputs: 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 }} runs: using: composite steps: - - uses: actions/cache@v5 + - uses: actions/cache/restore@v5 id: cache with: - path: app/desktop/windows-setup/target/release - key: windows-rust-tools-v1-${{ hashFiles('app/desktop/windows-setup/Cargo.lock') }} + path: | + ~/.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: | - windows-rust-tools-v1- + windows-rust-${{ runner.os }}-v2- diff --git a/.github/actions/save-windows-rust-cache/action.yml b/.github/actions/save-windows-rust-cache/action.yml new file mode 100644 index 0000000..edd9abb --- /dev/null +++ b/.github/actions/save-windows-rust-cache/action.yml @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9dff842..1d15ee1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -146,21 +146,32 @@ jobs: - uses: dtolnay/rust-toolchain@stable with: 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 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 - if: steps.rust-tools-cache.outputs.cache-hit != 'true' + if: steps.rust-binaries.outputs.ready != 'true' shell: bash run: ./gradlew :app:desktop:buildWindowsSetupRust --no-daemon --console=plain + - uses: ./.github/actions/save-windows-rust-cache + if: always() - uses: actions/upload-artifact@v5 with: name: windows-rust-tools