Correctly save app/build and configuration cache for dev branch builds

This commit is contained in:
Ricki Hirner 2023-12-03 16:11:46 +01:00
parent fb7658cfaa
commit f8b1cd5b3c
No known key found for this signature in database
GPG key ID: 79A019FCAAEDD3AA
2 changed files with 21 additions and 21 deletions

View file

@ -37,11 +37,11 @@ jobs:
run: echo ${{ secrets.android_keystore_base64 }} | base64 -d >$GITHUB_WORKSPACE/keystore.jks
- name: Export library definitions
# --no-build-cache and --no-configuration-cache are required for AboutLibraries (bitfireAT/davx5#263, mikepenz/AboutLibraries#857).
# Safe to remove as soon as AboutLibraries is compatible with these caches.
run: ./gradlew --no-build-cache --no-configuration-cache -PaboutLibraries.exportPath=src/main/res/raw/ app:exportLibraryDefinitions
- name: Build signed package
# --no-configuration-cache is only required for AboutLibraries (bitfireAT/davx5#263, mikepenz/AboutLibraries#857)
# Remove it as soon as AboutLibraries is compatible with the gradle configuration cache.
run: ./gradlew app:assembleRelease
env:
ANDROID_KEYSTORE: ${{ github.workspace }}/keystore.jks

View file

@ -20,11 +20,20 @@ jobs:
java-version: 17
- uses: gradle/gradle-build-action@v2
- name: Create app/build and gradle configuration cache
if: ${{ github.ref == 'refs/heads/dev-ose' }}
uses: actions/cache@v3
with:
key: app_build-tests-without-emulator-${{ github.run_id }}
path: |
.gradle/configuration-cache
app/build
- 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
restore-keys: app_build-tests-without-emulator- # restore cache from dev branch
path: |
.gradle/configuration-cache
app/build
@ -39,15 +48,6 @@ 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
@ -62,11 +62,20 @@ jobs:
java-version: 17
- uses: gradle/gradle-build-action@v2
- name: Create app/build and gradle configuration cache
if: ${{ github.ref == 'refs/heads/dev-ose' }}
uses: actions/cache@v3
with:
key: app_build-tests-without-emulator-${{ github.run_id }}
path: |
.gradle/configuration-cache
app/build
- 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
key: app_build-tests-without-emulator
restore-keys: app_build-tests-without-emulator- # restore cache from dev branch
path: |
.gradle/configuration-cache
app/build
@ -107,15 +116,6 @@ 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