c1fb2355c4
Adopts the FabledRulebook ci-runners.md policy: workflows select
toolchains via container.image, not via runs-on labels. `runs-on`
stays as the scheduling handle only.
Workflows updated:
- test-go.yml: ci-go:1.26 on both `test` and `integration` jobs.
- test-web.yml: ci-go:1.26 (bundles Node + npm); the
actions/setup-node@v4 step is removed.
- flutter.yml: ci-flutter:3.44 (Flutter 3.44 + Android + Java 25).
- release.yml: ci-go:1.26 (ships docker CLI + buildx).
Side effect: this unblocks the Go server deps bump (commit 6a62120)
which auto-bumped go.mod to `go 1.25.0` via x/crypto v0.51.0's
minimum — ci-go:1.26 satisfies it with headroom.
Adds ci-requirements.md at repo root per the ci-runners.md
"every project ships a requirements sheet" rule. Documents:
runtime images consumed, image deps used per workflow, per-job
installs (none), and a Notes section covering the integration
docker-socket dependency, the toolchain pin rationale, and the
in-app-update channel polling.
Tracked in local task #70.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
153 lines
6.0 KiB
YAML
153 lines
6.0 KiB
YAML
name: flutter
|
|
|
|
# Analyze + test the Flutter mobile client; build an APK only where
|
|
# it's actually consumed. dev pushes: analyze+test+codegen only
|
|
# (~3min) — the operator dev-tests via a local Android Studio build,
|
|
# not the CI artifact. main pushes: also build a debug APK as the
|
|
# native-build safety net (Gradle/manifest/plugin breakage that
|
|
# analyze+test can't catch) before any release tag. tags: signed
|
|
# release APK. Only runs when the diff touches flutter_client/ or a
|
|
# shared web input sync_shared.sh copies.
|
|
|
|
on:
|
|
push:
|
|
branches: [dev, main]
|
|
tags: ['v*']
|
|
paths:
|
|
- 'flutter_client/**'
|
|
- 'web/src/lib/styles/tokens.json'
|
|
- 'web/src/lib/styles/error-copy.json'
|
|
- 'web/static/placeholders/album-fallback.svg'
|
|
- '.forgejo/workflows/flutter.yml'
|
|
pull_request:
|
|
branches: [main]
|
|
paths:
|
|
- 'flutter_client/**'
|
|
- 'web/src/lib/styles/tokens.json'
|
|
- 'web/src/lib/styles/error-copy.json'
|
|
- 'web/static/placeholders/album-fallback.svg'
|
|
- '.forgejo/workflows/flutter.yml'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
analyze-test-build:
|
|
# Toolchain selected via container.image per ci-runners.md
|
|
# (label = scheduling handle, image = environment). The ci-flutter
|
|
# image ships Flutter SDK + Android cmdline-tools/platform/build-tools
|
|
# + Java 25. See ci-requirements.md.
|
|
runs-on: flutter-ci
|
|
container:
|
|
image: git.fabledsword.com/bvandeusen/ci-flutter:3.44
|
|
|
|
defaults:
|
|
run:
|
|
working-directory: flutter_client
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Sync shared assets from web/
|
|
run: ./tool/sync_shared.sh
|
|
|
|
- name: Verify generated tokens.dart matches JSON
|
|
shell: bash
|
|
run: |
|
|
dart run tool/gen_tokens.dart
|
|
if ! git diff --exit-code lib/theme/tokens.dart; then
|
|
echo "::error::lib/theme/tokens.dart is out of sync with shared/fabledsword.tokens.json"
|
|
echo "Run: cd flutter_client && dart run tool/gen_tokens.dart"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Pub get
|
|
run: flutter pub get
|
|
|
|
- name: Codegen (drift, etc.)
|
|
# build_runner generates *.g.dart files (drift schemas, etc.)
|
|
# which are gitignored. Must run before analyze + test so the
|
|
# generated symbols exist.
|
|
run: dart run build_runner build --delete-conflicting-outputs
|
|
|
|
- name: Analyze
|
|
run: flutter analyze --fatal-infos
|
|
|
|
- name: Test
|
|
run: flutter test --reporter compact
|
|
|
|
- name: Build debug APK
|
|
# main-only: native-build safety net before release tags.
|
|
# dev skips this (~7min) — operator dev-tests locally.
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
run: flutter build apk --debug
|
|
|
|
- name: Decode signing keystore
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
# Reconstructs the release keystore from a base64-encoded
|
|
# CI secret so every tagged build is signed with the same
|
|
# key. Without this, each CI runner would generate its own
|
|
# debug keystore and Android would refuse to upgrade an
|
|
# existing install (signature mismatch).
|
|
shell: bash
|
|
env:
|
|
ANDROID_KEYSTORE_B64: ${{ secrets.ANDROID_KEYSTORE_B64 }}
|
|
run: |
|
|
if [ -z "${ANDROID_KEYSTORE_B64}" ]; then
|
|
echo "::error::ANDROID_KEYSTORE_B64 secret is missing — release builds need a consistent signing key"
|
|
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
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
# Inject the tag (sans leading 'v') as the build's --build-name
|
|
# so PackageInfo.version matches what /api/client/version
|
|
# reports — otherwise the in-app update banner would always
|
|
# think the user is behind because pubspec.yaml's static
|
|
# version drifts from the actual release tag.
|
|
#
|
|
# ANDROID_KEYSTORE_PATH is set by the previous step;
|
|
# build.gradle.kts picks it up and signs the release APK with
|
|
# the operator's persistent keystore.
|
|
shell: bash
|
|
env:
|
|
ANDROID_STORE_PASSWORD: ${{ secrets.ANDROID_STORE_PASSWORD }}
|
|
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
|
|
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
|
|
run: |
|
|
TAG="${GITHUB_REF#refs/tags/v}"
|
|
flutter build apk --release --build-name="${TAG}"
|
|
|
|
- name: Upload debug APK artifact
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
uses: forgejo/upload-artifact@v3
|
|
with:
|
|
name: minstrel-debug-${{ github.sha }}
|
|
path: flutter_client/build/app/outputs/flutter-apk/app-debug.apk
|
|
|
|
- name: Attach release APK to release
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
shell: bash
|
|
env:
|
|
CI_TOKEN: ${{ secrets.CI_TOKEN }}
|
|
run: |
|
|
TAG="${GITHUB_REF#refs/tags/}"
|
|
REPO="${GITHUB_REPOSITORY}"
|
|
# Look up the release ID for this tag. The release object must
|
|
# exist already — operator creates it (or release.yml will, in
|
|
# a future enhancement) before pushing the tag.
|
|
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 ${TAG} not found"
|
|
exit 1
|
|
fi
|
|
curl -fsSL \
|
|
-H "Authorization: token ${CI_TOKEN}" \
|
|
-F "attachment=@build/app/outputs/flutter-apk/app-release.apk" \
|
|
"https://git.fabledsword.com/api/v1/repos/${REPO}/releases/${RELEASE_ID}/assets?name=minstrel-${TAG}.apk"
|