From fa57c002d678284617df1d9d0db57e7ee30cc8df Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 3 Jul 2026 20:37:53 +0000 Subject: [PATCH 1/2] Enable Gradle configuration and build caches Turn on org.gradle.configuration-cache and org.gradle.caching, run the Cut Release tests and signed build in one Gradle invocation (one configuration phase, one daemon), and pass an optional GRADLE_ENCRYPTION_KEY to setup-gradle so the configuration cache can persist across CI runs when the secret is configured. --- .github/workflows/android-tests.yml | 3 +++ .github/workflows/release.yml | 16 ++++++++++------ CHANGELOG.md | 1 + android_app/gradle.properties | 7 +++++++ 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/.github/workflows/android-tests.yml b/.github/workflows/android-tests.yml index 8080e4d..c1442d2 100644 --- a/.github/workflows/android-tests.yml +++ b/.github/workflows/android-tests.yml @@ -25,6 +25,9 @@ jobs: uses: gradle/actions/setup-gradle@v4 with: gradle-version: "9.5.0" + # Optional: persists the Gradle configuration cache across runs when + # a GRADLE_ENCRYPTION_KEY secret exists; harmless when unset. + cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} - name: Run unit tests working-directory: android_app diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 00c42e3..88f0e2e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -57,6 +57,11 @@ jobs: uses: gradle/actions/setup-gradle@v4 with: gradle-version: "9.5.0" + # Optional: lets the Gradle configuration cache persist across runs + # (create the secret with e.g. `openssl rand -base64 16`). Without it + # the configuration cache is rebuilt each run and its data — which + # includes the signing config — is never uploaded to the cache. + cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} - name: Bump version, fold changelog, tag id: bump @@ -87,13 +92,12 @@ jobs: ANDROID_RELEASE_KEY_ALIAS: ${{ secrets.ANDROID_RELEASE_KEY_ALIAS }} ANDROID_RELEASE_KEY_PASSWORD: ${{ secrets.ANDROID_RELEASE_KEY_PASSWORD }} - - name: Run unit tests + # One Gradle invocation for both: a failing test still aborts the release + # before anything is pushed, and the build pays the configuration phase + # and daemon start only once. + - name: Run tests and build signed release APK working-directory: android_app - run: gradle test - - - name: Build signed release APK - working-directory: android_app - run: gradle assembleRelease + run: gradle test assembleRelease - name: Name release APK id: apk diff --git a/CHANGELOG.md b/CHANGELOG.md index 1503057..78c8675 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## Unreleased +- Speed up Gradle builds locally and in CI: enable the configuration cache and build cache, and make Cut Release run the tests and the signed build in a single Gradle invocation. - Run CI tests only on pull requests: drop the push-to-master trigger, since everything reaching master goes through a tested PR or the Cut Release workflow, which runs the tests itself. ## v1.1.0 - 2026-07-03 diff --git a/android_app/gradle.properties b/android_app/gradle.properties index 5bac8ac..3392abe 100644 --- a/android_app/gradle.properties +++ b/android_app/gradle.properties @@ -1 +1,8 @@ android.useAndroidX=true + +# Cache Gradle's configuration phase and task outputs. In CI, setup-gradle +# persists task outputs across runs; configuration-cache data is only persisted +# when a GRADLE_ENCRYPTION_KEY secret is configured (it can contain signing +# credentials, so it is never uploaded unencrypted). +org.gradle.configuration-cache=true +org.gradle.caching=true From eac1761f088d7592319488a4eee2b233a7fddf79 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 3 Jul 2026 20:41:21 +0000 Subject: [PATCH 2/2] Never persist the release job's configuration cache The Cut Release configuration cache embeds the signing config, so drop the cache-encryption-key from that workflow entirely; it is rebuilt each run. Keep the optional key on the PR test workflow, whose runs have no keystore and therefore no signing data in the cache. --- .github/workflows/android-tests.yml | 4 +++- .github/workflows/release.yml | 9 ++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/android-tests.yml b/.github/workflows/android-tests.yml index c1442d2..46fbd65 100644 --- a/.github/workflows/android-tests.yml +++ b/.github/workflows/android-tests.yml @@ -26,7 +26,9 @@ jobs: with: gradle-version: "9.5.0" # Optional: persists the Gradle configuration cache across runs when - # a GRADLE_ENCRYPTION_KEY secret exists; harmless when unset. + # a GRADLE_ENCRYPTION_KEY secret exists; harmless when unset. Safe + # here: test runs have no keystore, so their configuration cache + # contains no signing data (unlike Cut Release, which never sets this). cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} - name: Run unit tests diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 88f0e2e..f2783b4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -53,15 +53,14 @@ jobs: distribution: temurin java-version: "17" + # No cache-encryption-key here on purpose: this job's configuration cache + # embeds the signing config, so it must never be persisted to the Actions + # cache. It is rebuilt each run (a few seconds); the dependency cache and + # the single combined Gradle invocation carry the speedup. - name: Set up Gradle uses: gradle/actions/setup-gradle@v4 with: gradle-version: "9.5.0" - # Optional: lets the Gradle configuration cache persist across runs - # (create the secret with e.g. `openssl rand -base64 16`). Without it - # the configuration cache is rebuilt each run and its data — which - # includes the signing config — is never uploaded to the cache. - cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} - name: Bump version, fold changelog, tag id: bump