Flutterexperts

Empowering Vision with FlutterExperts' Expertise
CI/CD with CodeMagic | Flutter

These days approaches for code delivery are gradually changing when writing quality code and the fine product delivery is a need of the time and in this situation, developers find themselves in the dilemma to manage both things at the same time but now this is not a big deal because of CI/CD(Continuous Integration/Continuous Delivery). So let’s first know about CI/CD.

What is CI/CD

It can be easily understood by its name Continuous Integration/Continuous Delivery and it is the process to directly merge your product version(code) into the main branch of your code and also helps to get builds of the product on the daily basis and also look after the integration problems, CI helps to trigger the build whenever code is pushed and integration tests make sure that the new part which has been added to the application does not break the previous build of the application and if the test or the build fails then ensure that the app remains stable, While CD is Continuous Deployment or Continuous Delivery is the automatic deployment of an app (to production).

Now let’s understand how to implement it

There are various ways to implement CI/CD and we are going to get it done by using Code Magic. It was launched at Flutter Live in December 2018 in cooperation with Google, Code Magic provides various options to implement CI/CD.

You can log in with any mentioned account, and now I am going to implement it by using GitHub.

But you should remember one thing your GitHub/Bitbucket/GitLab should have a repository in which you want to implement CI/CD.

After login with any particular account, You will navigate to the home page of code magic.

You will find this kind of screen now you have to choose in which repo you want to implement CI/CD. So here in every repository, you can see a setting icon and “start new build” options so before going to build option first we need to set up our repository for different workflows and many more options are there.

So at first, we click on that icon right before the “start new build” option and you will navigate to this screen.

Here you need to set up different workflows for a different kind of delivery and testing like Default workflow, Dev workflow, QA workflow, so create it by clicking “Duplicate workflow” in ton right side of the screen.

After creating duplicate workflows you can choose which workflow you need which type of customization (as shown in the above screen).

You also need to implement the same branches in your repo and that could be master, QA, dev.

So every time you need to push your code from dev (it is your choice) and then you need to merge changes into different branches in your GitHub.

After that, you need to select different workflows one by one and customize the setting according to your need, and I started the customization from Dev workflow and the first option I found to customize is “Build triggers”.

Here I have clicked on triggered on push, so every time we push over code over GitHub we will get a new build, you can choose different options according to your need for different workflows.

After that, we move to the next option below it where we would make some changes and this is “Test”.

As you can understand by seeing it, if the test fails, it automatically stops build.

Next option is “Build

In this, you can select the flutter version, platforms, in which mode you want to release your app,

and the next part is ‘Publish,

here you can select you to publish options like where you want to share your build or changes, even you can update your app in play store and apple app store directly and for this, you only need to fill some info by clicking on Android code signing and iOS code signing, you can share your build over email by providing mail addresses directly.

After all these customizations you need to click on “start new Build” top of the page and you will navigate to this page

here you can select your branch your workflow and by clicking on which type of build you want you can move forward. when you click any of the options you will find that it started creating a new build for every platform you selected during customization

and after completing its build you will receive builds on all platforms you selected. So here is the image of my mail inbox where I received a mail of new build now I can download Apk and test if the new changes are working fine or not.

So this was the small introduction of CI/CD through code magic.

Thanks for reading this article if you find anything that could be improved please let me know, I would love to improve.


Feel free to connect with us
And read more articles from FlutterDevs.com


FlutterDevs team of Flutter developers to build high-quality and functionally-rich apps. Hire flutter developer for your cross-platform Flutter mobile app project on an hourly or full-time basis as per your requirement! You can connect with us on Facebook, GitHub, and Twitter for any flutter related queries.

Leave comment

Your email address will not be published. Required fields are marked with *.