Skip to content

armgit / floci

Public Imported from GitHub
0

Light, fluffy, and always free - The AWS Local Emulator alternative

ci: give the nightly native builds a maven cache that can actually hit (#2724)

Hector Ventura5d0466780485
diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml
index 9837aee616..8029b40033 100644
--- a/.github/workflows/nightly.yml
+++ b/.github/workflows/nightly.yml
@@ -54,9 +54,26 @@ jobs:
with:
java-version: '25'
distribution: 'mandrel'
- cache: maven
+ # no `cache: maven` — it could never hit here. Its restore hashes the
+ # pristine pom.xml, but its post-job save runs *after* `versions:set`
+ # below has rewritten that pom, so the two keys never match. Worse, the
+ # nightly version embeds the date, so the save key changed every night:
+ # 08-28 saved ...0d0497deb231, 08-29 saved ...476d856e99e8. Nightly was
+ # writing 222 MB per job per night under a key nothing would ever read.
github-token: ${{ secrets.GITHUB_TOKEN }}
+ # Restore-only, keyed identically to ci.yml so this reads the ~/.m2 that
+ # ci.yml's shard 1 saves on every push to main. This job checks out `ref:
+ # main`, so the pristine pom hashed here matches the one ci.yml hashed —
+ # and restoring before `versions:set` keeps it that way. Nothing is saved:
+ # ci.yml is the single writer, and a save here would recreate the mutated-
+ # key garbage described above.
+ - uses: actions/cache/[email protected]
+ with:
+ path: ~/.m2/repository
+ key: maven-${{ runner.os }}-${{ hashFiles('pom.xml') }}
+ restore-keys: maven-${{ runner.os }}-
+
- name: Set nightly version
run: mvn versions:set -DnewVersion="nightly-${{ needs.prepare.outputs.version }}" -DgenerateBackupPoms=false -q
@@ -89,9 +106,26 @@ jobs:
with:
java-version: '25'
distribution: 'mandrel'
- cache: maven
+ # no `cache: maven` — it could never hit here. Its restore hashes the
+ # pristine pom.xml, but its post-job save runs *after* `versions:set`
+ # below has rewritten that pom, so the two keys never match. Worse, the
+ # nightly version embeds the date, so the save key changed every night:
+ # 08-28 saved ...0d0497deb231, 08-29 saved ...476d856e99e8. Nightly was
+ # writing 222 MB per job per night under a key nothing would ever read.
github-token: ${{ secrets.GITHUB_TOKEN }}
+ # Restore-only, keyed identically to ci.yml so this reads the ~/.m2 that
+ # ci.yml's shard 1 saves on every push to main. This job checks out `ref:
+ # main`, so the pristine pom hashed here matches the one ci.yml hashed —
+ # and restoring before `versions:set` keeps it that way. Nothing is saved:
+ # ci.yml is the single writer, and a save here would recreate the mutated-
+ # key garbage described above.
+ - uses: actions/cache/[email protected]
+ with:
+ path: ~/.m2/repository
+ key: maven-${{ runner.os }}-${{ hashFiles('pom.xml') }}
+ restore-keys: maven-${{ runner.os }}-
+
- name: Set nightly version
run: mvn versions:set -DnewVersion="nightly-${{ needs.prepare.outputs.version }}" -DgenerateBackupPoms=false -q