In my mind, building a Mobile CI/CD pipeline is similar to a LEGO game: you have different tools, configurations, and dependencies, like LEGO pieces. You only need to decide how to build your pipeline.
When you play with LEGO, you can really feel like an architect. You can create different results by building different shapes and structures.
Image Source: pinterest.com
The idea behind building a mobile CI/CD pipeline for your specific needs and requirements is knowing how to use the pieces correctly. There is no set-in-stone template required for building a mobile CI/CD pipeline. Instead, you should always implement the Steps that fit your needs.
In the previous article, we discussed how you can build your own CI/CD pipelines by customizing your Bitrise Workflows with Bitrise. In this article, I will explain how you can easily add different Steps to your mobile pipeline for different purposes.
Steps are the heart of Bitrise’s CI/CD service: they are the building blocks of our Workflow Editor. Bitrise has over 330 Steps developed by the Bitrise team, Bitrise partners, or the community for the mobile platforms — and all of them are open-source.
How does it work?
You can open the Workflow Editor where you can edit your Workflow.
The Workflow Editor will be displayed, including the Steps in the different Workflows and other options to add new Workflows, rearrange, or delete existing ones.
On top of that, you also have different tabs to manage your apps such as Code Sign, Secret, Environment Variables, Trigger map, Stack, and the Bitrise YAML.
Let’s get started with the Bitrise Steps
If you need to add new Bitrise Steps that match your specific requirements, you can click on the (+) plus button in the Workflow Editor. It will open the window with all the Steps. You can then search for the Steps you need.
In the following section, I’ll show you how to add different Bitrise Steps to cover different types of testing for your Android App:
With Bitrise Steps you can run the static analysis for your Kotlin code such as detekt. Detekt is a static code analysis tool for Kotlin. It operates on the abstract syntax tree provided by the Kotlin compiler.
To add the Step into our Android CI/CD pipeline you can select the step by clicking on the (+) plus button in the Workflow Editor. The Steps windows will open, showing all the Steps.
You can then search for the detekt Step and select it.
Add then you can configure the Step to specify the path to analyze:
If you need to run the UI tests against your Android app, you can do it easily with our Bitrise Steps. There are different Steps that help you do it, such as running the instrumentation tests with Espresso on Firebase Test Lab in two simple steps. First, you need to build the Android app for UI testing to export you two APKs (the App.apk and TestApp.apk)
Just Add the Step and configure it with the Module and the Variant.
After that add the Step to run the UI on Firebase Test Lab.
Security Automated Testing
If you want to apply DevSecOps practices for your Android app development, there are different types of automated security tests, such as Static or Dynamic. Wth Bitrise Steps, there are a variety of security Steps from our partners, for example, the Oversecured Step.
Oversecured is an Android vulnerability scanner that searches for vulnerabilities in 90+ categories using Oversecured API. You can simply add the Oversecured Step with your API key as a Secret Environment Variable.
Then you need to select the Oversecured API Key and the Integration ID. After that, you can run the build and check the results on your Oversecured account.
If you need to install or configure any tool, or run any custom commands or for your build, you can use the Shell Script step.
Then you can add your custom command. For example you can install and run the Appium server if you add using Appium for UI testing by adding the following commands:
Export Test Report
Usually, if you have custom test results with a custom report and need it to be displayed in the Test Add-on you can add a Step for exporting the Test results.
You only need to rename the Test Report and specify the test results path.
Sometimes you need to send the build statuses to the development immediately. There’s a Step to integrate with different platforms, such as Slack or Microsoft Team.
And finally, you will be able to see your entire Workflow, like this:
To run the Workflow, go to the application page and click on the Start/Schedule Build button, select the Workflow, then click on the Start Build button.
Finally, customization Steps in your CI/CD pipeline can give you even more flexibility to build your own CI/CD pipelines for your specific needs, and help your team scale and expand your app.
- Steps and Workflows | Bitrise DevCenter
- Workflow Editor
- Verified Steps on Bitrise
- Getting started with creating a Bitrise Step | Bitrise
I hope you found this article useful! If you have any questions, feel free to contact us on our Twitter or via email. If you’d like to find out more about how Bitrise can help you release better apps, faster, you can also request a demo here.