ci: restore ci.yml's maven cache in the compat native build (#2636)

setup-graalvm's `cache: maven` keys on setup-graalvm-Linux-maven-<hash>,
a key only this pull_request-only workflow ever writes. Actions caches
are ref-scoped, so every write landed in refs/pull/N/merge where no
other run could read it: build-native logged "maven cache is not found"
on 6 of 6 sampled runs while dutifully saving 211 MB each time.

That cost ~66s of cold dependency resolution — 1,398 "Downloading from"
lines — inside an 8.6m job that serially gates all eight compat legs.

ci.yml already saves ~/.m2/repository on every push to main under
maven-<os>-<hash(pom.xml)>. Restore that key here instead, read-only so
ci.yml stays the single writer and the two never race.

Expect most of the ~66s back rather than all of it: runner.os is Linux
on both sides but ci.yml runs x64 while this runs arm64, so
classifier-based native artifacts still re-download, and `-Dnative`
pulls native-image plugins that ci.yml's `mvn test` never fetches.

nightly.yml carries the same `cache: maven` and also misses, but for a
different reason — it saves to a main-scoped key daily and is evicted by
the repo's cache overrun rather than by ref-scoping. Left untouched; it
should recover once that overrun is resolved.
This commit is contained in:
Hector Ventura authored and GitHub committed 2026-08-27 18:45:01 -04:00
1 parent 7f6b875136
commit 273e62d17e
1 file changed
+20 -1
+20 -1
View File
@@ -92,9 +92,28 @@ jobs:
with:
java-version: '25'
distribution: 'mandrel'
cache: maven
# no `cache: maven` — it keys on setup-graalvm-Linux-maven-<hash>, which
# only this pull_request-only workflow ever writes. Actions caches are
# ref-scoped, so those writes land in refs/pull/N/merge and no run can
# read another's: it logged "maven cache is not found" on 6 of 6 sampled
# runs while dutifully saving 211 MB each time. Restore ci.yml's cache
# below instead, which push-to-main genuinely populates.
github-token: ${{ secrets.GITHUB_TOKEN }}
# Restore-only, and deliberately keyed identically to ci.yml:54-59 so this
# reads the ~/.m2 that ci.yml's shard 1 saves on every push to main. ci.yml
# stays the single owner of the save; a second writer would just race it.
# Two known partial-hit caveats, both cheap: `runner.os` is Linux for both
# but ci.yml runs x64 while this runs arm64 (Maven artifacts are
# arch-neutral, so only classifier-based natives re-download), and
# `-Dnative` pulls native-image plugins that ci.yml's `mvn test` never
# fetches. Expect most of the ~66s of cold resolution back, not all of it.
- uses: actions/cache/restore@v6.1.0
with:
path: ~/.m2/repository
key: maven-${{ runner.os }}-${{ hashFiles('pom.xml') }}
restore-keys: maven-${{ runner.os }}-
- name: Build native executable (quick build)
run: mvn clean package -Dnative -DskipTests -B -Dquarkus.native.additional-build-args-append="-Ob"