ci(cache): unify gradle-build path lists so restore-keys cross-hit

Restores differ per path list: actions/cache computes a version stamp from
the path list and only matches restore-keys via a version stamp (hash of
the path list): entries with different path lists are invisible to each
other's restore-keys, even with a shared key prefix. The build-jar scope
kept compose/tmp while the generic list negated it, so the
'-v2-build-jar-' fallback never matched for packaging scopes (measured in
run 39349881796: 'Cache not found' listing the fallback prefix). Drop the
ineffective '!*/compose/tmp' negation (no-op at save time anyway per
actions/toolkit#713) so all non-android scopes share one version stamp;
packaging restores now warm from the build-jar entry.
This commit is contained in:
2026-10-20 09:41:21 +03:00
Unverified
parent 9c71bcf4e7
commit 32c68d330c
2 changed files with 16 additions and 11 deletions
+10 -10
View File
@@ -70,15 +70,16 @@ runs:
if: inputs.scope != 'android' && inputs.scope != 'build-jar'
id: cache
with:
# Desktop packaging scopes never build Android and never run ProGuard — they stage the
# Build JAR artifact's jars instead — so their copy of compose/tmp is redundant and is not
# archived. Everything else here is either regenerated per version (distributions, the
# exported jars, the jpackage runtime image) or irrelevant (Android modules): archiving
# them is what pushed this repo past the 10 GB limit and into eviction.
# WARNING: the negations below are no-ops with actions/cache — included directories are
# tared whole and negated subtrees cannot be carved out (actions/toolkit#713). The real
# trim is done by not saving the packaging scopes at all (see save-gradle-build-cache);
# restore still falls back through the prefixes below to the build-jar scope.
# All non-android scopes must share ONE identical path list: actions/cache matches
# restore-keys only among entries with the same version stamp (a hash of the path
# list), so a build-jar entry can only warm a packaging job's restore if both lists
# are byte-identical. compose/tmp stays included everywhere: it holds ProGuard's
# output jars (~50-100 MB), which package jobs re-stage, and is small next to what
# a working cross-scope fallback saves in time. (Note: negations like
# "!app/desktop/build/distributions" are no-ops with actions/cache — included
# directories are tared whole and negated subtrees cannot be carved out,
# actions/toolkit#713; the real trim is done by not saving the packaging scopes at
# all, see save-gradle-build-cache.)
path: |
.gradle
build
@@ -88,7 +89,6 @@ runs:
!app/desktop/build/distributions
!app/desktop/build/ci
!app/desktop/build/compose/binaries
!app/desktop/build/compose/tmp
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 }}-
@@ -59,6 +59,12 @@ runs:
!startsWith(inputs.scope, 'linux-') &&
!startsWith(inputs.scope, 'windows-package-') &&
!startsWith(inputs.scope, 'macos-')
# Path list must stay byte-identical to the generic restore list in
# cache-gradle-build: actions/cache refuses to save when the restore and save
# paths differ, and the version stamp (hash of the path list) gates any later
# restore — including cross-scope restore-key fallbacks. compose/tmp is kept
# here on purpose (holds ProGuard's output jars; small); see the matching
# comment in cache-gradle-build.
uses: actions/cache/save@v5
continue-on-error: true
with:
@@ -72,4 +78,3 @@ runs:
!app/desktop/build/distributions
!app/desktop/build/ci
!app/desktop/build/compose/binaries
!app/desktop/build/compose/tmp