From fd1865db78c15674735b6685da967bdc29b8878a Mon Sep 17 00:00:00 2001 From: Krzysztof kuhy Rudnicki Date: Wed, 12 Aug 2026 21:38:13 +0200 Subject: [PATCH] Speed up release-apk CI: cache Gradle, build arm64 only MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "Build signed APK" step was ~292s of the ~350s total run, entirely spent on a cold Gradle build (no dependency/build cache) compiling and dexing a fat APK with armeabi-v7a and x86_64 native code that no device this app has ever run on needs — BL9000, the only install target, is arm64-v8a (confirmed via adb). Adds gradle/actions/setup-gradle for Gradle's dependency+build cache (flutter-action's cache only covers the Flutter SDK/pub packages, not Gradle) and restricts the build to --target-platform android-arm64. Verified locally: build succeeds, signer unchanged (CN=kuhy), output APK 22.1MB vs 61.6MB for the fat build. Co-Authored-By: Claude Opus 4.8 --- .github/workflows/release-apk.yml | 15 +++++++++++++++ pubspec.yaml | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-apk.yml b/.github/workflows/release-apk.yml index b7fd124..c58c446 100644 --- a/.github/workflows/release-apk.yml +++ b/.github/workflows/release-apk.yml @@ -51,6 +51,13 @@ jobs: channel: stable cache: true + # Caches Gradle's dependency + build cache (not covered by + # flutter-action's cache, which only covers the Flutter SDK/pub + # packages). This is what the ~5min "Build signed APK" step was mostly + # spending on a cold runner: every run re-downloaded the Gradle + # wrapper and every AGP/Kotlin/dependency artifact from scratch. + - uses: gradle/actions/setup-gradle@v4 + - name: Read version from pubspec id: ver run: | @@ -91,9 +98,17 @@ jobs: - run: flutter pub get + # arm64-v8a only: this is a personal single-device (BL9000) sideload + # distribution, not a Play Store multi-device release, and every + # device it has ever installed on is arm64-v8a (`adb shell getprop + # ro.product.cpu.abi`). A fat APK spent most of its build time + # compiling/dexing/packaging armeabi-v7a and x86_64 native code that + # is never installed anywhere. If this ever needs to run on a + # non-arm64 device, drop --target-platform to rebuild the fat APK. - name: Build signed APK run: | flutter build apk --release \ + --target-platform android-arm64 \ --build-name="${{ steps.ver.outputs.semver }}" \ --build-number="${{ steps.vc.outputs.code }}" diff --git a/pubspec.yaml b/pubspec.yaml index b9b7994..0c08990 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.0.6+1 +version: 1.0.7+1 environment: sdk: ^3.12.2