Cache app/build to speed up builds

This commit is contained in:
Ricki Hirner 2023-11-17 15:14:04 +01:00
parent ee637e4f6d
commit 90c72ec013
3 changed files with 50 additions and 4 deletions

View File

@ -35,6 +35,14 @@ jobs:
java-version: 17
- uses: gradle/gradle-build-action@v2
- name: Use app/build and gradle configuration cache
uses: actions/cache/restore@v3
with:
key: app_build-tests-without-emulator
path: |
.gradle/configuration-cache
app/build
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2

View File

@ -16,6 +16,15 @@ jobs:
java-version: 17
- uses: gradle/gradle-build-action@v2
- name: Use app/build and gradle configuration cache
if: ${{ github.ref != 'refs/heads/dev-ose' }}
uses: actions/cache/restore@v3
with:
key: app_build-tests-without-emulator
path: |
.gradle/configuration-cache
app/build
- name: Run lint and unit tests
run: ./gradlew app:check
- name: Archive results
@ -26,6 +35,15 @@ jobs:
app/build/outputs/lint*
app/build/reports
- name: Cache app/build and gradle configuration
if: ${{ github.ref == 'refs/heads/dev-ose' }}
uses: actions/cache/save@v3
with:
key: app_build-tests-without-emulator
path: |
.gradle/configuration-cache
app/build
test_on_emulator:
name: Tests with emulator
runs-on: ubuntu-latest-4-cores
@ -40,6 +58,15 @@ jobs:
java-version: 17
- uses: gradle/gradle-build-action@v2
- name: Use app/build and gradle configuration cache
if: ${{ github.ref != 'refs/heads/dev-ose' }}
uses: actions/cache/restore@v3
with:
key: app_build-tests-with-emulator
path: |
.gradle/configuration-cache
app/build
- name: Enable KVM group perms
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
@ -76,6 +103,15 @@ jobs:
disable-animations: true
script: ./gradlew app:connectedCheck
- name: Cache app/build and gradle configuration
if: ${{ github.ref == 'refs/heads/dev-ose' }}
uses: actions/cache/save@v3
with:
key: app_build-tests-with-emulator
path: |
.gradle/configuration-cache
app/build
- name: Archive results
if: always()
uses: actions/upload-artifact@v2

View File

@ -1,11 +1,13 @@
# [https://developer.android.com/build/optimize-your-build#optimize]
# https://developer.android.com/build/optimize-your-build
org.gradle.daemon=true
org.gradle.jvmargs=-Xmx4g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:MaxMetaspaceSize=512m
org.gradle.parallel=true
# configuration cache [https://developer.android.com/build/optimize-your-build#use-the-configuration-cache-experimental]
org.gradle.unsafe.configuration-cache=true
org.gradle.unsafe.configuration-cache-problems=warn
org.gradle.configuration-cache=true
org.gradle.configuration-cache.problems=warn
# https://docs.gradle.org/current/userguide/build_cache.html
org.gradle.caching=true
# Android
android.useAndroidX=true