mirror of
https://github.com/gradle/gradle-build-action
synced 2024-11-27 12:02:15 +00:00
Test coverage: Verify configuration-cache is restored with project-dot-gradle
This commit is contained in:
parent
a587e93714
commit
436390bd4e
2 changed files with 11 additions and 31 deletions
38
.github/workflows/prod.yml
vendored
38
.github/workflows/prod.yml
vendored
|
@ -33,7 +33,6 @@ jobs:
|
|||
|
||||
# Tests for executing with different Gradle versions.
|
||||
# Each build verifies that it is executed with the expected Gradle version.
|
||||
# These builds will not store cache entries for gradle-user-home or project-dot-gradle
|
||||
gradle-execution:
|
||||
needs: seed-build
|
||||
strategy:
|
||||
|
@ -89,7 +88,7 @@ jobs:
|
|||
gradle-user-home-cache-enabled: read-only
|
||||
project-dot-gradle-cache-enabled: read-only
|
||||
|
||||
# Test that the gradle-user-home cache will cache and restore local build-cachee
|
||||
# Test that the gradle-user-home cache will cache and restore local build-cache
|
||||
build-cache:
|
||||
needs: seed-build
|
||||
strategy:
|
||||
|
@ -107,6 +106,7 @@ jobs:
|
|||
gradle-user-home-cache-enabled: read-only
|
||||
project-dot-gradle-cache-enabled: read-only
|
||||
|
||||
# Test that the project-dot-gradle cache will cache and restore configuration-cache
|
||||
configuration-cache:
|
||||
needs: seed-build
|
||||
strategy:
|
||||
|
@ -116,42 +116,18 @@ jobs:
|
|||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v2
|
||||
- name: Test configuration-cache-enabled
|
||||
- name: Execute Gradle build and verify cached configuration
|
||||
uses: ./
|
||||
env:
|
||||
VERIFY_CACHED_CONFIGURATION: true
|
||||
with:
|
||||
build-root-directory: __tests__/samples/basic
|
||||
arguments: test --configuration-cache
|
||||
|
||||
read-only-cache:
|
||||
needs: seed-build
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v2
|
||||
- name: Test caches read-only
|
||||
uses: ./
|
||||
with:
|
||||
build-root-directory: __tests__/samples/basic
|
||||
arguments: test
|
||||
distributions-cache-enabled: read-only
|
||||
gradle-user-home-cache-enabled: read-only
|
||||
project-dot-gradle-cache-enabled: read-only
|
||||
|
||||
- name: Test caches disabled
|
||||
uses: ./
|
||||
with:
|
||||
gradle-version: 6.9
|
||||
build-root-directory: __tests__/samples/basic
|
||||
arguments: test
|
||||
distributions-cache-enabled: false
|
||||
gradle-user-home-cache-enabled: false
|
||||
project-dot-gradle-cache-enabled: false
|
||||
|
||||
|
||||
failures: # These build invocations are informational only, and are expected to fail
|
||||
# These build invocations are informational only, and are expected to fail
|
||||
failures:
|
||||
needs: seed-build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
|
|
@ -11,6 +11,10 @@ dependencies {
|
|||
}
|
||||
|
||||
tasks.named("test").configure {
|
||||
// Use an environment variable to bypass config-cache checks
|
||||
if (System.getenv('VERIFY_CACHED_CONFIGURATION') != null) {
|
||||
throw new RuntimeException("Configuration was not cached: unexpected configuration of test task")
|
||||
}
|
||||
doLast {
|
||||
if (System.properties.verifyCachedBuild) {
|
||||
throw new RuntimeException("Build was not cached: unexpected execution of test task")
|
||||
|
|
Loading…
Reference in a new issue