Speed up release-apk CI: cache Gradle, build arm64 only
Some checks are pending
release-apk / release (APK) (push) Waiting to run

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 <noreply@anthropic.com>
This commit is contained in:
Krzysztof Rudnicki 2026-08-12 21:38:13 +02:00
parent ce2ea5b410
commit fd1865db78
2 changed files with 16 additions and 1 deletions

View File

@ -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 }}"

View File

@ -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