CI/CD Workflow

Overview

Mobile application compilation, signing, and store distribution are managed using Codemagic. The Go/TS backend services remain on GitHub Actions.

🏗 Why Codemagic?

iOS applications must be compiled and signed on macOS. Because the self-hosted homelab server infrastructure is ARM Linux, we use a cloud CI/CD platform that provides macOS build runners. We selected Codemagic specifically because it:
  • Native integration with Flutter build targets.
  • Automatic management of Apple Developer signing files, certificates, and provisioning profiles.
  • Simplifies App Store Connect and Google Play Store submissions compared to configuring custom Fastlane scripts on GitHub Actions.

🛠 Build Pipelines

Build workflows are declared in mobile/flutter/codemagic.yaml.

Build Strategy

The pipeline runs the following steps on every push:
  1. Analyze: Run code analysis and lints across Melos packages.
  2. Test: Execute package-level and app-level widget/unit tests (melos run test).
  3. Assemble:
    • Android: Compile product release bundles (Android App Bundle / .aab).
    • iOS: Compile device distribution packages (iOS App Store Package / .ipa).

Toolchain Versions

  • Flutter: Pinned to version 3.44.4.
  • Java Development Kit: Pinned to JDK 21 (environment.java: 21).
  • Gradle Wrapper: Pinned to Gradle 9.1.0.

🔑 Signing and Secrets

To keep credentials secure:
  • No Certificates in Git: Signing keys, keystores, and API credentials are never committed to the repository.
  • Credential Groups: iOS certificates and Android keystores are configured in the Codemagic web dashboard under the credential groups fieldforce_android and fieldforce_ios.
  • Dynamic Signing: During the release build phase, Codemagic fetches these certificates dynamically to sign the binaries before submitting them to TestFlight or Google Play Console.

🔀 Path-Based Triggers

To prevent running expensive mobile compilation pipelines on backend changes:
  • Codemagic is configured to trigger builds only when files inside the mobile/flutter/apps/<app>/** folder, a shared package dependency (mobile/flutter/packages/**), or Melos/gradle workspace manifests change.
  • A commit touching only Go backend files will not trigger a mobile compile.

📦 Future Additions (Shorebird)

OTA (Over-The-Air) Dart code pushing via Shorebird is currently deferred. If Shorebird is adopted in the future, it will be integrated into the Codemagic build script to push hotfixes directly to devices without submitting a full App Store update.