Cache wrapper zips and generated jars individually

Using a single cache entry for all files of a type is necessary to avoid
overloading the cache service. However, this mechanism is not very efficient
for certain artifacts like wrapper zips and generated-gradle-jars, where the
same individual files are often shared between different jobs.

With this change, any configured file patterns that do not end in '*' will
be cached as individual files. At this time this includes downloaded wrapper
zips and generated-gradle-jars.

Fixes #78
This commit is contained in:
Daz DeBoer 2021-12-02 14:38:23 -07:00
parent b88c4086b9
commit 37f2880a8a
5 changed files with 176 additions and 133 deletions

View file

@ -25,7 +25,7 @@ jobs:
with:
build-root-directory: __tests__/samples/groovy-dsl
arguments: test
# Add "wrapper" to main cache entry and remove 'wrapper-zips' bundle
# Add "wrapper" to main cache entry and remove 'wrapper-zips' cache entry
# Exclude build-cache from main cache entry
gradle-home-cache-includes: |
caches
@ -33,7 +33,7 @@ jobs:
wrapper
gradle-home-cache-excludes: |
caches/build-cache-1
gradle-home-cache-artifact-bundles: |
gradle-home-extracted-cache-entries: |
[
["generated-gradle-jars", "caches/*/generated-gradle-jars/*.jar"],
["dependencies", "caches/modules-*/files-*/*/*/*/*/"],
@ -64,7 +64,7 @@ jobs:
wrapper
gradle-home-cache-excludes: |
caches/build-cache-1
gradle-home-cache-artifact-bundles: |
gradle-home-extracted-cache-entries: |
[
["generated-gradle-jars", "caches/*/generated-gradle-jars/*.jar"],
["dependencies", "caches/modules-*/files-*/*/*/*/*/"],

View file

@ -45,8 +45,8 @@ jobs:
arguments: test --configuration-cache
cache-read-only: true
# Check that the build can run when no bundles are restored
no-bundles-restored:
# Check that the build can run when no extracted cache entries are restored
no-extracted-cache-entries-restored:
needs: seed-build
strategy:
matrix:
@ -55,11 +55,11 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Execute Gradle build with no cache artifact bundles restored
- name: Execute Gradle build with no cache extracted cache entries restored
uses: ./
with:
build-root-directory: __tests__/samples/groovy-dsl
arguments: test --configuration-cache
cache-read-only: true
gradle-home-cache-artifact-bundles: '[]'
gradle-home-extracted-cache-entries: '[]'

View file

@ -59,8 +59,8 @@ jobs:
arguments: test -DverifyCachedBuild=true
cache-read-only: true
# Check that the build can run when no bundles are restored
no-bundles-restored:
# Check that the build can run when Gradle User Home is not fully restored
no-extracted-cache-entries-restored:
needs: seed-build
strategy:
matrix:
@ -69,11 +69,11 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Execute Gradle build with no cache artifact bundles restored
- name: Execute Gradle build with no extracted cache entries restored
uses: ./
with:
build-root-directory: __tests__/samples/groovy-dsl
arguments: test
cache-read-only: true
gradle-home-cache-artifact-bundles: '[]'
gradle-home-extracted-cache-entries: '[]'