diff --git a/.github/workflows/android-tests.yml b/.github/workflows/android-tests.yml index 8080e4d..46fbd65 100644 --- a/.github/workflows/android-tests.yml +++ b/.github/workflows/android-tests.yml @@ -25,6 +25,11 @@ 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. 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 working-directory: android_app diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 00c42e3..f2783b4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -53,6 +53,10 @@ 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: @@ -87,13 +91,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