Loading... Search articles

Search for articles

Sorry, but we couldn't find any matches...

But perhaps we can interest you in one of our more popular articles?
How to set up Codemagic CI/CD for Flutter apps hosted on Bitbucket
Some content in this post might be outdated. It was written before Codemagic became from a Flutter CI/CD to a CI/CD for all mobile app platforms after introducing codemagic.yaml.

How to set up Codemagic CI/CD for Flutter apps hosted on Bitbucket

Jan 18, 2019

Codemagic is the first CI/CD tool dedicated to Flutter apps developed by Nevercode. It was launched at Flutter Live in December 2018 in cooperation with Google. We’re pleased to let you know that Codemagic is now available also to Bitbucket users. You can sign up with your Bitbucket account and have Codemagic build, test and deliver your Flutter app in record time. Codemagic supports both private and public Bitbucket repositories. In addition, you can connect all your GitHub, GitLab and Bitbucket repositories with one Codemagic account, read more about it below.

This post will walk you through of the most important aspects of setting up your Flutter app hosted on Bitbucket and describe how you can benefit from using Codemagic CI/CD in everyday app development.

Signing up with Bitbucket

On signup, you are required to grant Codemagic access to your Bitbucket repository. Codemagic needs read permission to access the repository, but read-write permission is required for creating webhooks that make automatic build triggering possible. Don’t worry, we won’t store any of your source code or use your data for any purpose other than providing continuous integration and continuous delivery service.

Granting access to Codemagic

Set project language in Bitbucket

After you log in, Codemagic automatically displays the list of apps detected in your private or public repository. Since Bitbucket doesn’t offer automatic language detection, you will have to manually set Dart as the project language in your Bitbucket repository settings. When you do that, you can filter the apps based on language to display only Flutter apps.

Run builds in one click

Running builds on Codemagic requires no prior configuration. When you log in, you can immediately start a build with preconfigured defaults. Simply choose a Flutter app and click Start your first build. If you have tests in your project, these will be run too.

Use filters to narrow down the list of apps

When the build finishes, you will have artifacts available for download along with the full build log. Webhooks to your repository are created automatically on first build, so from now on, you can choose to have Codemagic run the build and verify the change every time you push new code to the repository.

Build report and artifacts

Advanced build configuration

Codemagic offers many advanced settings so you can have more control over the build process. You can specify which Flutter or Xcode version to use, choose the build mode (debug, release or profile), decide whether to build for Android or iOS or both platforms, configure the branches to be built, enable or disable automatic builds in response to events in the repository, and so on. There’s also an option to embed custom scripts by inserting them in the appropriate places before or after the default build steps.

Default build steps

In addition, you can create several workflows for building different configurations of the app simply by duplicating one of the existing ones. The ability to automate all this is what makes Codemagic CI/CD a true productivity tool for every Flutter developer.

Build report notifications and artifact distribution

To keep you and your team in the loop about what’s happening on Codemagic, you can enable the Slack integration to have Codemagic publish build status updates and artifacts in a channel of your choice. There’s also email publishing to multiple recipients, which is a convenient way to send installable artifacts of successful builds to test devices. The email address connected to your Bitbucket account has been configured automatically so you will know when your build fails or finishes successfully.

Artifacts are also sent on email

Ship your app to app stores

With Codemagic, you can automate the entire release pipeline. Set up code signing for iOS and Android and you will receive signed builds ready to be installed on real devices or released to Google Play or Apple App store. Furthermore, you can have Codemagic take care of app store publishing if you configure these options in the UI.

Using GitHub, GitLab and Bitbucket with one account

If you have previously signed up with GitHub or GitLab, but now want to connect your Bitbucket repository, you can connect your Bitbucket account with your existing Codemagic account. Simply log in to Codemagic, open the user settings and enable the Bitbucket integration. The same applies the other way around: if you first sign up with Bitbucket, you can enable the GitHub and/or GitLab integration in user settings. This way, you can build all your Flutter apps hosted on GitHub, GitLab and Bitbucket from the same account.

All repository hosts are connected

Wrap-up

It has been a little over a month since Codemagic was launched, and adding support for Bitbucket is just one of the many features we are working on. Stay tuned for more updates as there are plenty more to come, and join our Slack community for Flutter CI/CD.

How did you like this article?

Oops, your feedback wasn't sent

Latest articles

Show more posts