Do not include the whole Gradle cache in GH Actions caches

We don't need the whole cache, since most (all?) of it is stored on
Develocity already.

Including ./gradle/caches/modules-2 is enough, because that's where
Maven dependencies are stored, and *those* are not stored on Develocity.

(cherry picked from commit 013bb46470)
This commit is contained in:
Yoann Rodière 2024-10-25 12:27:06 +02:00 committed by Christian Beikov
parent bd209ce2fd
commit 97394283ab
2 changed files with 10 additions and 10 deletions

View File

@ -37,13 +37,13 @@ jobs:
echo "buildtool-monthly-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}" >> $GITHUB_OUTPUT echo "buildtool-monthly-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}" >> $GITHUB_OUTPUT
echo "buildtool-monthly-branch-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}" >> $GITHUB_OUTPUT echo "buildtool-monthly-branch-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}" >> $GITHUB_OUTPUT
echo "buildtool-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}-${CURRENT_DAY}" >> $GITHUB_OUTPUT echo "buildtool-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}-${CURRENT_DAY}" >> $GITHUB_OUTPUT
- name: Restore Maven/Gradle Local Caches - name: Restore Maven/Gradle Dependency/Dist Caches
uses: actions/cache/restore@v4 uses: actions/cache/restore@v4
with: with:
path: | path: |
~/.m2/repository/ ~/.m2/repository/
~/.m2/wrapper/ ~/.m2/wrapper/
~/.gradle/caches/ ~/.gradle/caches/modules-2
~/.gradle/wrapper/ ~/.gradle/wrapper/
key: ${{ steps.cache-key.outputs.buildtool-cache-key }} key: ${{ steps.cache-key.outputs.buildtool-cache-key }}
restore-keys: | restore-keys: |

View File

@ -72,7 +72,7 @@ jobs:
echo "buildtool-monthly-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}" >> $GITHUB_OUTPUT echo "buildtool-monthly-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}" >> $GITHUB_OUTPUT
echo "buildtool-monthly-branch-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}" >> $GITHUB_OUTPUT echo "buildtool-monthly-branch-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}" >> $GITHUB_OUTPUT
echo "buildtool-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}-${CURRENT_DAY}" >> $GITHUB_OUTPUT echo "buildtool-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}-${CURRENT_DAY}" >> $GITHUB_OUTPUT
- name: Cache Maven/Gradle Local Caches - name: Cache Maven/Gradle Dependency/Dist Caches
id: cache-maven id: cache-maven
uses: actions/cache@v4 uses: actions/cache@v4
# if it's not a pull request, we restore and save the cache # if it's not a pull request, we restore and save the cache
@ -81,7 +81,7 @@ jobs:
path: | path: |
~/.m2/repository/ ~/.m2/repository/
~/.m2/wrapper/ ~/.m2/wrapper/
~/.gradle/caches/ ~/.gradle/caches/modules-2
~/.gradle/wrapper/ ~/.gradle/wrapper/
# A new cache will be stored daily. After that first store of the day, cache save actions will fail because the cache is immutable but it's not a problem. # A new cache will be stored daily. After that first store of the day, cache save actions will fail because the cache is immutable but it's not a problem.
# The whole cache is dropped monthly to prevent unlimited growth. # The whole cache is dropped monthly to prevent unlimited growth.
@ -90,7 +90,7 @@ jobs:
restore-keys: | restore-keys: |
${{ steps.cache-key.outputs.buildtool-monthly-branch-cache-key }}- ${{ steps.cache-key.outputs.buildtool-monthly-branch-cache-key }}-
${{ steps.cache-key.outputs.buildtool-monthly-cache-key }}- ${{ steps.cache-key.outputs.buildtool-monthly-cache-key }}-
- name: Restore Maven/Gradle Local Caches - name: Restore Maven/Gradle Dependency/Dist Caches
uses: actions/cache/restore@v4 uses: actions/cache/restore@v4
# if it a pull request, we restore the cache but we don't save it # if it a pull request, we restore the cache but we don't save it
if: github.event_name == 'pull_request' if: github.event_name == 'pull_request'
@ -98,7 +98,7 @@ jobs:
path: | path: |
~/.m2/repository/ ~/.m2/repository/
~/.m2/wrapper/ ~/.m2/wrapper/
~/.gradle/caches/ ~/.gradle/caches/modules-2
~/.gradle/wrapper/ ~/.gradle/wrapper/
key: ${{ steps.cache-key.outputs.buildtool-cache-key }} key: ${{ steps.cache-key.outputs.buildtool-cache-key }}
restore-keys: | restore-keys: |
@ -181,7 +181,7 @@ jobs:
echo "buildtool-monthly-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}" >> $GITHUB_OUTPUT echo "buildtool-monthly-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}" >> $GITHUB_OUTPUT
echo "buildtool-monthly-branch-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}" >> $GITHUB_OUTPUT echo "buildtool-monthly-branch-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}" >> $GITHUB_OUTPUT
echo "buildtool-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}-${CURRENT_DAY}" >> $GITHUB_OUTPUT echo "buildtool-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}-${CURRENT_DAY}" >> $GITHUB_OUTPUT
- name: Cache Maven/Gradle Local Caches - name: Cache Maven/Gradle Dependency/Dist Caches
id: cache-maven id: cache-maven
uses: actions/cache@v4 uses: actions/cache@v4
# if it's not a pull request, we restore and save the cache # if it's not a pull request, we restore and save the cache
@ -190,7 +190,7 @@ jobs:
path: | path: |
~/.m2/repository/ ~/.m2/repository/
~/.m2/wrapper/ ~/.m2/wrapper/
~/.gradle/caches/ ~/.gradle/caches/modules-2
~/.gradle/wrapper/ ~/.gradle/wrapper/
# A new cache will be stored daily. After that first store of the day, cache save actions will fail because the cache is immutable but it's not a problem. # A new cache will be stored daily. After that first store of the day, cache save actions will fail because the cache is immutable but it's not a problem.
# The whole cache is dropped monthly to prevent unlimited growth. # The whole cache is dropped monthly to prevent unlimited growth.
@ -199,7 +199,7 @@ jobs:
restore-keys: | restore-keys: |
${{ steps.cache-key.outputs.buildtool-monthly-branch-cache-key }}- ${{ steps.cache-key.outputs.buildtool-monthly-branch-cache-key }}-
${{ steps.cache-key.outputs.buildtool-monthly-cache-key }}- ${{ steps.cache-key.outputs.buildtool-monthly-cache-key }}-
- name: Restore Maven/Gradle Local Caches - name: Restore Maven/Gradle Dependency/Dist Caches
uses: actions/cache/restore@v4 uses: actions/cache/restore@v4
# if it a pull request, we restore the cache but we don't save it # if it a pull request, we restore the cache but we don't save it
if: github.event_name == 'pull_request' if: github.event_name == 'pull_request'
@ -207,7 +207,7 @@ jobs:
path: | path: |
~/.m2/repository/ ~/.m2/repository/
~/.m2/wrapper/ ~/.m2/wrapper/
~/.gradle/caches/ ~/.gradle/caches/modules-2
~/.gradle/wrapper/ ~/.gradle/wrapper/
key: ${{ steps.cache-key.outputs.buildtool-cache-key }} key: ${{ steps.cache-key.outputs.buildtool-cache-key }}
restore-keys: | restore-keys: |