ci(cache): save only tools/android/build-jar gradle scopes

Packaging scopes' build trees (1.3-2 GB each, 6 scopes) were ~90% installer
outputs and jlink runtime duplicates that actions/cache negation patterns
are unable to exclude (actions/toolkit#713). Saving ~7 GB per run kept the
repo at the 10 GB cache cap and LRU-evicted build-jar/android/windows-rust
entries within minutes of being saved. Packaging scopes are now
restore-only: they fall back to the build-jar scope via restore-keys, and
their outputs regenerate from the JAR artifact in a couple of minutes.

Also remove the temporary cache-inspect workflow (purpose served).
This commit is contained in:
2026-10-20 03:25:09 +03:00
Unverified
parent 5be76be12f
commit 9c71bcf4e7
3 changed files with 21 additions and 223 deletions
@@ -75,6 +75,10 @@ runs:
# 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.
path: |
.gradle
build
@@ -42,8 +42,23 @@ runs:
!app/desktop/build/distributions
!app/desktop/build/ci
!app/desktop/build/compose/binaries
- name: Save Gradle build cache
if: inputs.scope != 'android' && inputs.scope != 'build-jar'
# Restore-only for the desktop packaging scopes (linux-*, windows-package-*,
# macos-*): measurements showed their build trees are ~1.3–2 GB each and are
# dominated by installer outputs (deb/rpm/AppImage/DMG/Setup.exe), the jpackage
# runtime image copied up to four times, and staged ProGuard jars — all of which
# regenerate from the Build JAR artifact in a few minutes. Saving six 1.3–2 GB
# entries per run kept the repo pinned at the 10 GB cache cap and LRU-evicted
# the entries that actually matter (build-jar, android, windows-rust) within
# minutes. Their restores now fall back to the build-jar scope via restore-keys.
# (Note: actions/cache negated path patterns cannot exclude subtrees of an
# included parent directory — actions/toolkit#713 — so "!distributions" style
# exclusions are no-ops here; not saving at all is the only reliable trim.)
- name: Save Gradle build cache (windows-tools only)
if: >-
inputs.scope != 'android' && inputs.scope != 'build-jar' &&
!startsWith(inputs.scope, 'linux-') &&
!startsWith(inputs.scope, 'windows-package-') &&
!startsWith(inputs.scope, 'macos-')
uses: actions/cache/save@v5
continue-on-error: true
with:
-221
View File
@@ -1,221 +0,0 @@
# TEMPORARY diagnostic workflow: restore the current caches onto runners using
# their EXACT original path lists (actions/cache stamps entries with a version
# hash of the path list — restoring to different paths would never match) and
# report their on-disk composition (du). Delete once cache trimming is done.
name: Cache inspect
on:
push:
branches:
- feature/desktop
workflow_dispatch:
permissions:
contents: read
concurrency:
group: cache-inspect
cancel-in-progress: true
jobs:
resolve-keys:
runs-on: ubuntu-latest
outputs:
linux_x64: ${{ steps.k.outputs.linux_x64 }}
android: ${{ steps.k.outputs.android }}
build_jar: ${{ steps.k.outputs.build_jar }}
windows_x64: ${{ steps.k.outputs.windows_x64 }}
rust_x64: ${{ steps.k.outputs.rust_x64 }}
macos_arm: ${{ steps.k.outputs.macos_arm }}
steps:
- id: k
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
gh api repos/"$GITHUB_REPOSITORY"/actions/caches?per_page=100 > caches.json
python3 - <<'PY' >> "$GITHUB_OUTPUT"
import json, re
data = json.load(open('caches.json'))
pats = {
'linux_x64': r'gradle-build-Linux-X64-v2-linux-x64-[0-9a-f]{60}',
'android': r'gradle-build-Linux-X64-v2-android-[0-9a-f]{60}',
'build_jar': r'gradle-build-Linux-X64-v2-build-jar-[0-9a-f]{60}',
'windows_x64': r'gradle-build-Windows-X64-v2-windows-package-x64-[0-9a-f]{60}',
'rust_x64': r'windows-rust-Windows-X64-v5-[0-9a-f]{60}',
'macos_arm': r'gradle-build-macOS-ARM64-v2-macos-arm64-[0-9a-f]{60}',
}
for fam, pat in pats.items():
sel = next((c for c in data.get('actions_caches', data.get('caches', []))
if re.match(pat, c.get('cache_key', c.get('key', '')))), None)
k = (sel.get('cache_key') or sel.get('key')) if sel else ''
print(fam + '=' + k)
PY
cat "$GITHUB_OUTPUT"
linux-x64:
needs: resolve-keys
if: needs.resolve-keys.outputs.linux_x64 != ''
runs-on: ubuntu-latest
steps:
- uses: actions/cache/restore@v5
with:
key: ${{ needs.resolve-keys.outputs.linux_x64 }}
path: |
.gradle
build
app/shared/build
utils/shared/build
app/desktop/build
!app/desktop/build/distributions
!app/desktop/build/ci
!app/desktop/build/compose/binaries
!app/desktop/build/compose/tmp
- name: du
run: |
{
echo "== top dirs"
du -h -d 2 .gradle build app 2>/dev/null | sort -h | tail -35
echo "== biggest files"
find .gradle build app -type f -exec du -sm {} + 2>/dev/null | sort -rn | head -20
} | tee du.txt
- uses: actions/upload-artifact@v5
with: {name: du-linux-x64, path: du.txt, retention-days: 3}
android:
needs: resolve-keys
if: needs.resolve-keys.outputs.android != ''
runs-on: ubuntu-latest
steps:
- uses: actions/cache/restore@v5
with:
key: ${{ needs.resolve-keys.outputs.android }}
path: |
.gradle
build
app/shared/build
app/android/build
utils/shared/build
utils/android/build
!app/android/build/outputs
- name: du
run: |
{
echo "== top dirs"
du -h -d 2 .gradle build app utils 2>/dev/null | sort -h | tail -30
echo "== biggest files"
find .gradle build app utils -type f -exec du -sm {} + 2>/dev/null | sort -rn | head -20
} | tee du.txt
- uses: actions/upload-artifact@v5
with: {name: du-android, path: du.txt, retention-days: 3}
build-jar:
needs: resolve-keys
if: needs.resolve-keys.outputs.build_jar != ''
runs-on: ubuntu-latest
steps:
- uses: actions/cache/restore@v5
with:
key: ${{ needs.resolve-keys.outputs.build_jar }}
path: |
.gradle
build
app/shared/build
utils/shared/build
app/desktop/build
!app/desktop/build/distributions
!app/desktop/build/ci
!app/desktop/build/compose/binaries
- name: du
run: |
{
echo "== top dirs"
du -h -d 2 .gradle build app 2>/dev/null | sort -h | tail -35
echo "== biggest files"
find .gradle build app -type f -exec du -sm {} + 2>/dev/null | sort -rn | head -20
} | tee du.txt
- uses: actions/upload-artifact@v5
with: {name: du-build-jar, path: du.txt, retention-days: 3}
windows-package-x64:
needs: resolve-keys
if: needs.resolve-keys.outputs.windows_x64 != ''
runs-on: windows-latest
steps:
- uses: actions/cache/restore@v5
with:
key: ${{ needs.resolve-keys.outputs.windows_x64 }}
path: |
.gradle
build
app/shared/build
utils/shared/build
app/desktop/build
!app/desktop/build/distributions
!app/desktop/build/ci
!app/desktop/build/compose/binaries
!app/desktop/build/compose/tmp
- name: du
shell: bash
run: |
{
echo "== top dirs"
du -h -d 2 .gradle build app 2>/dev/null | sort -h | tail -35
echo "== biggest files"
find .gradle build app -type f -exec du -sm {} + 2>/dev/null | sort -rn | head -20
} | tee du.txt
- uses: actions/upload-artifact@v5
with: {name: du-windows-package-x64, path: du.txt, retention-days: 3}
rust-x64:
needs: resolve-keys
if: needs.resolve-keys.outputs.rust_x64 != ''
runs-on: windows-latest
steps:
- uses: actions/cache/restore@v5
with:
key: ${{ needs.resolve-keys.outputs.rust_x64 }}
path: |
~/.cargo/registry
~/.cargo/git
app/desktop/windows-setup/target
- name: du
shell: bash
run: |
{
echo "== top dirs"
du -h -d 2 ~/.cargo app/desktop/windows-setup/target 2>/dev/null | sort -h | tail -30
echo "== biggest files"
find ~/.cargo app/desktop/windows-setup/target -type f -exec du -sm {} + 2>/dev/null | sort -rn | head -20
} | tee du.txt
- uses: actions/upload-artifact@v5
with: {name: du-rust-x64, path: du.txt, retention-days: 3}
macos-arm64:
needs: resolve-keys
if: needs.resolve-keys.outputs.macos_arm != ''
runs-on: macos-latest
steps:
- uses: actions/cache/restore@v5
with:
key: ${{ needs.resolve-keys.outputs.macos_arm }}
path: |
.gradle
build
app/shared/build
utils/shared/build
app/desktop/build
!app/desktop/build/distributions
!app/desktop/build/ci
!app/desktop/build/compose/binaries
!app/desktop/build/compose/tmp
- name: du
run: |
{
echo "== top dirs"
du -h -d 2 .gradle build app 2>/dev/null | sort -h | tail -35
echo "== biggest files"
find .gradle build app -type f -exec du -sm {} + 2>/dev/null | sort -rn | head -20
} | tee du.txt
- uses: actions/upload-artifact@v5
with: {name: du-macos-arm64, path: du.txt, retention-days: 3}