Flutter CI/CD using Codemagic is buttery smooth! Highly recommend!

0 62
Avatar for nolyoi
Written by
3 years ago
Topics: Flutter, Dart, Code, Coding, Programming, ...

Flutter CI/CD using Codemagic

Previously for my Flutter apps, I was using Microsoft's AppCenter for CI/CD purposes.

I decided to move away from this for primarily 2 reasons. The first reason being the lack of support for Flutter. Without native support for Flutter applications, you need a separate build for every app (Android, iOS, Web, Windows, etc.). So, if I'm developing a mobile app, I have to create a separate build for Android and another for iOS. With Codemagic, it's all done within a single build/repo.

Secondly, the pre and post scripting to get it to work with Flutter. In addition to requiring multiple builds, you also have to run pre and post scripts just to get it to build the Flutter application properly. Another thing that can be avoided and result in less overhead with Codemagic.

While researching CI/CD solutions for Flutter, one of the first I came across was Codemagic.

Codemagic provides 500 minutes of build time per month for free, which is a pretty nice deal. It should be enough for any small or single developer projects. I personally have not exceeded the limit in my use of Codemagic, yet. I don't use it THAT much, so 500 is plenty for me.

They also offer a pay as you go plan as well. So, after you use your 500 minutes, you can pay X amount per minute after. All build are done on a Mac OS virtual machine.

The main reason I switched to Codemagic is because they ACTUALLY support Flutter! 1 build that tests all of the apps! Like I said before, with AppCenter you have more builds which means more overhead. And more overhead means more potential problems. Right!? This simplifies a lot of the process I was doing with MS AppCenter.

Getting Started with Codemagic

After creating an account, you can add your application from a given source, whether that be GitHub, GitLab, BitBucket, self-hosted, or any other Git source. I myself use the classic Github. :) I'm quite traditional. :P

From there, you a presented with a screen where you can set your various build options.

This includes things such as the build triggers (I use commits to the Master branch as my trigger), which branches you want builds ran on, environment variables, tests dependency caching, publishing, pre and post build scripts, other misc. settings and more!

Once you have your options set, then you are ready to run your first Codemagic CI/CD build!

I noticed the build did take a bit longer than expected, well, my iOS build took longer than expected I suppose. I found out later this has to do with iOS podfiles and more specifically the Firebase Firestore one.

If you use Firebase on Flutter, you can expect longer build times with iOS. Hopefully they can get this fixed soon. The build time is about 8x that of Android! But, we have to work with what we have, right?

Below is a screenshot of what the build screen looks like as your app build is being ran.

Conclusions - I LOVE IT!

My experience with Codemagic thus far has been great! I really have no complaints other than the slow iOS build. But, as I stated above, that isn't a Codemagic issue, it's a Firebase issue and will be the same in any CI/CD application.

The integration with Flutter is buttery smooth. It was super easy to get set up compared to AppCenter. I literally had my app being built in less than 10 minutes as opposed to hours with AppCenter and that's pretty awesome if you ask me.

If you are a Flutter dev or are developing any other Codemagic supported softwares, definitely give them a look as they offer a very reasonable free plan in addition to reasonably priced pay as you go services.

I've included a screenshot below of their pricing models for anyone who is interested in that information.

1
$ 0.56
$ 0.56 from @TheRandomRewarder
Avatar for nolyoi
Written by
3 years ago
Topics: Flutter, Dart, Code, Coding, Programming, ...

Comments