Skip to content

Commit

Permalink
Do not include the whole Gradle cache in GH Actions caches
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
yrodiere committed Oct 25, 2024
1 parent 62fe772 commit 013bb46
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ jobs:
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-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
with:
path: |
~/.m2/repository/
~/.m2/wrapper/
~/.gradle/caches/
~/.gradle/caches/modules-2
~/.gradle/wrapper/
key: ${{ steps.cache-key.outputs.buildtool-cache-key }}
restore-keys: |
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
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-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
uses: actions/cache@v4
# if it's not a pull request, we restore and save the cache
Expand All @@ -80,7 +80,7 @@ jobs:
path: |
~/.m2/repository/
~/.m2/wrapper/
~/.gradle/caches/
~/.gradle/caches/modules-2
~/.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.
# The whole cache is dropped monthly to prevent unlimited growth.
Expand All @@ -89,15 +89,15 @@ jobs:
restore-keys: |
${{ steps.cache-key.outputs.buildtool-monthly-branch-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
# if it a pull request, we restore the cache but we don't save it
if: github.event_name == 'pull_request'
with:
path: |
~/.m2/repository/
~/.m2/wrapper/
~/.gradle/caches/
~/.gradle/caches/modules-2
~/.gradle/wrapper/
key: ${{ steps.cache-key.outputs.buildtool-cache-key }}
restore-keys: |
Expand Down Expand Up @@ -180,7 +180,7 @@ jobs:
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-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
uses: actions/cache@v4
# if it's not a pull request, we restore and save the cache
Expand All @@ -189,7 +189,7 @@ jobs:
path: |
~/.m2/repository/
~/.m2/wrapper/
~/.gradle/caches/
~/.gradle/caches/modules-2
~/.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.
# The whole cache is dropped monthly to prevent unlimited growth.
Expand All @@ -198,15 +198,15 @@ jobs:
restore-keys: |
${{ steps.cache-key.outputs.buildtool-monthly-branch-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
# if it a pull request, we restore the cache but we don't save it
if: github.event_name == 'pull_request'
with:
path: |
~/.m2/repository/
~/.m2/wrapper/
~/.gradle/caches/
~/.gradle/caches/modules-2
~/.gradle/wrapper/
key: ${{ steps.cache-key.outputs.buildtool-cache-key }}
restore-keys: |
Expand Down

0 comments on commit 013bb46

Please sign in to comment.