Setup CI on Gitlab for Flutter

I suggest to setup your GitLab CI integration for flutter treating the android and ios project folder by their own in order to build your APK or IPA or doing test with your GitLab CI.

To start having a clue on how to setup a CI for Android and iOS projects on GitLab I'll suggest you these readings:

Android:

  • https://about.gitlab.com/2018/10/24/setting-up-gitlab-ci-for-android-projects/

iOS

  • https://about.gitlab.com/2016/03/10/setting-up-gitlab-ci-for-ios-projects/
  • https://medium.com/flawless-app-stories/how-to-set-up-gitlab-continuous-integration-for-ios-projects-without-a-hustle-53c2b642c90f

UPDATE: using Fastlane

I've the above solutions running on my apps and so I know they work. But I've found these interesting official docs for flutter using Fastlane (they seem quite easier):

  • https://flutter.io/docs/deployment/fastlane-cd
  • https://docs.fastlane.tools/best-practices/continuous-integration/gitlab/

So I suggest to give them a try too.


.gitlab-ci.yml in your repo root:

stages:
  - test

tests:
  image: cirrusci/flutter
  stage: test
  script:
  - flutter test