Mobile CI/CD: a noob’s guide for mobile app developers

Bitrise
Bitrise
Published in
11 min readAug 29, 2022

Having an understanding of what CI/CD entails makes you more valuable in today’s software development world. This noob’s guide to CI/CD mobile app development is ideal for mobile app developers who are new to CI/CD.

CI/CD practices have taken the software development world by storm, and for good reason. Time and again, research proves the benefits of implementing CI/CD. Take this paper from the University of Helskinski, for example, which shows how a company achieved faster iterations, better assurance of quality, and easier deployments with CI/CD.

But mobile is a unique beast with its own benefits and challenges.

Whether you’re a newbie mobile developer or a more experienced mobile developer looking to broaden your skills, having an understanding of what CI/CD entails makes you more valuable in today’s software development world. This noob’s guide to CI/CD mobile app development is ideal for mobile app developers who are learning CI/CD.

In this article — which we’ve tried to make as comprehensive as possible — you’ll learn about:

  • What CI/CD means in simple terms
  • How CI/CD fits into the Mobile DevOps lifecycle
  • The benefits of CI/CD for mobile app development
  • Factors to consider when selecting a CI/CD tool for mobile app development
  • Which CI/CD tools should you use: self-hosted or cloud-based?
  • Best practices to keep in mind for setting up CI/CD for mobile development
  • Do more with less: set up a basic CI/CD pipeline for your mobile app using Bitrise

What CI/CD means in simple terms

CI/CD stands for continuous integration and continuous delivery. In a nutshell, it is the practice of automating as much of the manual effort as possible required to get new code from the developer’s IDE into the hands of users. As a result, teams are able to deliver apps faster and with ease.

To get a better understanding of what CI/CD entails, we need to discuss both components — continuous integration and continuous delivery — separately.

What is continuous integration (CI)? 💡

Continuous integration is a development practice where developers frequently (at least daily) commit code in small changes to a shared version control repository, and then the viability of each code commit is verified using automated checks.

Consider a typical development process. After the analysis and design phase, different developers are assigned to work on different features or functionalities. Each developer gradually commits code to their own branch (e.g., 2841-add-new-button-to-settings-page), and when they’ve reached a milestone, they’ll make a ‘Pull Request (PR)’ to merge their code into the main development branch.

To avoid committing or merging defective code into the main development branch, developers would have to check out each code commit locally, create a build, and run the tests on their laptop, which could take anywhere from 30–120 minutes. This is where CI proves useful.

A CI tool can be used to trigger a CI pipeline whenever a commit or PR is opened to build and test the app and confirm that the code changes do not contain any defects or software quality concerns. As a result, developers can get feedback on the status of their code change faster and do not have to waste valuable time manually running tests.

With continuous integration in place, it’s easier to identify and fix defects and other software quality issues before they ever get to production. This practice leads to better end-user software quality and easier collaboration amongst developers on a team.

A CI process (pipeline) will typically:

  • Compile the existing source code of the branch with the new code addition alongside required libraries and dependencies to produce a ‘build.’
  • Run automated checks or tests (such as unit tests, integration tests, static analysis, linting) on the compiled code to ensure that the app builds and that the code addition hasn’t broken the app.

What is continuous delivery (CD)? 💡

After merging working code into the central branch (main, master, etc.), continuous delivery picks up where continuous integration stops to automate the delivery of builds that pass the CI checks into production-like environments (e.g., staging), where further tests and review will be done to prepare them for release to the actual production environment.

Tests such as performance, security, acceptance, and smoke tests that require a full delivery environment are often integrated into the CD pipeline and executed after builds are delivered to target production-like environments.

By delivering working code to production-like environments for further testing and review, continuous delivery decreases the risks associated with deploying software to live and increases confidence that the app will work in production.

A CD process will typically:

  • Pull the latest code from a specified version control branch and execute a build. Some may release/push to staging as soon as a PR is merged, while others may do this on a schedule (e.g., 10 a.m. on Mondays).
  • Configure the code with environment variables for the target production-like environment (staging, testing) and deploy it.
  • Run further automated tests (UI tests, end-to-end tests, performance tests). Most teams make provisions at this stage for QA engineers to carry out some manual verification tests.
  • Based on a team’s setup, run one more build and test pipeline on the main branch and either create an artifact that can then be deployed to production at the click of a button at any time or ‘promote’ the build from staging to production.

How CI/CD fits into the Mobile DevOps lifecycle

If you’ve heard of CI/CD, then you’ve also heard of the accompanying buzzword “DevOps”. But, if you ask five different people, you’d probably get five different definitions of what DevOps is. To understand how CI/CD fits into DevOps, let’s try to understand what DevOps is.

DevOps is the combination of “development” and “operations.” It is an approach to building software that enables the development and operations teams within organizations to work in sync to get software to end-users smoothly and quickly.

Especially within organizations building mid-scale to large-scale apps, the different stages of the software development lifecycle are distributed amongst two teams: development & IT operations. The development team handles planning, writing code for new features, testing of features, and fixing bugs, while the IT operations team handles deploying the code to a production server, as well as managing, scaling, securing, monitoring, and backing up the server(s).

In previous settings, the development team builds and tests features in a silo and then hands the complete feature over to IT operations to deploy. Then, IT operations migrates the app to production and deploys it. Sometimes there would be a case of ‘it works on my computer but doesn’t work as expected on the deployment environment.’ This arrangement caused a lot of friction and had the development team waiting for long periods for feedback, which extended deployment timelines. Hence, DevOps was born.

The DevOps approach breaks down this imaginary wall so that both teams can work simultaneously, with each team feeding off the output of the other team. With DevOps, apps are built and tested incrementally to ensure the ongoing integrity of the codebase.

As shown in the image above, CI/CD is the core enabler of the DevOps approach. CI/CD pipelines remove the traditional roadblocks and automate the process of handing off of code from development to IT operations.

Here at Bitrise, the DevOps philosophy adapted to the uniqueness of mobile development is what we refer to as Mobile DevOps. Read more about why Mobile DevOps is a necessity for mobile app development teams.

The benefits of CI/CD for mobile app development

In mobile app development, the cost of bugs in production is higher than in traditional software development. Fixes take longer because deployment is slower and gated by app store approvals, and even when fixes are released, there’s no guarantee that users will update to the latest version of your app. As a result, while CI/CD is beneficial to any development workflow, it is critical for mobile apps.

With CI/CD in a mobile app development workflow, you’ll get:

  • Higher-quality code and operations: Frequent testing of code in smaller batches and earlier in the development cycle reduces the risk of deploying bugs to production.
  • Instant rollbacks: With CI/CD in place, there’ll be several versions of code in a deployable state, so rolling back to a previous version in the event of a problem is as simple as routine push-button action.
  • Automate repetitive tasks and save time: According to a recent study, CI/CD saves mobile app teams up to 20% of development time.
  • Faster time to market: In the mobile world, time to market is everything because competition is fierce. With a robust mobile CI/CD pipeline, you can take care of all the common complexities and repetitive tasks that usually set deployments back. This way, you can get fixes and features out to users faster and get more frequent feedback from them.
  • More productive developers: Research shows that continuous delivery measurably reduces team burnout. With more of the deployment process automated, the team has time for more rewarding projects. Less burnt-out developers leads to more productive developers, which leads to higher job satisfaction.

Factors to consider when selecting a CI/CD tool for mobile app development 📝

There is a wide variety of CI/CD tools that can be used for mobile app development. However, since building for mobile has its own unique challenges, it’s best to adopt tools that are tailored specifically for mobile like Bitrise.

With such tools, you get everything you need to make setting up a CI/CD pipeline for mobile a breeze. You get predefined templates for common mobile workflows and actions, as well as robust support and coverage for all mobile languages and platforms.

Whichever mobile CI/CD pipeline tool you choose, make sure it’s one that aligns with the needs of your team and one you can afford.

  • Hosting: Is the service on-premise or cloud-based? If it’s the former, what are the software and hardware requirements?
  • Platform support: Does it provide support for all the languages/platforms you’ll be building with and deploying on?
  • Configuration: How easy is it to set up? Is there a UI-based option, or is everything handled by a configuration file (e.g., YAML)?
  • Integrations and customizations: Does it have a programmable API that can be used to customize functionality to fit your process? Can it integrate with your present toolchain with minimal overhead?
  • Concurrency: What is the maximum number of builds that can be executed at the same time, and at what cost? Some mobile CI/CD providers offer free or low-cost subscription options with limited concurrency, but costs increase significantly if you need more throughput and better performance.
  • Pricing: How robust is the pricing of each tier? How many individual projects can you develop on each tier?
  • Support: How comprehensive is the documentation? Does it have active communities or dedicated support for paying customers, so you’ll definitely get help when you need it?

Which mobile CI/CD tools should you use: self-hosted or cloud-based? ☁️

One of the most frequent questions people (especially enterprise organizations) ask when they’re about to adopt mobile CI/CD is whether a cloud-based solution is right for them.

Based on our survey of hundreds of developers from our user base and experts from companies such as EPAM, Nextdoor, Pulselive, Compass, and Signify, 89.8% of participants saw a performance increase switching from an on-premise tool like Jenkins to a cloud-based continuous integration tool like Bitrise.

Let’s do a brief comparison based on different factors of both hosting methods:

‍If you’d like to learn more, read our article on the differences between cloud-based CI/CD and self-hosted CI/CD.

Best practices to keep in mind for setting up CI/CD for mobile development 📌

Start with culture

Tools and automated checks are all fine. But if your developers only commit weeks’ worth of code, the team will spend a good amount of time merging branches and resolving code incompatibilities that will arise eventually.

For mobile CI/CD to work for your organization, developers have to adopt the practice of committing their code frequently (at least daily). Everyone should get into the habit of splitting the task they are working on into smaller tasks. Merge code very often and pull very often.

Keep CI checks short

The fundamental goal of CI is for developers to be able to get near-instant feedback on the status of their code. Therefore, try to keep CI checks at a max of seven minutes. If a CI check takes too long to complete, developers are likely to move on to another task. What happens after waiting, say 15 minutes, and the check fails? Now they’ll have to switch context back. This is frustrating and hampers productivity.

The checks you run at the CI stage should check the bare minimum, which is that:

  • The app should start.
  • Critical features (user signup/login journey and key business features) are functional.
  • Common layers of the application that all developers rely on are stable.

Tests that take longer to run or are not significant to the essence of CI should be moved to the CD stage. Here are things you can do to optimize your pipelines and make them shorter:

  • Cache app dependencies: Every new build in a mobile CI/CD pipeline will typically run in a new virtual machine (VM). As a result, fresh VMs must be created from the start each time. It costs a lot of time to download dependencies every time you perform a build. You can cache dependencies during the build process to speed up your workflow.
  • Run build jobs in parallel on multiple VMs: The majority of build jobs (or steps), such as tests, are run sequentially. However, if you split long build processes into different steps and execute them all at the same time, the build takes less time to complete.
  • Run tests conditionally: Only run tests for changed files.

If you’d like to learn more about optimizing mobile CI pipelines, here are more in-depth articles we’ve written on the topic:

Do more with less: set up a basic CI/CD pipeline for your mobile app using Bitrise

Now that you know all the theoretical fundamentals of CI/CD, you’re ready to get your hands dirty by setting up a simple mobile CI/CD pipeline of your own with Bitrise.

Bitrise satisfies all of the criteria outlined in the ‘factors to consider when selecting a CI/CD tool for mobile’ section. It caters specifically to mobile and offers a robust ecosystem with everything you need to succeed with CI/CD for mobile.

Whether you’re building for Android or iOS or working cross-platform, setting up a basic CI/CD platform on Bitrise is a simple four-step process:

  1. Sign up for a Bitrise account with your git provider, email, or SSO. Bitrise has a robust free plan, so you can sign up now, find what works for you, and choose a plan later.
  2. Create a Workspace. You will be prompted to create your first Workspace after signing up. A Workspace is an environment that allows you to manage your Bitrise apps and the team members working on the apps.
  3. Set up access to your app’s repository. During this process, we also run our project scanner to detect the platform of your app (e.g., iOS) and generate default workflows with all the necessary steps you need to build and deploy your app.
  4. Follow our different guides to further customize your workflows to meet the specific needs of your app and platform type.

Happy building!

This post was originally published on the Bitrise Blog.

Build better mobile applications, faster: Save time, money, and developer frustration with fast, flexible, and scalable mobile CI/CD that just works. Try Bitrise for free!

--

--

Bitrise
Bitrise

Build better mobile applications, faster: Mobile Continuous Integration and Delivery with +330 of integrations for your favorite services. 🚀 https://bitrise.io