Episode #13

Setting up Jenkins

13 minutes
Published on April 26, 2012
In this episode, we'll set up a free continuous integration server called Jenkins (previously Hudson) to run our build. We'll configure it to automatically check out changes from git, run the build, and finally run all of our tests. We'll then use a conversion script to translate the test output into JUnit test report files that Jenkins natively understands.

Episode Links

Installation

Install with homebrew:

brew install jenkins

Then start the server. You can start it manually with:

java -jar /usr/local/Cellar/jenkins/1.459/lib/jenkins.war

Or set it up to start automatically with your system with:

mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/jenkins/1.459/homebrew.mxcl.jenkins.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.jenkins.plist

You'll also need the Git Plugin for SCM.

Configuring the build

Add your new job. For the build trigger, you'll use Poll SCM. This takes a crontab format string.

To make it poll every minute, you can use * * * * *.

To run your build, it is easiest to put everything into a build.sh script and simply invoke that from Jenkins. This also allows you to run the same build locally.

Running the Tests

There are detailed steps here, however the basic steps are:

  • Create a new scheme based on your test target
  • Edit the scheme and check "Run" under the build step for your test target
  • Edit the test target settings and remove the Test Host setting
  • Change the Test After Build setting to YES

Got any other cool Jenkins tips? Let us know in the comments!

Want more? Subscribers can view all 586 episodes. New episodes are released regularly.

Subscribe to get access →

Source Code

View on GitHub Download Source