Sunday, June 23, 2024
Google search engine
HomeCI/CD with Bitbucket In Flutter

CI/CD with Bitbucket In Flutter

Learn how to use CI/CD with Bitbucket in your flutter apps

This blog will explore the CI/CD with Bitbucket In Flutter. We perceive how to execute a demo program. We will show you how to use a CI/CD with Bitbucket in your Flutter applications.

If you’re looking for the best Flutter app development company for your mobile application then feel free to contact us at — support@flutterdevs.com.


Why do we need to use CI/CD as an extra step in our development, and configure DevOps-like things in our development routine?

Life is full of challenges and we handle them very efficiently. There are some situations when we don’t know what to do, which can be avoided only by adopting automation in the system.
Let’s assume you have worked hard with entire focus throughout the week and then finished your work to meet your deadline. Now you want to have a party with your friends and at the party, you get a call that the build you shared with the client is not installed on his device and as you are smart you realize that you forgot to clean the project before making a build.

Will you leave the party and get back to your laptop to check it or you call your subordinates to make a build with full cleaning this was the sole purpose of your party, and you don’t want to disappoint your client. Situations can vary but actual things come out in actual scenarios, not virtual ones.

Then your friend tells you that he has set up the CI/CD in his project on bitbucket or git-like VCS in which the build is tested before every push with full clean passing of all the lint warnings and test cases and he doesn’t need to even share any build as the build gets auto uploaded to the desired place by DevOps engine like Jenkins.

Now you know why CI/CD is important.
There are other benefits also like if you have a large team of developers and some are lazy ones to test their code before committing to the cloud, then your army of test cases and intelligence of CI/CD will handle them for you, you can have party!!!.

What is CI/CD?

You know about it already though we can assume it is a system that continuously tests and deploys the code before and after the situation you want as a set of tools to automate our code integration, testing, and deployment.

Bitbucket, Git, Gitlab all offers it, 
Also, there is Jenkins, CI which does the job very well and uploads your artifacts on the Play Store, app center, app store, and other distribution channels.

How can we do it?

The process seems to be tough as everything new for us looks tough and our mind finds excuses to avoid it.

So don’t think too much and stay with me, you will have a lot of it in the next 5 mins.

Ingredients:

Bitbucket account, a flutter project and that’s it.

Steps:

To be concise I will be doing it fast but let me know if you need any further explanation so I can write a detailed blog on then, Let’s start…

  • > Create a repository on bitbucket and clone your flutter code on it.
  • > Create a .yaml file and open it in edit mode.
  • > Put this code in the file and save it.
image: mobiledevops/flutter-sdk-image:3.10.3
pipelines:
branches:
master:
- step:
script:
- echo "This script runs only on commit to the main branch."
- flutter pub get
- flutter build apk --release
artifacts:
- build/app/outputs/apk/release/*
feature/*:
- step:
script:
- echo "This script runs only on commit to the main branch."
- flutter pub get
- flutter build apk --release
artifacts:
- build/app/outputs/apk/release/*
  • > It will run and build the apk from the code and upload it in artifacts.
  • > You can download it from the artifacts section.

NOTE: Keep the indentation the same as it will create issues in compiling.

Now, the Fast and Furious one is done here, and the crazy and curious ones are welcome to understand the meaning of the steps we have taken.

The 3rd step was all the magic so we will see it in slow motion to have it.

1. We defined a docket image to pull for executing the flutter commands.

2. Next we declare the branch or we can have default if you want all branches to have it.

3. Then steps come and we start writing the script

4. Echo are the messages that we want when a step gets executed.

5. Flutter Clean will clean the project which is recommended before making any apk.

6. Flutter build apk — release will make the apk in a release format that is very efficient and not have any dev dependencies and is compact.

7. Artifact gives the path to find your apk so that it can be uploaded to download later from the server.

8. we can add more steps to it like testing and analyzing but those will be covered in the next blog.

Conclusion:

In today’s life, a lot of things are going automated and so TDD(Test-driven development), CI/CD, and other DevOps tools are replacing manpower to remove shallow works in the systems. So learning these concepts and technologies will surely add some value to your database.

The next blog will be on Jenkins with App Center.
Till then Keep Coding, Deep Coding.

❤ ❤ Thanks for reading this article ❤❤

If I need to correct something? Let me know in the comments. I would love to improve.

Clap 👏 If this article helps you.


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 a Flutter developer for your cross-platform Flutter mobile app project on an hourly or full-time basis as per your requirement! For any flutter-related queries, you can connect with us on Facebook, GitHub, Twitter, and LinkedIn.

We welcome feedback and hope that you share what you’re working on using #FlutterDevs. We truly enjoy seeing how you use Flutter to build beautiful, interactive web experiences.


RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

PDF with Flutter

Rest API in Flutter

Charts in Flutter

Spinkit In Flutter

Recent Comments