Skip to content

Commit

Permalink
Cache app/build to speed up builds
Browse files Browse the repository at this point in the history
  • Loading branch information
rfc2822 committed Nov 17, 2023
1 parent ee637e4 commit 90c72ec
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 4 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/test-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 90c72ec

Please sign in to comment.