From 69df06294dcff59ab529f847b4541c6ae98d8511 Mon Sep 17 00:00:00 2001 From: Dan Caseley Date: Thu, 19 Nov 2026 12:13:01 +0000 Subject: [PATCH] Cache Gradle downloads in the Android build build-android had no Gradle cache (the Flutter action caches the Flutter SDK, not ~/.gradle), so every run downloaded all of Gradle's dependencies, including the plugins for Flutter's own Gradle plugin loader. That is slow, and makes the job fail whenever those repositories hiccup: a fork run failed with the Gradle Plugin Portal answering "Could not find org.jetbrains.kotlin:kotlin-stdlib:2.2.21" for an artifact that exists, and passed on re-run. Gradle's own download retries don't help there, as a not-found response is treated as definite. Add gradle/actions/setup-gradle@v6 to build-android, before the first Gradle build. Its init scripts apply to every Gradle run in the job, including those started by `flutter build apk`, and it caches the Gradle User Home (dependencies, wrapper distributions, generated jars) between runs. Only default-branch runs write the cache; branch and pull-request runs restore it. build-android is the only job that runs Gradle; maestro-e2e uses the APK it uploads. It uses the default (enhanced) cache provider: proprietary, under the Gradle Technologies Terms of Use, free for public repositories, with restore-key matching and cleanup. `cache-provider: basic` is the MIT-licensed alternative. No retry around the build step: with a warm cache the repositories are rarely contacted, and a retry would mostly delay genuine failures. Testing: - Workflow YAML parses; the step is in build-android immediately before "Build Android (release)". - Merges cleanly with the version-fixes and prerelease ordering branches (#5, #6). - flutter analyze: no issues. flutter test: all 1044 passed. vendor/xmpp_stone dart test: all 190 passed. - Maestro flows not run locally: CI-only change; the CI maestro-e2e job covers them. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 78b6bf1e..1f8bb1dc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -487,6 +487,9 @@ jobs: echo "Build version set to ${version}" - name: Install dependencies run: flutter pub get + - name: Set up Gradle caching + # Caches Gradle downloads between runs, including for `flutter build`. + uses: gradle/actions/setup-gradle@v6 - name: Build Android (release) run: flutter build apk --release - name: Upload Android artifact