Skip to content

Commit 9c4756f

Browse files
authored
Push Gradle Cache from GHA (#2597)
* Push Gradle Cache from GHA * Update ci.yml
1 parent d604f3e commit 9c4756f

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ jobs:
2323
${{ runner.os }}-gradle-home-testmatrix-
2424
${{ runner.os }}-gradle-home-
2525
- id: set-matrix
26+
env:
27+
# Since we override the tests executor,
28+
# we should not push empty results to the cache
29+
READ_ONLY_REMOTE_GRADLE_CACHE: true
2630
run: |
2731
TASKS=$(./gradlew --no-daemon --parallel -q testMatrix)
2832
echo $TASKS

settings.gradle

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,17 @@ buildscript {
55
}
66
}
77
dependencies {
8-
classpath "gradle.plugin.ch.myniva.gradle:s3-build-cache:0.9.0"
8+
classpath "gradle.plugin.ch.myniva.gradle:s3-build-cache:0.10.0"
99
classpath "com.gradle.enterprise:com.gradle.enterprise.gradle.plugin:3.2.1"
1010
}
11-
12-
configurations.classpath {
13-
resolutionStrategy {
14-
force 'com.amazonaws:aws-java-sdk-s3:1.11.582'
15-
}
16-
}
1711
}
1812

1913
apply plugin: 'ch.myniva.s3-build-cache'
2014
apply plugin: 'com.gradle.enterprise'
2115

22-
ext.isMasterBuild = (System.getenv("CIRCLE_BRANCH") ?: System.getenv("BUILD_SOURCEBRANCHNAME")) == "master"
16+
ext.isMasterBuild = false ||
17+
(System.getenv("GITHUB_REF") == "refs/heads/master") ||
18+
(System.getenv("BUILD_SOURCEBRANCHNAME") == "master")
2319

2420
buildCache {
2521
local {
@@ -31,7 +27,7 @@ buildCache {
3127
region = 'fra1'
3228
bucket = 'testcontainers'
3329
path = 'cache'
34-
push = isMasterBuild
30+
push = !(System.getenv("READ_ONLY_REMOTE_GRADLE_CACHE") || !isMasterBuild)
3531
headers = [
3632
'x-amz-acl': 'public-read'
3733
]

0 commit comments

Comments
 (0)