4cbbdbfef9
Fixes uncovered by the 2026-05-22 build-config audit + the Gradle 9 +
JUnit Platform launcher requirement that just surfaced in CI:
- testRuntimeOnly junit-platform-launcher: Gradle 9 no longer auto-
injects it; tests fail with "Failed to load JUnit Platform" without
an explicit dep.
- compileSdk + targetSdk 35 -> 36: AGP 9 defaults to 36 and warns on
lower values; CI was also auto-downloading build-tools 36 at
runtime (now pre-installed in ci-android:36).
- container.image bumped to ci-android:36 to match.
- configuration-cache.problems=warn in gradle.properties: detekt 2.0-
alpha + ktlint Gradle plugin have CC compat holes; warn rather
than fail.
- androidTest dep parity: kotlin("test") + kotlinx-coroutines-test
added (was on testImplementation only).
- CI: actions/cache@v4 for ~/.gradle/{caches,wrapper} + ~/.kotlin,
keyed on gradle-wrapper.properties + libs.versions.toml + the
*.gradle.kts files. Saves ~3 min per run after warm-up.
Deferred (with trigger conditions, will land when needed): Hilt
testing artifacts + HiltTestRunner (first @HiltAndroidTest), Room
Gradle plugin + schemaDirectory (Phase 4.2), Coil 3 ImageLoader
factory sharing OkHttp (Phase 5.4), MainDispatcherRule test utility
(Phase 5.3), JUnit-5/4 split for instrumented (Phase 5+),
NetworkSecurityConfig (pre-cutover Phase 14).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
142 lines
4.7 KiB
YAML
142 lines
4.7 KiB
YAML
name: android
|
|
|
|
# Native Android (Kotlin/Compose/Media3) — M8 rewrite of the Flutter client.
|
|
# Lives side-by-side with flutter_client/ until cutover; both APKs ship from
|
|
# their respective release artifacts (minstrel-<tag>.apk = Flutter,
|
|
# minstrel-android-<tag>.apk = native) during the transition.
|
|
|
|
on:
|
|
push:
|
|
branches: [main, dev]
|
|
tags: ['v*']
|
|
paths:
|
|
- 'android/**'
|
|
- '.forgejo/workflows/android.yml'
|
|
pull_request:
|
|
branches: [main]
|
|
paths:
|
|
- 'android/**'
|
|
|
|
jobs:
|
|
build:
|
|
name: Build + lint + test
|
|
# Using flutter-ci runner label because it's the only proven-working
|
|
# label with docker that can pull our container.image. Switch to
|
|
# android-ci once the operator registers that runner label.
|
|
runs-on: flutter-ci
|
|
container:
|
|
image: git.fabledsword.com/bvandeusen/ci-android:36
|
|
|
|
defaults:
|
|
run:
|
|
working-directory: android
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Cache Gradle dirs
|
|
# Resolved deps + Gradle distribution + Kotlin daemon caches.
|
|
# Saves ~3 min per CI run after the first warm-up.
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.gradle/caches
|
|
~/.gradle/wrapper
|
|
~/.kotlin
|
|
key: gradle-${{ runner.os }}-${{ hashFiles('android/gradle/wrapper/gradle-wrapper.properties', 'android/gradle/libs.versions.toml', 'android/**/*.gradle.kts') }}
|
|
restore-keys: |
|
|
gradle-${{ runner.os }}-
|
|
|
|
- name: Make gradlew executable
|
|
run: chmod +x ./gradlew
|
|
|
|
- name: Gradle wrapper validation
|
|
run: ./gradlew --version
|
|
|
|
- name: ktlint
|
|
run: ./gradlew ktlintCheck
|
|
|
|
- name: detekt
|
|
run: ./gradlew detekt
|
|
|
|
- name: Unit tests
|
|
run: ./gradlew testDebugUnitTest
|
|
|
|
- name: Assemble debug
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
run: ./gradlew assembleDebug
|
|
|
|
- name: Upload debug APK
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
uses: forgejo/upload-artifact@v3
|
|
with:
|
|
name: minstrel-android-debug-${{ github.sha }}
|
|
path: android/app/build/outputs/apk/debug/app-debug.apk
|
|
|
|
release:
|
|
name: Build signed release APK
|
|
needs: build
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
runs-on: flutter-ci
|
|
container:
|
|
image: git.fabledsword.com/bvandeusen/ci-android:36
|
|
|
|
defaults:
|
|
run:
|
|
working-directory: android
|
|
|
|
env:
|
|
ANDROID_STORE_PASSWORD: ${{ secrets.ANDROID_STORE_PASSWORD }}
|
|
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
|
|
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Make gradlew executable
|
|
run: chmod +x ./gradlew
|
|
|
|
- name: Decode signing keystore
|
|
# Reuses the same keystore env-var contract as flutter.yml so the
|
|
# native APK is signed with the same key — Android will accept
|
|
# the upgrade in place at cutover without uninstall.
|
|
env:
|
|
ANDROID_KEYSTORE_B64: ${{ secrets.ANDROID_KEYSTORE_B64 }}
|
|
shell: bash
|
|
run: |
|
|
if [ -z "${ANDROID_KEYSTORE_B64}" ]; then
|
|
echo "::error::ANDROID_KEYSTORE_B64 missing"; exit 1
|
|
fi
|
|
KEYSTORE_PATH="${RUNNER_TEMP}/minstrel-release.keystore"
|
|
echo "${ANDROID_KEYSTORE_B64}" | base64 -d > "${KEYSTORE_PATH}"
|
|
echo "ANDROID_KEYSTORE_PATH=${KEYSTORE_PATH}" >> "${GITHUB_ENV}"
|
|
|
|
- name: Build release APK
|
|
run: ./gradlew assembleRelease
|
|
|
|
- name: Attach APK to release
|
|
# During the side-by-side period the asset name is
|
|
# minstrel-android-<tag>.apk so it doesn't collide with the
|
|
# Flutter app's minstrel-<tag>.apk. At cutover, flip this name
|
|
# to minstrel-<tag>.apk and deactivate the flutter.yml release-
|
|
# attach step (M8 phase 14.4).
|
|
shell: bash
|
|
env:
|
|
CI_TOKEN: ${{ secrets.CI_TOKEN }}
|
|
run: |
|
|
TAG="${GITHUB_REF#refs/tags/}"
|
|
REPO="${GITHUB_REPOSITORY}"
|
|
RELEASE_ID=$(curl -fsSL \
|
|
-H "Authorization: token ${CI_TOKEN}" \
|
|
"https://git.fabledsword.com/api/v1/repos/${REPO}/releases/tags/${TAG}" \
|
|
| grep -oP '"id":\s*\K[0-9]+' | head -1)
|
|
if [ -z "${RELEASE_ID}" ]; then
|
|
echo "::error::release for ${TAG} not found"; exit 1
|
|
fi
|
|
curl -fsSL \
|
|
-H "Authorization: token ${CI_TOKEN}" \
|
|
-F "attachment=@app/build/outputs/apk/release/app-release.apk" \
|
|
"https://git.fabledsword.com/api/v1/repos/${REPO}/releases/${RELEASE_ID}/assets?name=minstrel-android-${TAG}.apk"
|