Reader small image

You're reading from  Mobile DevOps

Product typeBook
Published inMar 2018
Reading LevelIntermediate
PublisherPackt
ISBN-139781788296243
Edition1st Edition
Languages
Concepts
Right arrow
Authors (2):
Rohin Tak
Rohin Tak
author image
Rohin Tak

Rohin Tak is a mobile and web development enthusiast with expertise in and several years of experience of .NET technologies. Professionally, Rohin has worked for IBM and OnMobile Global as a .NET developer and Xamarin developer respectively. Rohin is now working as a senior software engineer at LeadSquared, one of the fastest growing sales and marketing automation solutions in India. In his spare time, Rohin is mostly found trekking in the Himalayas and exploring new places around the globe.
Read more about Rohin Tak

Jhalak Modi
Jhalak Modi
author image
Jhalak Modi

Jhalak Modi is a DevOps engineer with a deep interest and expertise in implementing large-scale cloud, big data, CI/CD, and automation solutions on a variety of public/private/hybrid clouds, as well as on-premises. She is an AWS Certified Solutions Architect and DevOps professional with more than 10 certifications in trending technologies. She is also a public speaker at AWS events, universities, meet-ups, and corporate trainings. Currently, working with KOGENTiX, Singapore, she has previously worked with Wipro Technologies and Electromech Corporation.
Read more about Jhalak Modi

View More author details
Right arrow

Configuring TeamCity for CI/CD with Xamarin

In the old days, application development used to happen in separate, not-so-integrated teams. Developers were not used to merging their work with other developers' code for quite a long time, and that used to create merge issues. Things that were working on the developer's local copy used to stop working when merged with others' code. This kind of not-so-integrated development environment increased the development time and delayed the discovery of issues. One solution for this is to have continuous integration built into the development cycle, where developers merge their code multiple times a day and get issues fixed at earlier stages.

In this chapter, we will learn more about continuous integration, continuous delivery, and the different tools that we can use for a better development integration and delivery process...

Introduction to continuous integration

Continuous Integration (CI) is a development and integration practice in which developers check code into a shared repository frequently, preferably several times a day. Each code merge can then be verified by an automated build and automated tests if applicable.

There are many benefits to following continuous integration; one of the advantages is that it helps detect defects quickly and at an early stage. The check-ins are usually very small and contain small developments, thus helping to identify the exact issues quickly.

Continuous Delivery (CD), on the other hand, is a process performed after integration, and as the name suggests, it makes sure that the code base checked in is deployable at any point of time. Each environment from test to production can, and mostly does, have different configurations. Continuous delivery makes sure that...

Using TeamCity with Xamarin for CI/CD

As mentioned in the previous section, TeamCity provides great support for .NET-based applications.

While it can automatically detect build steps from configuration files and project files, it can also detect automatic build triggers from GitHub.

Requirements for using TeamCity

To use TeamCity, knowledge about, and the access to, some hardware and technologies are required to make the setup process smoother:

  • A dedicated build server for TeamCity installation and setup: Ideally the build server should be a standalone server and should not be responsible for other responsibilities such as being a DB server or hosting server.
  • Knowledge of MSBuild: Having knowledge of MSBuild can make this...

Preparing the build server

In order to compile and build a mobile app on the server, some software need to be installed as it is required for the build process. For an Android application to be built on the build server, it is important to have tools such as the Visual Studio SDK and Visual Studio build tools installed on the server. Also, acquiring Android Keystore is required to sign the application package to be released later. To avoid any configuration issues, it is recommended to install this software under the same user account as TeamCity.

Firewall configuration

For continuous testing, we are using Xamarin Test Cloud, which was described in the previous chapter in detail. For tests to be submitted to Xamarin Test Cloud...

Creating a build script

The build script should contain the following steps:

  • Compile the application: Configuring the application project file to use the proper Keystore and compiling the application using Visual Studio SDK tools
  • Submit the application to Xamarin Test Cloud: Once the server's firewall is configured to allow communication with Test Cloud servers, as mentioned in previous steps, this step in the build script will run the command to upload the signed application package to the Test Cloud servers

Compiling the application

Now that we have our Android Keystore ready and prepped for use, we can look at the Visual Studio project. In order to automate this in the build system, we need to configure the project...

Installing and configuring TeamCity

To install and configure TeamCity on a Windows machine, follow these steps:

  1. Go to https://www.jetbrains.com/teamcity/download/#section=windows and click on the DOWNLOAD button to download the TeamCity installation package from the TeamCity website:
  1. Once downloaded, open the installation package and click Next:
  1. On the next screen, agree to the license and go to the next step:
  1. Select the path to install TeamCity in and click Next:
  1. Select the packages to be installed; for example, if you are installing Build Agent and Server on different servers, then select accordingly. For learning purposes, you can select to install both on the same machine:
  1. Once the installation is done, select the port you would like the TeamCity server to run on. Make sure this port is not used by other services on the machine, and choose a unique port number...

Summary

In this chapter, we learned about continuous integration and continuous delivery. We learned about various tools for continuous integration. We used TeamCity to implement CI/CD in the Xamarin project developed in earlier chapters, and learned how to create a project in TeamCity to automate the build process and finally get a distributable Android package.

In the next chapter, you'll learn more about continuous distribution and delivery using Visual Studio Team Services.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Mobile DevOps
Published in: Mar 2018Publisher: PacktISBN-13: 9781788296243
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Authors (2)

author image
Rohin Tak

Rohin Tak is a mobile and web development enthusiast with expertise in and several years of experience of .NET technologies. Professionally, Rohin has worked for IBM and OnMobile Global as a .NET developer and Xamarin developer respectively. Rohin is now working as a senior software engineer at LeadSquared, one of the fastest growing sales and marketing automation solutions in India. In his spare time, Rohin is mostly found trekking in the Himalayas and exploring new places around the globe.
Read more about Rohin Tak

author image
Jhalak Modi

Jhalak Modi is a DevOps engineer with a deep interest and expertise in implementing large-scale cloud, big data, CI/CD, and automation solutions on a variety of public/private/hybrid clouds, as well as on-premises. She is an AWS Certified Solutions Architect and DevOps professional with more than 10 certifications in trending technologies. She is also a public speaker at AWS events, universities, meet-ups, and corporate trainings. Currently, working with KOGENTiX, Singapore, she has previously worked with Wipro Technologies and Electromech Corporation.
Read more about Jhalak Modi