Continuous integration for iOS is an important part of a professional software development workflow and a helper to automate the build and test process.
Besides automatic builds and tests, Jenkins gives the opportunity to run code metrics, to distribute build artefacts to servers or to run every other task which is required for the job.
Once setup, a developer can focus on writing code and tests. Jenkins does the rest of the job. And this always the same way and while the developer is coding.
At the end you get stable build results and an overview about the quality of your code and where it can be improved.
There are many blog posts out there, some good, some bad and some wrong. This series here is my summary of infos that I found in various blog posts and tried out in many exploration times. The next four posts contain what I have done to setup a Jenkins on OS X Yosemite which is able to build, test and analyse my projects.
The setup process can be clustered in the following parts:
- Create and/or configure the user account on OS X.
- Install and configure the Jenkins server.
- Create and configure one or more build jobs.
- Configure one or more build jobs to run code metrics.
*Ok, then let’s rock! :)*
1. Create and configure the OS X user account
Some of the following steps belong to my personal preferences and are not necessarily required, however very helpful. They are marked with a little (*).
- Create a new user account with admin rights for OS X.
- (*) Basically configure the system (faster mouse and keyboard, always visible scrollbars, nice background) and install the tools that make you faster (i.e. a visual git client).
- (*) Install zsh.
$ curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh
- (*) Install iTerm2.
- (*) Configure zsh and iTerm2 to your needs to speed up usage. (the command line will be used very often)
- Install Homebrew and follow the instructions.
$ ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
- Install wget via Homebrew.
$ brew install wget
- (*) Install Ruby via RVM or rbenv to get a controlled Ruby environment. The following example generates a `.ruby-version` file in the project repository (should be committed) which sets the local Ruby version for the project to 1.9.3-p327.:
$ rbenv local 1.9.3-p327
- Install Xcode and command line tools. [How to]
- Grant Jenkins access to the required source code. Typically this means to generate one or more SSH keys and register them at a hosting service (e.g. Github, Bitbucket, …) For how to generate a SSH key see the awesome Github help page.
📌 The next post will be about the installation and configuration of the Jenkins server itself…