This is an automated email from the ASF dual-hosted git repository. jdaugherty pushed a commit to branch 8.0.x in repository https://gitbox.apache.org/repos/asf/grails-core.git
commit 143505757121098418f8db858e2263b3d8835e4e Author: James Daugherty <[email protected]> AuthorDate: Wed Oct 14 21:12:50 2026 +0100 Save the mongod download only from the default branch The embedded MongoDB tests cache the mongod they download with a combined actions/cache step, which saves on whichever branch or pull request misses, so every release branch and pull request kept its own copy of the same 150 to 275 MB download. The download is identical on every branch, and every branch can restore the default branch's entries, so the step is split: it restores everywhere, and a separate save step after the tests runs only on a successful push to the default branch that missed. The rule compares against the repository's default branch, so it needs no change when a new one is promoted. AGENTS.md's Gradle caching section records it. --- .github/workflows/gradle.yml | 13 +++++++++++-- .github/workflows/groovy-snapshot-canary.yml | 13 +++++++++++-- AGENTS.md | 1 + 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 07d7c2a9fc..1e311435ab 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -697,8 +697,9 @@ jobs: with: distribution: liberica java-version: ${{ matrix.java }} - - name: "🗄️ Cache the mongod the embedded server runs" - uses: actions/[email protected] + - name: "🗄️ Restore the mongod the embedded server runs" + id: embedmongo-cache + uses: actions/cache/[email protected] with: # Outside the Gradle User Home that setup-gradle caches: this holds an immutable download from # fastdl.mongodb.org - the archive and the binary extracted out of it - and no database, @@ -729,6 +730,14 @@ jobs: -PonlyMongodbTests -PmongodbContainerVersion=${{ matrix.mongodb-version }} -PskipCodeStyle + - name: "🗄️ Save the mongod the embedded server runs" + # The download is the same on every branch, and every branch can restore the default branch's entries, + # so only a push to the default branch saves it; other branches and pull requests only restore it. + if: ${{ success() && github.event_name != 'pull_request' && github.ref_name == github.event.repository.default_branch && steps.embedmongo-cache.outputs.cache-hit != 'true' }} + uses: actions/cache/[email protected] + with: + path: ~/.embedmongo + key: ${{ steps.embedmongo-cache.outputs.cache-primary-key }} hibernate5Functional: if: ${{ !contains(github.event.head_commit.message, '[skip tests]') }} name: "Hibernate5 Functional Tests (Java ${{ matrix.java }}, indy=${{ matrix.indy }})" diff --git a/.github/workflows/groovy-snapshot-canary.yml b/.github/workflows/groovy-snapshot-canary.yml index 597d22b5cb..509363bca1 100644 --- a/.github/workflows/groovy-snapshot-canary.yml +++ b/.github/workflows/groovy-snapshot-canary.yml @@ -140,8 +140,9 @@ jobs: with: java-version: 21 distribution: liberica - - name: "🗄️ Cache the mongod the embedded server runs" - uses: actions/[email protected] + - name: "🗄️ Restore the mongod the embedded server runs" + id: embedmongo-cache + uses: actions/cache/[email protected] with: # Outside the Gradle User Home that setup-gradle caches, for the reasons given on the same # step in gradle.yml. The version is the one -PmongodbContainerVersion asks for below. @@ -182,3 +183,11 @@ jobs: -PmongodbContainerVersion=8.0 env: GRAILS_INCLUDE_MAVEN_LOCAL: true + - name: "🗄️ Save the mongod the embedded server runs" + # The download is the same on every branch, and every branch can restore the default branch's entries, + # so only a push to the default branch saves it; other branches and pull requests only restore it. + if: ${{ success() && github.event_name != 'pull_request' && github.ref_name == github.event.repository.default_branch && steps.embedmongo-cache.outputs.cache-hit != 'true' }} + uses: actions/cache/[email protected] + with: + path: ~/.embedmongo + key: ${{ steps.embedmongo-cache.outputs.cache-primary-key }} diff --git a/AGENTS.md b/AGENTS.md index cddc6e266d..c275beb436 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -307,6 +307,7 @@ GitHub keeps about 10 GB of Actions cache per repository and evicts the least re - Every `setup-gradle` step is preceded by the local action `.github/actions/gradle-cache-policy` and takes `cache-read-only` from its `read-only` output. Do not write `true` or `false` there: the policy lives in that action, so changing it means editing one file on the oldest release branch and merging up. - Only the core build job (`build` in `gradle.yml`) passes `cache-writer`, from the one matrix entry per OS flagged `cache_writer: true`. A new job or workflow never passes it. - The action lets a writer save only on a push or dispatch, only on a branch whose major version is at least the default branch's, and, for Windows and macOS, only on that major's first branch (`x.0.x`). With 8.0.x as the default branch, 7.x never writes, Linux writes on every 8.x and 9.x branch, and Windows and macOS write on 8.0.x and 9.0.x. The rule follows the default branch: when a new one is promoted, older majors stop writing without an edit. +- A cache whose content is the same on every branch, such as the mongod download the embedded MongoDB tests run, is restored everywhere but saved only by a push to the default branch, whose entries every branch can read. Use separate `actions/cache/restore` and `actions/cache/save` steps for it, never the combined `actions/cache` step, which saves on every branch and pull request. Why it is this way:
