chore(ci): stop writing caches nothing reads, and cache the Maven wrapper (#8956)

* chore(ci): stop writing caches nothing reads, and cache the Maven wrapper
This commit is contained in:
Hector Ventura authored and GitHub committed 2026-11-19 08:30:56 -04:00
1 parent 69b80fb353
commit 02f03172b4
6 files changed
+155 -23

No files matched your search

+7
View File
@@ -54,6 +54,13 @@ jobs:
restore-keys: |
maven-${{ runner.os }}-
# The Maven distribution ./mvnw runs, saved by ci.yml on main, so this job does not fetch it from
# Maven Central with the wrapper's one unretried wget.
- uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.m2/wrapper
key: maven-wrapper-${{ runner.os }}-${{ hashFiles('.mvn/wrapper/maven-wrapper.properties') }}
- name: Run Checkstyle
run: ./mvnw -B checkstyle:check
+60 -2
View File
@@ -80,13 +80,24 @@ jobs:
# Restore on every shard; save from shard 1 only. With a combined cache step
# every shard would race the same save key: one wins, the rest spend
# post-job time reserving-then-failing plus redundant multi-hundred-MB uploads.
- uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
- id: maven-cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.m2/repository
key: maven-${{ runner.os }}-${{ hashFiles('pom.xml') }}
restore-keys: |
maven-${{ runner.os }}-
# The Maven distribution ./mvnw runs. Without it every shard downloads Maven from Maven
# Central with one unretried wget, and a failed fetch fails the shard at Compile. Its own
# cache, because the restore path is part of the cache version: adding it to the repository
# cache above would make every reader of that key miss.
- id: maven-wrapper-cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.m2/wrapper
key: maven-wrapper-${{ runner.os }}-${{ hashFiles('.mvn/wrapper/maven-wrapper.properties') }}
# Derived from test sources, not target/test-classes, so shard.txt exists
# before Compile and the image prefetch below overlaps the compile instead
# of starting moments before the tests that need the images. Every test is
@@ -174,12 +185,24 @@ jobs:
# restore-keys prefix for the bulk, and re-downloads its delta on each re-run
# rather than caching it. pom.xml changed 21 times in 30 days, so that is a
# small minority of PRs paying a small delta.
#
# Skipped on an exact hit: the key is immutable, so saving it again only fails to reserve it.
- uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
if: always() && matrix.shard == 1 && github.event_name == 'push'
if: >-
always() && matrix.shard == 1 && github.event_name == 'push'
&& steps.maven-cache.outputs.cache-hit != 'true'
with:
path: ~/.m2/repository
key: maven-${{ runner.os }}-${{ hashFiles('pom.xml') }}
- uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
if: >-
always() && matrix.shard == 1 && github.event_name == 'push'
&& steps.maven-wrapper-cache.outputs.cache-hit != 'true'
with:
path: ~/.m2/wrapper
key: maven-wrapper-${{ runner.os }}-${{ hashFiles('.mvn/wrapper/maven-wrapper.properties') }}
- name: Upload shard manifest and results
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
@@ -196,6 +219,41 @@ jobs:
# to two shards, or any class assigned to none - checked against the same
# commit's own class list, never a hardcoded count. Intended to become the one
# required status check; its name stays stable across re-sharding.
# Each pom.xml change saves a new ~700 MB Maven cache and leaves the previous one behind
# until GitHub evicts something, so after a push to main this deletes every maven-Linux-*
# entry but the current pom's, once that one exists. Its own job, so only this one holds
# the actions: write token, and only on main.
prune-maven-cache:
name: Prune superseded Maven caches
needs: test
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
actions: write
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
sparse-checkout: pom.xml
sparse-checkout-cone-mode: false
- name: Delete maven-Linux caches other than the current pom's
env:
GH_TOKEN: ${{ github.token }}
KEEP: maven-Linux-${{ hashFiles('pom.xml') }}
run: |
set -euo pipefail
keys=$(gh cache list --repo "$GITHUB_REPOSITORY" --key maven-Linux- --limit 100 --json id,key)
if ! jq -e --arg keep "$KEEP" 'any(.[]; .key == $keep)' <<<"$keys" >/dev/null; then
echo "The current pom's cache ($KEEP) is not saved yet; keeping the older ones."
exit 0
fi
jq -r --arg keep "$KEEP" '.[] | select(.key != $keep) | "\(.id) \(.key)"' <<<"$keys" \
| while read -r id key; do
echo "Deleting superseded cache $key"
gh cache delete "$id" --repo "$GITHUB_REPOSITORY"
done
ci-summary:
name: CI summary
runs-on: ubuntu-latest
+8 -1
View File
@@ -210,6 +210,13 @@ jobs:
key: maven-${{ runner.os }}-${{ hashFiles('pom.xml') }}
restore-keys: maven-${{ runner.os }}-
# The Maven distribution ./mvnw runs, saved by ci.yml on main, so this job does not fetch it from
# Maven Central with the wrapper's one unretried wget.
- uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.m2/wrapper
key: maven-wrapper-${{ runner.os }}-${{ hashFiles('.mvn/wrapper/maven-wrapper.properties') }}
- name: Build native executable (quick build)
# Quarkus 3.39 switches on -H:+AOTSingleCallsiteInline for Mandrel 25.0.4+. The generated
# REST invokers for AwsQueryController.dispatch and AwsJson11Controller.handle are each the
@@ -218,7 +225,7 @@ jobs:
# The flag only exists on Mandrel, so it is passed here rather than in application.yml.
# maven.test.skip rather than skipTests: skipTests only stops surefire, so the build still
# compiled all of src/test (about 25s per arch) for a native image that never uses it.
run: mvn clean package -Dnative -Dmaven.test.skip=true -B -Dquarkus.native.additional-build-args-append="-Ob,-H:-AOTSingleCallsiteInline"
run: ./mvnw clean package -Dnative -Dmaven.test.skip=true -B -Dquarkus.native.additional-build-args-append="-Ob,-H:-AOTSingleCallsiteInline"
# Quarkus always writes GraalVM's build-output JSON next to the native source jar. Surfacing
# it here gives every PR a size record for both architectures: code area, image heap, total
+8
View File
@@ -95,6 +95,14 @@ jobs:
restore-keys: |
maven-${{ runner.os }}-
# The Maven distribution ./mvnw runs, saved by ci.yml on main, so this job does not fetch it from
# Maven Central with the wrapper's one unretried wget.
- if: steps.list.outputs.count != '0'
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.m2/wrapper
key: maven-wrapper-${{ runner.os }}-${{ hashFiles('.mvn/wrapper/maven-wrapper.properties') }}
- name: Prefetch the checks' Docker images (background)
if: steps.list.outputs.count != '0'
run: .github/ci/prefetch-images.sh nightly.txt || true
+18 -8
View File
@@ -78,8 +78,15 @@ jobs:
key: maven-${{ runner.os }}-${{ hashFiles('pom.xml') }}
restore-keys: maven-${{ runner.os }}-
# The Maven distribution ./mvnw runs, saved by ci.yml on main, so this job does not fetch it from
# Maven Central with the wrapper's one unretried wget.
- uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.m2/wrapper
key: maven-wrapper-${{ runner.os }}-${{ hashFiles('.mvn/wrapper/maven-wrapper.properties') }}
- name: Set nightly version
run: mvn versions:set -DnewVersion="nightly-${{ needs.prepare.outputs.version }}" -DgenerateBackupPoms=false -q
run: ./mvnw versions:set -DnewVersion="nightly-${{ needs.prepare.outputs.version }}" -DgenerateBackupPoms=false -q
- name: Build native executable
# Quarkus 3.39 switches on -H:+AOTSingleCallsiteInline for Mandrel 25.0.4+. The generated
@@ -87,7 +94,7 @@ jobs:
# single call site of a very large method; inlined, the method outgrows the aarch64
# conditional-branch range and the build dies with BranchTargetOutOfBoundsException.
# The flag only exists on Mandrel, so it is passed here rather than in application.yml.
run: mvn clean package -Dnative -DskipTests -B -Dquarkus.native.additional-build-args-append="-march=x86-64-v2,-H:-AOTSingleCallsiteInline"
run: ./mvnw clean package -Dnative -DskipTests -B -Dquarkus.native.additional-build-args-append="-march=x86-64-v2,-H:-AOTSingleCallsiteInline"
- name: Check the x86-64 ISA level of the binary
# The image must run on x86-64-v2 CPUs. The runner's CPU has v3, so starting the binary
@@ -140,8 +147,15 @@ jobs:
key: maven-${{ runner.os }}-${{ hashFiles('pom.xml') }}
restore-keys: maven-${{ runner.os }}-
# The Maven distribution ./mvnw runs, saved by ci.yml on main, so this job does not fetch it from
# Maven Central with the wrapper's one unretried wget.
- uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.m2/wrapper
key: maven-wrapper-${{ runner.os }}-${{ hashFiles('.mvn/wrapper/maven-wrapper.properties') }}
- name: Set nightly version
run: mvn versions:set -DnewVersion="nightly-${{ needs.prepare.outputs.version }}" -DgenerateBackupPoms=false -q
run: ./mvnw versions:set -DnewVersion="nightly-${{ needs.prepare.outputs.version }}" -DgenerateBackupPoms=false -q
- name: Build native executable
# Quarkus 3.39 switches on -H:+AOTSingleCallsiteInline for Mandrel 25.0.4+. The generated
@@ -149,7 +163,7 @@ jobs:
# single call site of a very large method; inlined, the method outgrows the aarch64
# conditional-branch range and the build dies with BranchTargetOutOfBoundsException.
# The flag only exists on Mandrel, so it is passed here rather than in application.yml.
run: mvn clean package -Dnative -DskipTests -B -Dquarkus.native.additional-build-args-append="-H:-AOTSingleCallsiteInline"
run: ./mvnw clean package -Dnative -DskipTests -B -Dquarkus.native.additional-build-args-append="-H:-AOTSingleCallsiteInline"
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
@@ -235,8 +249,6 @@ jobs:
version=nightly-${{ needs.prepare.outputs.version }}
build-date=${{ steps.created.outputs.created }}
vcs-ref=${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and push compat nightly image
uses: ./.github/actions/push-zstd-image
@@ -258,5 +270,3 @@ jobs:
version=nightly-${{ needs.prepare.outputs.version }}
build-date=${{ steps.created.outputs.created }}
vcs-ref=${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
+54 -12
View File
@@ -49,16 +49,32 @@ jobs:
with:
java-version: '25'
distribution: 'mandrel'
cache: maven
# no `cache: maven`: a cache saved on a tag can only be read by that tag, so every release
# wrote one no later run could use. Main's copy is restored below instead.
github-token: ${{ secrets.GITHUB_TOKEN }}
# Restore-only: ci.yml saves main's ~/.m2, which a tag run may read. The tag's pom carries the
# release version, so the exact key misses and the newest main copy comes back by prefix.
- uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.m2/repository
key: maven-${{ runner.os }}-${{ hashFiles('pom.xml') }}
restore-keys: maven-${{ runner.os }}-
# The Maven distribution ./mvnw runs, saved by ci.yml on main, so this job does not fetch it from
# Maven Central with the wrapper's one unretried wget.
- uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.m2/wrapper
key: maven-wrapper-${{ runner.os }}-${{ hashFiles('.mvn/wrapper/maven-wrapper.properties') }}
- name: Build native executable
# Quarkus 3.39 switches on -H:+AOTSingleCallsiteInline for Mandrel 25.0.4+. The generated
# REST invokers for AwsQueryController.dispatch and AwsJson11Controller.handle are each the
# single call site of a very large method; inlined, the method outgrows the aarch64
# conditional-branch range and the build dies with BranchTargetOutOfBoundsException.
# The flag only exists on Mandrel, so it is passed here rather than in application.yml.
run: mvn clean package -Dnative -DskipTests -B -Dquarkus.native.additional-build-args-append="-march=x86-64-v2,-H:-AOTSingleCallsiteInline"
run: ./mvnw clean package -Dnative -DskipTests -B -Dquarkus.native.additional-build-args-append="-march=x86-64-v2,-H:-AOTSingleCallsiteInline"
- name: Check the x86-64 ISA level of the binary
# The image and the release asset must run on x86-64-v2 CPUs. The runner's CPU has v3, so
@@ -101,16 +117,32 @@ jobs:
with:
java-version: '25'
distribution: 'mandrel'
cache: maven
# no `cache: maven`: a cache saved on a tag can only be read by that tag, so every release
# wrote one no later run could use. Main's copy is restored below instead.
github-token: ${{ secrets.GITHUB_TOKEN }}
# Restore-only: ci.yml saves main's ~/.m2, which a tag run may read. The tag's pom carries the
# release version, so the exact key misses and the newest main copy comes back by prefix.
- uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.m2/repository
key: maven-${{ runner.os }}-${{ hashFiles('pom.xml') }}
restore-keys: maven-${{ runner.os }}-
# The Maven distribution ./mvnw runs, saved by ci.yml on main, so this job does not fetch it from
# Maven Central with the wrapper's one unretried wget.
- uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.m2/wrapper
key: maven-wrapper-${{ runner.os }}-${{ hashFiles('.mvn/wrapper/maven-wrapper.properties') }}
- name: Build native executable
# Quarkus 3.39 switches on -H:+AOTSingleCallsiteInline for Mandrel 25.0.4+. The generated
# REST invokers for AwsQueryController.dispatch and AwsJson11Controller.handle are each the
# single call site of a very large method; inlined, the method outgrows the aarch64
# conditional-branch range and the build dies with BranchTargetOutOfBoundsException.
# The flag only exists on Mandrel, so it is passed here rather than in application.yml.
run: mvn clean package -Dnative -DskipTests -B -Dquarkus.native.additional-build-args-append="-H:-AOTSingleCallsiteInline"
run: ./mvnw clean package -Dnative -DskipTests -B -Dquarkus.native.additional-build-args-append="-H:-AOTSingleCallsiteInline"
- name: Smoke-test the standalone binary
# The same binary is published as a release asset (publish-binaries), so it is checked
@@ -144,14 +176,30 @@ jobs:
with:
java-version: '25'
distribution: 'mandrel'
cache: maven
# no `cache: maven`: a cache saved on a tag can only be read by that tag, so every release
# wrote one no later run could use. Main's copy is restored below instead.
github-token: ${{ secrets.GITHUB_TOKEN }}
# Restore-only: ci.yml saves main's ~/.m2, which a tag run may read. The tag's pom carries the
# release version, so the exact key misses and the newest main copy comes back by prefix.
- uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.m2/repository
key: maven-${{ runner.os }}-${{ hashFiles('pom.xml') }}
restore-keys: maven-${{ runner.os }}-
# The Maven distribution ./mvnw runs, saved by ci.yml on main, so this job does not fetch it from
# Maven Central with the wrapper's one unretried wget.
- uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.m2/wrapper
key: maven-wrapper-${{ runner.os }}-${{ hashFiles('.mvn/wrapper/maven-wrapper.properties') }}
- name: Build ARMv8.0 baseline native executable
# Keep the normal arm64 artifact optimized as before. This additional release-only build
# targets ARMv8.0 explicitly so older cores such as Raspberry Pi 4's Cortex-A72 do not
# inherit optional AArch64 features (notably LSE) from the GitHub-hosted build runner.
run: mvn clean package -Dnative -DskipTests -B -Dquarkus.native.additional-build-args-append="-march=armv8-a,-H:-AOTSingleCallsiteInline"
run: ./mvnw clean package -Dnative -DskipTests -B -Dquarkus.native.additional-build-args-append="-march=armv8-a,-H:-AOTSingleCallsiteInline"
- name: Smoke-test the standalone binary
# The same binary is published as a release asset (publish-binaries), so it is checked
@@ -369,8 +417,6 @@ jobs:
version=${{ steps.version.outputs.version }}
build-date=${{ steps.created.outputs.created }}
vcs-ref=${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
# Ordering matters: this step wipes native/ and replaces it with the arm64-only
# baseline binary. It is safe only because it runs AFTER the multi-arch image
@@ -408,8 +454,6 @@ jobs:
version=${{ steps.version.outputs.version }}
build-date=${{ steps.created.outputs.created }}
vcs-ref=${{ github.sha }}
cache-from: type=gha,scope=floci-arm64-baseline
cache-to: type=gha,scope=floci-arm64-baseline,mode=max
- name: Build and push compat multi-arch image
id: compat
@@ -434,8 +478,6 @@ jobs:
version=${{ steps.version.outputs.version }}
build-date=${{ steps.created.outputs.created }}
vcs-ref=${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
# ── Sign the published images ────────────────────────────────────────────
# Kept out of push-native on purpose: a Fulcio or Rekor outage mid-push would