Fix Gradle and Rust cache save failures on parallel release jobs.

Use scope-specific Gradle cache paths, global release concurrency, Rust v3 key with v1/v2 fallbacks, and ensure Android SDK cache dirs exist before save.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-14 16:23:40 +03:00
Unverified
parent 727aba5bb6
commit 926343e90e
5 changed files with 42 additions and 5 deletions
+18 -1
View File
@@ -9,7 +9,7 @@ inputs:
outputs: outputs:
cache-hit: cache-hit:
description: Whether an exact cache key match was restored description: Whether an exact cache key match was restored
value: ${{ steps.cache.outputs.cache-hit }} value: ${{ steps.cache.outputs.cache-hit == 'true' || steps.cache-android.outputs.cache-hit == 'true' }}
cache-save-scope: cache-save-scope:
description: Scope to pass to the save action (always this job's scope, not a restored fallback key) description: Scope to pass to the save action (always this job's scope, not a restored fallback key)
value: ${{ inputs.scope }} value: ${{ inputs.scope }}
@@ -18,6 +18,23 @@ runs:
using: composite using: composite
steps: steps:
- uses: actions/cache/restore@v5 - uses: actions/cache/restore@v5
if: inputs.scope == 'android'
id: cache-android
with:
path: |
.gradle
build
app/shared/build
app/android/build
utils/shared/build
utils/android/build
key: gradle-build-${{ runner.os }}-${{ runner.arch }}-v2-${{ inputs.scope }}-${{ hashFiles('gradle/libs.versions.toml', 'settings.gradle.kts', 'gradle.properties', 'build.gradle.kts', 'app/desktop/build.gradle.kts', 'app/desktop/proguard-rules.pro', 'app/shared/build.gradle.kts', 'app/android/build.gradle.kts', 'utils/shared/build.gradle.kts', 'utils/android/build.gradle.kts') }}
restore-keys: |
gradle-build-${{ runner.os }}-${{ runner.arch }}-v2-${{ inputs.scope }}-
gradle-build-${{ runner.os }}-${{ runner.arch }}-v2-build-jar-
gradle-build-${{ runner.os }}-${{ runner.arch }}-v2-
- uses: actions/cache/restore@v5
if: inputs.scope != 'android'
id: cache id: cache
with: with:
path: | path: |
@@ -16,6 +16,9 @@ runs:
~/.cargo/registry ~/.cargo/registry
~/.cargo/git ~/.cargo/git
app/desktop/windows-setup/target 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') }} key: windows-rust-${{ runner.os }}-v3-${{ hashFiles('app/desktop/windows-setup/Cargo.lock') }}
restore-keys: | restore-keys: |
windows-rust-${{ runner.os }}-v3-
windows-rust-${{ runner.os }}-v2- windows-rust-${{ runner.os }}-v2-
windows-rust-tools-v1-
cargo-registry-${{ runner.os }}-
@@ -9,7 +9,22 @@ inputs:
runs: runs:
using: composite using: composite
steps: steps:
- uses: actions/cache/save@v5 - name: Save Android Gradle build cache
if: inputs.scope == 'android'
uses: actions/cache/save@v5
continue-on-error: true
with:
key: gradle-build-${{ runner.os }}-${{ runner.arch }}-v2-${{ inputs.scope }}-${{ hashFiles('gradle/libs.versions.toml', 'settings.gradle.kts', 'gradle.properties', 'build.gradle.kts', 'app/desktop/build.gradle.kts', 'app/desktop/proguard-rules.pro', 'app/shared/build.gradle.kts', 'app/android/build.gradle.kts', 'utils/shared/build.gradle.kts', 'utils/android/build.gradle.kts') }}
path: |
.gradle
build
app/shared/build
app/android/build
utils/shared/build
utils/android/build
- name: Save Gradle build cache
if: inputs.scope != 'android'
uses: actions/cache/save@v5
continue-on-error: true continue-on-error: true
with: with:
key: gradle-build-${{ runner.os }}-${{ runner.arch }}-v2-${{ inputs.scope }}-${{ hashFiles('gradle/libs.versions.toml', 'settings.gradle.kts', 'gradle.properties', 'build.gradle.kts', 'app/desktop/build.gradle.kts', 'app/desktop/proguard-rules.pro', 'app/shared/build.gradle.kts', 'app/android/build.gradle.kts', 'utils/shared/build.gradle.kts', 'utils/android/build.gradle.kts') }} key: gradle-build-${{ runner.os }}-${{ runner.arch }}-v2-${{ inputs.scope }}-${{ hashFiles('gradle/libs.versions.toml', 'settings.gradle.kts', 'gradle.properties', 'build.gradle.kts', 'app/desktop/build.gradle.kts', 'app/desktop/proguard-rules.pro', 'app/shared/build.gradle.kts', 'app/android/build.gradle.kts', 'utils/shared/build.gradle.kts', 'utils/android/build.gradle.kts') }}
@@ -7,7 +7,7 @@ runs:
- uses: actions/cache/save@v5 - uses: actions/cache/save@v5
continue-on-error: true continue-on-error: true
with: 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') }} key: windows-rust-${{ runner.os }}-v3-${{ hashFiles('app/desktop/windows-setup/Cargo.lock') }}
path: | path: |
~/.cargo/registry ~/.cargo/registry
~/.cargo/git ~/.cargo/git
+3 -1
View File
@@ -28,7 +28,7 @@ on:
default: "false" default: "false"
concurrency: concurrency:
group: release-${{ github.ref }} group: release
cancel-in-progress: true cancel-in-progress: true
env: env:
@@ -414,6 +414,8 @@ jobs:
id: gradle-build-cache id: gradle-build-cache
with: with:
scope: android scope: android
- name: Prepare Android SDK cache dirs
run: mkdir -p ~/.android/build-cache ~/.android/cache
- name: Cache Android SDK extras - name: Cache Android SDK extras
uses: actions/cache@v5 uses: actions/cache@v5
with: with: