Continuous delivery for Xamarin.iOS projects with TeamCity, FAKE and HockeyApp
With this new post we are going to learn how to add continuous delivery to a Xamarin.iOS project.
Main components are FAKE as build automation system, TeamCity as continuous integration and deployment server and HockeyApp as storage, distribution and notification service of our client deliveries.
The advantages of continuous delivery are huge, provides visibility to projects that make use of it and speed up their development process, apart from saving time turning the delivery management into an easy task.
I suppose the reader of this article has some experience configuring projects and build configurations in TeamCity.
These are the ingredients and cooking procedure:
-A Mac/Mac Mini with OSX and Xamarin.iOS installed. (Check you have mono and curl in your PATH environment variable)
-Install TeamCity Agent in OSX. (I suggest you to install it as a login item, to ensure it gets executed even if you restart your Mac)
-Them create your project inside TeamCity, add a new build configuration and a schedule trigger with the frequency you agreed with your client for continuous delivery.
-Add a build step to this build configuration that involves the execution of a .sh script. (Here I provide a sample build.sh script: https://gist.github.com/d2d32636db09100134e9)
Don’t forget to give it execution permission and commit it in your repo (chmod +x build.sh)
This shell script is responsible for executing FAKE with the target you pass it as first parameter.
-Them we need to create a FAKE script, it will hold all our project targets. You would need to define at least a compile target and a uploading target that will grab the ipa and upload it to HockeyApp.
Same as above, I provide a sample build.fsx FAKE script with compilation and uploading targets: https://gist.github.com/a84a06a4d65218e98fab
This sample FAKE script makes use of two FAKE helpers, the Xamarin helper to be a able to compile our Xamarin.iOS project from OSX and the HockeyApp helper that is responsible for the uploading process to theirs server using curl.
Fake.XamarinHelper is already included in the FAKE default libs but HockeyApp helper is in my gist: https://gist.github.com/ab18acdd8892cec0df5e
That’s all we need to add continuous delivery to our Xamarin.iOS!
Share with us your experiences with continuous delivery in your projects or doubts related to this post in the comments section.
Lastly, as a little piece of advice, don’t forget to carefully inspect all your artifacts/deliveries before notifying your client. Sometimes, the false sense of security that the continuous delivery process provides turn against us.