How to speed up Android Gradle build in continuous integration

See my new page. You will read new interesting posts about website programming, machine learning, continuous integration or problems with creating simple 2d games.
Below is a sample task for Concourse CI, which caches gradle
packages for future builds.
build_android.sh
---
platform: linux
image_resource:
type: docker-image
source:
repository: alvrme/alpine-android
tag: android-28
inputs:
- name: app-repo
run:
path: app-repo/ci/tasks/build_android.sh
caches:
- path: .gradle
build.sh
#!/bin/sh
set -eux
export ROOT_FOLDER=$(pwd)
export GRADLE_USER_HOME="${ROOT_FOLDER}/.gradle"
cd app-repo
./gradlew assembleDebug
At the beginning of shell script I set the path GRADE_USER_HOME
to be relative to the currently used workspace, so that Concourse can save the files for later.
Word count: 92