D
DevOps & CI/CDMedium30 XP5 min read

How do you set up CI/CD for Flutter with GitHub Actions?

TL;DR: Use the subosito/flutter-action GitHub Action to set up Flutter. Chain steps: checkout → setup Flutter → get packages → analyze → test → build APK/IPA. Store signing credentials in GitHub Secrets.

Full Answer

A CI pipeline catches regressions before they reach users. For Flutter, a typical pipeline runs: static analysis → unit tests → widget tests → build for all platforms.

Pipeline Steps

  • Checkout code (actions/checkout)
  • Setup Flutter (subosito/flutter-action@v2)
  • Install dependencies (flutter pub get)
  • Analyze (flutter analyze) — catches type errors
  • Test (flutter test --coverage)
  • Build (flutter build apk / flutter build ipa)
  • Upload artifact or deploy to store

Code Examples

yaml.github/workflows/flutter.yml
Output
// Runs on every PR and push to main
// Blocks merge if analysis or tests fail

Common Mistakes

  • Not caching Flutter installation — adds 5+ minutes to every run without cache: true
  • Storing signing keystores in the repository — use GitHub Secrets and base64-encode the keystore

Interview Tip

💡

Show the full pipeline: analyze → test → build. Mention that --fatal-infos in flutter analyze turns info-level hints into build failures for stricter quality gates.

#github-actions#ci-cd#flutter-build#automation