116 lines
4.2 KiB
YAML
116 lines
4.2 KiB
YAML
# Codemagic CI/CD for ratune_mobile (Flutter).
|
|
# The repo root IS the Flutter project, so scripts run from the app directory
|
|
# with no `working_directory` override. Two workflows: Android (Linux) and
|
|
# iOS (mac). Docs: https://docs.codemagic.io/yaml/yaml-getting-started/
|
|
|
|
definitions:
|
|
# Shared quality gate — anchored per-step (YAML can't splice a list into a
|
|
# list, only reference individual map items). Toolchain is pinned inline in
|
|
# each workflow to Flutter 3.44.8 / Dart 3.12.2 (the local dev version);
|
|
# change to `stable` for the latest, or bump when you upgrade.
|
|
scripts:
|
|
- &flutter_version
|
|
name: Flutter version
|
|
script: flutter --version
|
|
- &get_deps
|
|
name: Get dependencies
|
|
script: flutter pub get
|
|
- &analyze
|
|
name: Analyze
|
|
script: flutter analyze
|
|
- &unit_tests
|
|
name: Unit tests
|
|
script: |
|
|
mkdir -p test-results
|
|
flutter test --machine --coverage > test-results/flutter.json
|
|
test_report: test-results/flutter.json
|
|
|
|
workflows:
|
|
# ---------------------------------------------------------------------------
|
|
android:
|
|
name: Android (APK + AAB)
|
|
# mac_mini_m1 is the free-tier / most widely available instance and builds
|
|
# Android fine. If your plan includes Linux, `linux_x2` is cheaper/faster
|
|
# for Android-only builds.
|
|
instance_type: mac_mini_m1
|
|
max_build_duration: 60
|
|
environment:
|
|
flutter: 3.44.8
|
|
java: 17
|
|
# Uncomment once you add a keystore to Codemagic (Teams → Code signing
|
|
# identities → Android) and reference its group here to sign releases.
|
|
# groups:
|
|
# - android_keystore # CM_KEYSTORE, CM_KEYSTORE_PASSWORD, CM_KEY_ALIAS, CM_KEY_PASSWORD
|
|
cache:
|
|
cache_paths:
|
|
- $HOME/.pub-cache
|
|
- $HOME/.gradle/caches
|
|
# triggering:
|
|
# events: [push, tag]
|
|
# branch_patterns:
|
|
# - pattern: main
|
|
# include: true
|
|
scripts:
|
|
- *flutter_version
|
|
- *get_deps
|
|
- *analyze
|
|
- *unit_tests
|
|
# NOTE: android/app/build.gradle.kts currently signs `release` with the
|
|
# DEBUG key (Flutter template default), so these build & install but are
|
|
# not upload-ready. To ship: add a real signingConfig backed by
|
|
# key.properties / the CI env vars above — this step then needs no change.
|
|
- name: Build APK (release)
|
|
script: flutter build apk --release
|
|
- name: Build App Bundle (release)
|
|
script: flutter build appbundle --release
|
|
artifacts:
|
|
- build/app/outputs/flutter-apk/*.apk
|
|
- build/app/outputs/bundle/**/*.aab
|
|
- build/app/outputs/**/mapping.txt
|
|
- flutter_drive.log
|
|
# publishing:
|
|
# email:
|
|
# recipients:
|
|
# - you@conversionpath.com
|
|
# notify:
|
|
# success: true
|
|
# failure: true
|
|
# # google_play:
|
|
# # credentials: $GCLOUD_SERVICE_ACCOUNT_CREDENTIALS
|
|
# # track: internal
|
|
|
|
# ---------------------------------------------------------------------------
|
|
ios:
|
|
name: iOS (unsigned build)
|
|
instance_type: mac_mini_m1
|
|
max_build_duration: 60
|
|
environment:
|
|
flutter: 3.44.8
|
|
java: 17
|
|
cache:
|
|
cache_paths:
|
|
- $HOME/.pub-cache
|
|
- $HOME/.gradle/caches
|
|
scripts:
|
|
- *flutter_version
|
|
- *get_deps
|
|
- *analyze
|
|
- *unit_tests
|
|
# Compiles the iOS app without code signing — verifies the build on CI.
|
|
# Produces a .app (not an installable/uploadable .ipa).
|
|
- name: Build iOS (no codesign)
|
|
script: flutter build ios --release --no-codesign
|
|
artifacts:
|
|
- build/ios/iphoneos/*.app
|
|
- flutter_drive.log
|
|
|
|
# --- To produce a signed, uploadable IPA instead: configure App Store
|
|
# --- Connect + signing in Codemagic (Teams → Integrations → App Store
|
|
# --- Connect), then add `ios_signing` to `environment` and replace the
|
|
# --- build step with:
|
|
# - name: Set up provisioning profiles
|
|
# script: xcode-project use-profiles
|
|
# - name: Build IPA
|
|
# script: flutter build ipa --release --export-options-plist=/Users/builder/export_options.plist
|
|
# --- with artifacts: build/ios/ipa/*.ipa and
|
|
# --- publishing.app_store_connect.submit_to_testflight: true
|