Great! We don't want local cache on CI. Why do we need this setting or the next one? Can we rely on Gradle's defaults? good question, let's rely on defaults for now and adjust them if needed later on.
Enable Gradle Build cache for faster local builds
Let's enable Gradle build cache for faster local builds.

https://docs.gradle.org/current/userguide/build_cache.html
.gitignore gradle.properties settings.gradle
.gitignore gradle.properties settings.gradle
diff --git a/.gitignore b/.gitignore
index b91f27c74a..9d0c115582 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,6 +14,7 @@ bin/
 
 # Gradle & builds
 build
+build-cache
 target
 out
 .gradle
diff --git a/gradle.properties b/gradle.properties
index 41f55a5303..5970e287bb 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,2 +1,3 @@
 org.gradle.daemon=true
 org.gradle.parallel=true
+org.gradle.caching=true
diff --git a/settings.gradle b/settings.gradle
index 8dd114e648..15bc234122 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -18,3 +18,9 @@ rootProject.children.each { project ->
 }
 
 enableFeaturePreview('STABLE_PUBLISHING')
+
+buildCache {
+    local {
+        enabled = !System.getenv().containsKey("CI")
+    }
+}
