Don't use Gradle build and configuration cache for releases (#662)

* Don't use Gradle build and configuration cache for releases

- don't enable Gradle build and configuration cache for the project, but recommend it for the developer
- explicitly enable Gradle build and configuration cache for CI test jobs
- let AboutLibraries generate lib definitions itself again
- also don't archive test results (sometimes fails and we never use the results)

* Add encryption key for gradle cache

* Only warn on configuration cache problems (caused by AboutLibraries)
This commit is contained in:
Ricki Hirner
2024-03-20 15:29:21 +01:00
committed by GitHub
parent 6c882877d0
commit 06e7eeb391
5 changed files with 21 additions and 36 deletions

View File

@@ -34,6 +34,8 @@ jobs:
distribution: 'temurin'
java-version: 17
- uses: gradle/actions/setup-gradle@v3
with:
cache-encryption-key: ${{ secrets.gradle_encryption_key }}
- name: Use app/build and gradle configuration cache
uses: actions/cache/restore@v4
@@ -55,7 +57,7 @@ jobs:
# uses: github/codeql-action/autobuild@v2
- name: Build
run: ./gradlew --no-daemon app:assembleOseDebug
run: ./gradlew --build-cache --configuration-cache --configuration-cache-problems=warn --no-daemon app:assembleOseDebug
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3

View File

@@ -29,14 +29,9 @@ jobs:
- name: Prepare keystore
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
# Make sure that caches are disabled to generate reproducible release builds
run: ./gradlew --no-build-cache --no-configuration-cache app:assembleRelease
run: ./gradlew --no-build-cache --no-configuration-cache --no-daemon app:assembleRelease
env:
ANDROID_KEYSTORE: ${{ github.workspace }}/keystore.jks
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.android_keystore_password }}

View File

@@ -19,6 +19,8 @@ jobs:
distribution: temurin
java-version: 17
- uses: gradle/actions/setup-gradle@v3
with:
cache-encryption-key: ${{ secrets.gradle_encryption_key }}
- name: Create app/build and gradle configuration cache
if: ${{ github.ref == 'refs/heads/dev-ose' }}
@@ -39,15 +41,7 @@ jobs:
app/build
- name: Run lint and unit tests
run: ./gradlew app:check
- name: Archive results
uses: actions/upload-artifact@v4
with:
name: test-results
path: |
app/build/outputs/lint*
app/build/reports
overwrite: true
run: ./gradlew --build-cache --configuration-cache --configuration-cache-problems=warn app:check
test_on_emulator:
name: Tests with emulator
@@ -59,6 +53,8 @@ jobs:
distribution: temurin
java-version: 17
- uses: gradle/actions/setup-gradle@v3
with:
cache-encryption-key: ${{ secrets.gradle_encryption_key }}
- name: Create app/build and gradle configuration cache
if: ${{ github.ref == 'refs/heads/dev-ose' }}
@@ -91,12 +87,5 @@ jobs:
key: avd-${{ hashFiles('app/build.gradle.kts') }} # gradle-managed devices are defined there
- name: Run device tests
run: ./gradlew --no-daemon app:virtualCheck
run: ./gradlew --build-cache --configuration-cache --configuration-cache-problems=warn app:virtualCheck
- name: Archive results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results
path: app/build/reports
overwrite: true