Enable gradle build cache within each pipeline

in order to speed up the CI.

This does not enable the build cache on local dev machines.
This commit is contained in:
Torsten Grote 2023-06-12 14:00:59 -03:00 committed by Hans-Christoph Steiner
parent e05db5b662
commit 373d038cc9
2 changed files with 12 additions and 4 deletions

View File

@ -14,6 +14,7 @@ workflow:
.base:
before_script:
- echo "org.gradle.caching=true" >> gradle.properties
- test -e /etc/apt/sources.list.d/bullseye-backports.list
|| echo "deb http://deb.debian.org/debian bullseye-backports main" >> /etc/apt/sources.list
- apt update
@ -27,11 +28,15 @@ workflow:
- export GRADLE_USER_HOME=$PWD/.gradle
- export ANDROID_COMPILE_SDK=`sed -n 's,.*compileSdkVersion\s*\([0-9][0-9]*\).*,\1,p' app/build.gradle`
- echo y | sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" > /dev/null
# index-v1.jar tests need SHA1 support still, TODO use apksig to validate JAR sigs
- sed -i 's,SHA1 denyAfter 20[0-9][0-9],SHA1 denyAfter 2024,'
/usr/lib/jvm/default-java/conf/security/java.security
after_script:
# this file changes every time but should not be cached
- rm -f $GRADLE_USER_HOME/caches/modules-2/modules-2.lock
- rm -fr $GRADLE_USER_HOME/caches/*/plugin-resolution/
cache:
key: '${CI_PROJECT_PATH}_${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}'
paths:
- .gradle/wrapper
- .gradle/caches
@ -52,12 +57,11 @@ workflow:
- build/reports
expire_in: 1 week
when: on_failure
before_script:
# index-v1.jar tests need SHA1 support still, TODO use apksig to validate JAR sigs
- sed -i 's,SHA1 denyAfter 20[0-9][0-9],SHA1 denyAfter 2024,'
/usr/lib/jvm/default-java/conf/security/java.security
after_script:
- echo "Download debug artifacts from https://gitlab.com/${CI_PROJECT_PATH}/-/jobs"
# this file changes every time but should not be cached
- rm -f $GRADLE_USER_HOME/caches/modules-2/modules-2.lock
- rm -fr $GRADLE_USER_HOME/caches/*/plugin-resolution/
.always-on-these-changes: &always-on-these-changes
changes:

View File

@ -96,6 +96,10 @@ dependencies {
androidTestImplementation 'commons-io:commons-io:2.6'
}
plugins.withId("kotlin-kapt") {
kapt.useBuildCache = true
}
signing {
useGpgCmd()
}