mirror of
https://github.com/gradle/gradle-build-action.git
synced 2024-12-25 14:56:18 +08:00
Test coverage: Verify configuration-cache is restored with project-dot-gradle
This commit is contained in:
parent
a587e93714
commit
436390bd4e
38
.github/workflows/prod.yml
vendored
38
.github/workflows/prod.yml
vendored
@ -33,7 +33,6 @@ jobs:
|
|||||||
|
|
||||||
# Tests for executing with different Gradle versions.
|
# Tests for executing with different Gradle versions.
|
||||||
# Each build verifies that it is executed with the expected Gradle version.
|
# 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:
|
gradle-execution:
|
||||||
needs: seed-build
|
needs: seed-build
|
||||||
strategy:
|
strategy:
|
||||||
@ -89,7 +88,7 @@ jobs:
|
|||||||
gradle-user-home-cache-enabled: read-only
|
gradle-user-home-cache-enabled: read-only
|
||||||
project-dot-gradle-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:
|
build-cache:
|
||||||
needs: seed-build
|
needs: seed-build
|
||||||
strategy:
|
strategy:
|
||||||
@ -107,6 +106,7 @@ jobs:
|
|||||||
gradle-user-home-cache-enabled: read-only
|
gradle-user-home-cache-enabled: read-only
|
||||||
project-dot-gradle-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:
|
configuration-cache:
|
||||||
needs: seed-build
|
needs: seed-build
|
||||||
strategy:
|
strategy:
|
||||||
@ -116,42 +116,18 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Test configuration-cache-enabled
|
- name: Execute Gradle build and verify cached configuration
|
||||||
uses: ./
|
uses: ./
|
||||||
|
env:
|
||||||
|
VERIFY_CACHED_CONFIGURATION: true
|
||||||
with:
|
with:
|
||||||
build-root-directory: __tests__/samples/basic
|
build-root-directory: __tests__/samples/basic
|
||||||
arguments: test --configuration-cache
|
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
|
gradle-user-home-cache-enabled: read-only
|
||||||
project-dot-gradle-cache-enabled: read-only
|
project-dot-gradle-cache-enabled: read-only
|
||||||
|
|
||||||
- name: Test caches disabled
|
# These build invocations are informational only, and are expected to fail
|
||||||
uses: ./
|
failures:
|
||||||
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
|
|
||||||
needs: seed-build
|
needs: seed-build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
@ -11,6 +11,10 @@ dependencies {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tasks.named("test").configure {
|
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 {
|
doLast {
|
||||||
if (System.properties.verifyCachedBuild) {
|
if (System.properties.verifyCachedBuild) {
|
||||||
throw new RuntimeException("Build was not cached: unexpected execution of test task")
|
throw new RuntimeException("Build was not cached: unexpected execution of test task")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user