Flutter CI/CD, Which One and Why
Why does flutter need CI/CD? What is CI/CD? I hope we can find the answer after reading this article. CI/CD stands for (Continuous Integration/Continuous Delivery)actually, the CD can also stand for Continuous Deployment. I’ll explain briefly about CI/CD
Continuous integration(CI) is a practice to merge all developer working code from different branches and integrate it into a single branch in the repository. There is no standard on how many times we need to do this practice. Some companies probably prefer to do it every once a week, or several times a day depending on the company culture.
Continuous Delivery is an approach to deliver our latest code, bug fixes, new features, or any changes to production or to users safely. Safely means before the code delivered to production is gone through the test phase to ensure the quality of the app. By using this approach, the engineering team will be able to produce software faster and allow for incremental updates.
Continuous Deployment is the automation of Continuous Delivery. All steps that needed to deploy our app are automatic. We just need to configure/set-up the process and push the latest code into the repository. CD tools will do the deployment work for us.
CI/CD is actually not a new practice, and it also can be used for many applications, not only mobile. But in this article, I just explain about CI/CD in a flutter.
For any mobile development process either it’s for iOS or Android it is complex and overwhelming especially for those who come from non-mobile development or never deploy apps to play store or app store. Flutter has a detailed guide on how to deploy your flutter app, but once you have prepared for deployment, you are still not done. There are many steps that you must do, such as upload the app binary, signed apk, etc.
Engineers have so much configuration work to release the app. In an ideal case, flutter developers should be focusing on building business features rather than configure tools. That’s why CI/CD comes in handy. CI/CD will help the flutter developer to perform all deployment tasks. There is three CI/CD platform that I want to highlight :
Fastlane is a free CI/CD tool(MIT License) to automate deployments and releases for android and iOS apps. But officially, Fastlane is only supported to run on macOS. There is a way to run Fastlane in windows/Linux but you need to do some configuration or manual installation and it only covers parts of it. Fastlane’s goal is to help with the mobile deployment, but it’s not designed for a specific programming language, as long as developers can give access to the iOS/android folder we can use Fastlane. CI/CD with Fastlane also can be categorized as a local build, because the building code is within our code. But it also supports other CI/CD platforms such as bitrise, codemagic, circleCI, jenkins, and many more.
Bitrise is a platform as a service with the main focus on mobile app development. It has a lot of plugins that we can use to customize our CI/CD build flow. And it is fully featured CI/CD for mobile apps, It supports not only native but also hybrid code such as flutter, react native, and ionic. It also allows the developer to custom the build flow, from a simple(just build your app) to a very complex(testing, reports, connect with backend, etc), we can custom it as we want. Have a full team or organization support and many more. But, even though bitrise is a mature CI/CD platform it still has some downside :
a)Each plugin can depend on a different version of flutter so when our code didn’t match with the plugin version, it will be a bad experience for us. b)it officially supports macOS and Linux. There is actually a request for a windows platform, but until I made this article the last reply was “it’s still planned but not scheduled yet”.c)Timeout builds in pricing. After reading some reviews about bitrise, most of them are disappointed with the timeout build. Based on the app, it can take more than 60–90 min to build the iOS app, and because of the timeout limit build ended up failing. Pricing :
Unlike Fastlane and Bitrise, Codemagic is CI/CD that is built specifically for a flutter. Many flutter developers are recommended to use this CI/CD because it is easy to automate the process of CI/CD for flutter apps from single automation with minimum effort and without macOS. Like bitrise, a couple of integrations for BitBucket, Github, and GitLab are already available in Codemagic. In several articles, it is said that codemagic is faster than bitrise when building an iOS app. CodeMagic is highly recommended if we’re working only in flutter within our workflow, things get complicated if we also need to build back-end integration or if not all our app aren’t built with flutter(but CodeMagic give tips and trick to integrate with existing fastlane code, and also firebase). The ability to build a screenshot of app is also limited and needs to be configured inside our flutter app.
All of them are great tools for CI/CD and it’s only some of the CI/CD platforms that are available. Every platform has its benefits and also limitations. I will not choose or compare which one is better because we have different circumstances that affect our judgment/selection. Choose CI/CD that works best for you or for your team or company. In my company, Glovory, we are probably going to choose codemagic as our CI/CD because mobile teams have different types of OS to work with. We use macOS, linux and windows. I hope this article can give you an insight about CI/CD for flutter, and encourage you to use CI/CD for better mobile apps development.
Check my other article on Firebase App Distribution vs Internal Test Track or our Flutter Firebase Authentication Tutorial in bahasa
Contributor : Nashiruddin Abubakar