From 2df03e8eb3cb284b118dbc556f16e93f486f2485 Mon Sep 17 00:00:00 2001 From: denis0001-dev Date: Mon, 14 Sep 2026 01:13:49 +0300 Subject: [PATCH] Fix Gradle build cache save races with restore-only on parallel jobs. Co-authored-by: Cursor --- .github/actions/cache-gradle-build/action.yml | 7 +++++++ .github/workflows/release.yml | 12 ++++++++++++ 2 files changed, 19 insertions(+) diff --git a/.github/actions/cache-gradle-build/action.yml b/.github/actions/cache-gradle-build/action.yml index 755293b..26a9190 100644 --- a/.github/actions/cache-gradle-build/action.yml +++ b/.github/actions/cache-gradle-build/action.yml @@ -1,6 +1,12 @@ name: Cache Gradle build directories description: Restore or save module build/ trees for faster CI Gradle jobs +inputs: + save: + description: Save cache at job end. Use false on parallel jobs that share the same cache key. + required: false + default: "true" + outputs: cache-hit: description: Whether build directories were restored from cache @@ -12,6 +18,7 @@ runs: - uses: actions/cache@v5 id: cache with: + lookup-only: ${{ inputs.save != 'true' }} path: | app/desktop/build app/shared/build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6fafc6f..870a6c9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -86,6 +86,8 @@ jobs: version: ${{ needs.resolve-version.outputs.version }} - uses: ./.github/actions/cache-gradle-build id: gradle-build-cache + with: + save: "true" - name: Compile and ProGuard release desktop jars if: steps.gradle-build-cache.outputs.cache-hit != 'true' run: ./gradlew :app:desktop:exportReleaseProguardForCi --no-daemon --console=plain @@ -108,6 +110,8 @@ jobs: with: version: ${{ needs.resolve-version.outputs.version }} - uses: ./.github/actions/cache-gradle-build + with: + save: "true" - uses: dtolnay/rust-toolchain@stable with: targets: x86_64-pc-windows-msvc @@ -165,6 +169,8 @@ jobs: with: version: ${{ needs.resolve-version.outputs.version }} - uses: ./.github/actions/cache-gradle-build + with: + save: "false" - uses: actions/download-artifact@v5 with: name: desktop-proguard @@ -221,6 +227,8 @@ jobs: with: version: ${{ needs.resolve-version.outputs.version }} - uses: ./.github/actions/cache-gradle-build + with: + save: ${{ matrix.arch == 'arm64' }} - uses: actions/download-artifact@v5 with: name: desktop-proguard @@ -277,6 +285,8 @@ jobs: with: version: ${{ needs.resolve-version.outputs.version }} - uses: ./.github/actions/cache-gradle-build + with: + save: ${{ matrix.arch == 'arm64' }} - uses: actions/download-artifact@v5 with: name: desktop-proguard @@ -320,6 +330,8 @@ jobs: with: version: ${{ needs.resolve-version.outputs.version }} - uses: ./.github/actions/cache-gradle-build + with: + save: "false" - name: Cache Android SDK extras uses: actions/cache@v5 with: