In Part 1 we took care of all the prerequisites of preparing a clean Mac Mini as our Jenkins build server. Now we are ready to set up Jenkins and configure our jobs.
It’s good to summarize what we want to accomplish here. I’m not going into the merits of a CI server and why you should have one. Just trust me, you need one. If you want to read on the basics, see this Xamarin guide.
We want to automate the Build – Test – Deploy cycle for our Xamarin.iOS app, let’s call it MyProject from now on. It’s considered good practice to split up these tasks in separate jobs, both for maintainability and to limit job execution time. This way you can manage and track progress for each job separately. Separate jobs have its downsides too, but we will come to that. We are going to create 3 jobs:
- MyProject (Build)
- MyProject-testcloud (Test)
- MyProject-testflight (Deploy)
The MyProject job will trigger the jobs MyProject-testcloud and MyProject-testflight only when the build succeeds. This is what we call Downstream projects. Notice that we are deploying to TestFlight right after the build succeeds, we are not waiting for the Test Cloud tests to finish. This is because I want to deploy to TestFlight regardless of the Test Cloud results as TestFlight is used by our developers and manual testers.
You know how (technical) bloggers sometimes say that their blog is their personal memory dump? Sometimes you go searching for the solution to an issue and find the answer on your own blog! I bet this blog post is going to be one of those posts 🙂
Previously I wrote about issues when installing Java on Yosemite during a Jenkins install. I was installing Jenkins because I’m setting up a CI environment for our Xamarin.iOS app. The purpose of this CI environment is to build our Xamarin.iOS app, run the Xamarin.UITests on our Xamarin Test Cloud instance and upload the build to TestFlight for our internal QA and developers to play with.
I bought a nice Mac Mini for this purpose with OS X Yosemite installed. I started out with the Using Jenkins with Xamarin guide on the Xamarin website. This guide mentions a number of prerequisites, but I will try to be as complete as possible in describing the steps to get a Jenkins CI running with Xamarin.iOS, Xamarin Test Cloud and TestFlight.
Lately I’ve been diving into Xamarin test cloud (which is awesome BTW) using Xamarin.UITest, the c# frontend to Calabash.
Since I’m having some issues deploying our Xamarin.iOS app on a simulator, see http://forums.xamarin.com/discussion/9748/ios-simulator-application-terminated-when-testing-on-older-ios-versions, I tried to get the UI Tests running on an actual device.
It took some digging, but I got it to work using this code:
As a comparison, the way to run the tests on a simulator is like this: