Continuous Integration and Deployment for Xamarin Apps

Continuous integration and continuous deployment, or CI/CD for short, is a common word you might continuously see when businesses are setting up their DevOps or processes. Simply put, these two phrases, in the context of developing Xamarin apps, are defined as follows.

  • Continuous integration (CI) is the process of merging all developers work into a single main repository, continuously throughout the day.
  • Continuous delivery (CD) is a process of automatically deploying your Xamarin apps to testers, or end users.

Merging files and pushing out mobile deployments, when done manually, can be incredibly time consuming, tedious and error prone. But to survive in today’s agile world, your testers and users need app updates as soon as possible. Automating these processes as much as possible is the end goal, so that developers can focus on writing code, not deploying apps. DevOps expands further than CI/CD to automate and facilitate feedback and project decision making, but this post will focus only on the CI/CD component.

Continuous Integration

The first and most common part of Continuous Integration is having a shared repository across your team. GitHub, BitBucket or VSTS are common options. But there is more to CI than just merging your source code with other developers. You need to ensure you haven’t introduced any errors, and it continues to work on your targeted devices. To accommodate this you need, you will have a build process that can start based on a trigger, such as each check-in. It will complete a build and run Unit Tests and UI Tests. Any failures can be reported back to the developer. In some systems, you can even prevent a check-in to the main branch, until tests are run and successful.

Continuous Delivery

Continuous delivery is a must with mobile development. Deploying a mobile app to HockeyApp, or the App Store is a tedious process. This is where services like VSTS or Fastlane can help. Expanding upon continuous integration, the build process can build, sign and deploy the resulting binary to Hockey App, the App Store, a file store or all of them. The result is that after every check-in, or once a night, once the unit tests and UI Tests have run and confirmed no issues, it will automatically build the binary and send it to a service, that puts in on the device of your testers or users. Of course this automated approach is generally for testers. While it will be automated to production, the production app will most likely be manually triggered.

A small note about Mobile Center, which is a Microsoft product that combines the power of VSTS and HockeyApp into a single product. VSTS and HockeyApp will still continue to exist, Mobile Center will still leverage off their platforms.

Learn More

If you want to learn more about CI/CD, I recommend you read Xamarin Continuous Integration and Delivery: Team Services, Test Cloud, and HockeyApp.

Disclaimer: I was the technical reviewer of this book. I didn’t get paid to review it, and I don’t get paid any commission on sales.