Skip to content

Commit 0c06de9

Browse files
authored
perf(ci): carry Android Gradle caches on a Blacksmith sticky disk (#109605)
* perf(ci): carry Android Gradle caches on a Blacksmith sticky disk The android lane's setup-java gradle cache almost never restores under the repo's churned GitHub cache quota, so every run re-resolves the full dependency graph (~501s observed for android-build-play). Mount a task-scoped Blacksmith sticky disk at /var/tmp/openclaw-gradle and point GRADLE_USER_HOME at it for same-repo non-fork non-dispatch runs, mirroring the extension-boundary sticky pattern (per-PR-or-protected key, commit: if-missing, identical trust gate). Fork PRs and manual dispatches keep the existing GitHub cache path and non-Blacksmith runners. * fix(ci): let the Gradle sticky snapshot keep learning Autoreview P2: if-missing froze the snapshot at first hydration, so later build-cache entries never persisted. on-change commits when the filesystem changed; content-addressed entries and task-scoped keys keep it race-safe.
1 parent b1541c9 commit 0c06de9

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2999,6 +2999,40 @@ jobs:
29992999
# workflow-owned as before. Load them from the workflow revision so old targets work.
30003000
uses: ./.ci-workflow/.github/actions/setup-android-toolchain
30013001

3002+
# Same-repo runs carry the Gradle user home (dependency, wrapper, and
3003+
# build caches) on a Blacksmith sticky disk: the setup-java gradle cache
3004+
# above is evicted so quickly under the repo quota that it rarely
3005+
# restores, leaving every run to re-resolve the full dependency graph.
3006+
# Fork PRs and manual dispatches must never produce writable
3007+
# repository-global snapshots, so they keep the GitHub cache path (their
3008+
# runs-on already selects non-Blacksmith ubuntu-24.04 runners).
3009+
- name: Mount Gradle sticky disk
3010+
if: github.event_name != 'workflow_dispatch' && github.repository == 'openclaw/openclaw' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'openclaw/openclaw')
3011+
uses: useblacksmith/stickydisk@5b350170ae4ef55b536b548ef5f5896e76a6b54f # v1.4.0
3012+
with:
3013+
# Task-scoped keys keep one semantic writer per snapshot: each matrix
3014+
# task resolves a different dependency set, and a shared if-missing
3015+
# key would let a light task (ktlint) win the cold-key race and pin a
3016+
# thin snapshot the heavy build lanes can never repair. Gradle's own
3017+
# caches are content-addressed, so stale restored entries are ignored
3018+
# and dependency-file changes mint a fresh key/snapshot.
3019+
key: ${{ github.repository }}-gradle-v1-${{ matrix.task }}-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || 'protected' }}-${{ hashFiles('apps/android/**/*.gradle*', 'apps/android/**/gradle-wrapper.properties', 'apps/android/gradle/libs.versions.toml') }}
3020+
path: /var/tmp/openclaw-gradle
3021+
# on-change keeps the snapshot learning: Gradle's build cache
3022+
# accumulates across runs (if-missing would freeze the first
3023+
# hydration forever). Entries are content-addressed, task-scoped
3024+
# keys give one semantic writer, and v1.4.0 still skips commit
3025+
# after failed/cancelled steps.
3026+
commit: on-change
3027+
3028+
- name: Point Gradle at the sticky disk
3029+
if: github.event_name != 'workflow_dispatch' && github.repository == 'openclaw/openclaw' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'openclaw/openclaw')
3030+
shell: bash
3031+
run: |
3032+
set -euo pipefail
3033+
mkdir -p /var/tmp/openclaw-gradle/gradle-user-home
3034+
echo "GRADLE_USER_HOME=/var/tmp/openclaw-gradle/gradle-user-home" >> "$GITHUB_ENV"
3035+
30023036
- name: Run Android ${{ matrix.task }}
30033037
working-directory: apps/android
30043038
env:

0 commit comments

Comments
 (0)