Skip to content

Commit c17daca

Browse files
committed
[CALCITE-4168] Configure Gradle local build cache
This commit configures local build cache, and it delegates Gradle execution to burrunan/gradle-cache-action. It unlocks fine-grained remote build cache with GitHub Actions backend (=faster builds), and it adds error markers (e.g. compilation errors right in the commit diffs) See https://github.com/burrunan/gradle-cache-action#gradle-cache-action
1 parent e84f635 commit c17daca

File tree

4 files changed

+63
-16
lines changed

4 files changed

+63
-16
lines changed

.github/workflows/main.yml

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,11 @@ jobs:
4747
uses: actions/setup-java@v1
4848
with:
4949
java-version: 8
50-
- name: 'Test'
51-
shell: cmd
52-
run: |
53-
./gradlew --no-parallel --no-daemon build javadoc
50+
- uses: burrunan/gradle-cache-action@v1
51+
name: Test
52+
with:
53+
job-id: jdk${{ matrix.jdk }}
54+
arguments: --scan --no-parallel --no-daemon build javadoc
5455

5556
linux-avatica:
5657
if: github.event.action != 'labeled'
@@ -61,17 +62,30 @@ jobs:
6162
uses: actions/setup-java@v1
6263
with:
6364
java-version: 11
64-
- name: 'Install Avatica to Maven Local repository'
65+
- name: 'Clone Avatica to Maven Local repository'
6566
run: |
6667
git clone --branch master --depth 100 https://github.com/apache/calcite-avatica.git ../calcite-avatica
67-
cd ../calcite-avatica
68-
./gradlew publishToMavenLocal -Pcalcite.avatica.version=1.0.0-dev-master -PskipJavadoc
68+
- uses: burrunan/gradle-cache-action@v1
69+
name: Build Avatica
70+
with:
71+
job-id: avatica-jdk${{ matrix.jdk }}
72+
build-root-directory: ../calcite-avatica
73+
arguments: publishToMavenLocal
74+
properties: |
75+
calcite.avatica.version=1.0.0-dev-master
76+
skipJavadoc=
6977
- uses: actions/checkout@v2
7078
with:
7179
fetch-depth: 50
72-
- name: 'Test'
73-
run: |
74-
./gradlew --no-parallel --no-daemon build javadoc -Pcalcite.avatica.version=1.0.0-dev-master-SNAPSHOT -PenableMavenLocal
80+
- uses: burrunan/gradle-cache-action@v1
81+
name: Test
82+
with:
83+
job-id: jdk${{ matrix.jdk }}
84+
execution-only-caches: true
85+
arguments: --scan --no-parallel --no-daemon build javadoc
86+
properties: |
87+
calcite.avatica.version=1.0.0-dev-master-SNAPSHOT
88+
enableMavenLocal=
7589
7690
mac:
7791
if: github.event.action != 'labeled'
@@ -85,9 +99,11 @@ jobs:
8599
uses: actions/setup-java@v1
86100
with:
87101
java-version: 14
88-
- name: 'Test'
89-
run: |
90-
./gradlew --no-parallel --no-daemon build javadoc
102+
- uses: burrunan/gradle-cache-action@v1
103+
name: Test
104+
with:
105+
job-id: jdk14
106+
arguments: --scan --no-parallel --no-daemon build javadoc
91107

92108
linux-slow:
93109
# Run slow tests when the commit is on master or it is requested explicitly by adding an
@@ -103,6 +119,8 @@ jobs:
103119
uses: actions/setup-java@v1
104120
with:
105121
java-version: 8
106-
- name: 'Test'
107-
run: |
108-
./gradlew --no-parallel --no-daemon testSlow
122+
- uses: burrunan/gradle-cache-action@v1
123+
name: Test
124+
with:
125+
job-id: jdk8
126+
arguments: --scan --no-parallel --no-daemon testSlow

build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,9 @@ allprojects {
530530
options.compilerArgs.addAll(listOf("-Xlint:deprecation", "-Werror"))
531531
}
532532
configureEach<Test> {
533+
outputs.cacheIf("test results depend on the database configuration, so we souldn't cache it") {
534+
false
535+
}
533536
useJUnitPlatform {
534537
excludeTags("slow")
535538
}

gradle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
# limitations under the License.
1616
#
1717
org.gradle.parallel=true
18+
# Build cache can be disabled with --no-build-cache option
19+
org.gradle.caching=true
20+
#org.gradle.caching.debug=true
1821
# See https://github.com/gradle/gradle/pull/11358 , https://issues.apache.org/jira/browse/INFRA-14923
1922
# repository.apache.org does not yet support .sha256 and .sha512 checksums
2023
systemProp.org.gradle.internal.publish.checksums.insecure=true

settings.gradle.kts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ pluginManagement {
3737
}
3838
}
3939

40+
plugins {
41+
`gradle-enterprise`
42+
}
43+
4044
// This is the name of a current project
4145
// Note: it cannot be inferred from the directory name as developer might clone Calcite to calcite_tmp folder
4246
rootProject.name = "calcite"
@@ -78,6 +82,25 @@ fun property(name: String) =
7882
else -> null
7983
}
8084

85+
val isCiServer = System.getenv().containsKey("CI")
86+
87+
if (isCiServer) {
88+
gradleEnterprise {
89+
buildScan {
90+
termsOfServiceUrl = "https://gradle.com/terms-of-service"
91+
termsOfServiceAgree = "yes"
92+
tag("CI")
93+
}
94+
}
95+
}
96+
97+
// Cache build artifacts, so expensive operations do not need to be re-computed
98+
buildCache {
99+
local {
100+
isEnabled = !isCiServer
101+
}
102+
}
103+
81104
// This enables to use local clone of vlsi-release-plugins for debugging purposes
82105
property("localReleasePlugins")?.ifBlank { "../vlsi-release-plugins" }?.let {
83106
println("Importing project '$it'")

0 commit comments

Comments
 (0)