mirror of
https://github.com/gradle/gradle-build-action.git
synced 2024-12-25 15:16:18 +08:00
Test coverage: Verify local build cache is restored with gradle-user-home
This commit is contained in:
parent
75e00ee3d1
commit
a587e93714
18
.github/workflows/prod.yml
vendored
18
.github/workflows/prod.yml
vendored
@ -89,6 +89,24 @@ 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
|
||||||
|
build-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: Execute Gradle build and verify tasks from cache
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
build-root-directory: __tests__/samples/basic
|
||||||
|
arguments: test -DverifyCachedBuild=true
|
||||||
|
gradle-user-home-cache-enabled: read-only
|
||||||
|
project-dot-gradle-cache-enabled: read-only
|
||||||
|
|
||||||
configuration-cache:
|
configuration-cache:
|
||||||
needs: seed-build
|
needs: seed-build
|
||||||
strategy:
|
strategy:
|
||||||
|
@ -9,3 +9,11 @@ repositories {
|
|||||||
dependencies {
|
dependencies {
|
||||||
testImplementation('junit:junit:4.12')
|
testImplementation('junit:junit:4.12')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.named("test").configure {
|
||||||
|
doLast {
|
||||||
|
if (System.properties.verifyCachedBuild) {
|
||||||
|
throw new RuntimeException("Build was not cached: unexpected execution of test task")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
1
__tests__/samples/basic/gradle.properties
Normal file
1
__tests__/samples/basic/gradle.properties
Normal file
@ -0,0 +1 @@
|
|||||||
|
org.gradle.caching=true
|
Loading…
x
Reference in New Issue
Block a user