- Buy a mac mini
- Install 10.8
- Create a user account for Jenkins
- Install xcode
- Turn on screen sharing
- Turn off energy save sleeper
- Login as your jenkins user
- Use ssh-keygen to create a key for github
- Create a github account for your build machine
- Add the key to your build machine github account
- Run xcode, install xcode command line tools
- From terminal accept xcode's license agreement (xcodebuild --license)
- From another build machine export your .developerprofile from xcode and import it into your build box (or you can do this the old fashioned way - but xcode export and import seems to just magically work)
- Use git to clone your project
- Locally (i.e. not while ssh-ed in) use xcodebuild (with right settings, e.g. release config) to make sure it builds clean on the command line.
- The keychain should prompt for access to your signing certificate you WANT to make sure you always allow access to this certificate (otherwise jenkins can build headlessly)
- Install homebrew
- Install jenkins via homebrew
- Follow directions to add homebrew to your launchd
- Remove the line in the launchd plist that limits jenkins to localhost
- Use launctl to run jenkins
- Visit the jenkins homepage http://buildmachine:8080
- Remove useless jenkins default plugins (unless you want to build java crap)
- Add jenkins plugins for xcode, git, github and testflight
- Create a new jenkins job that builds via xcode
- Turn on xcode ipa generation
- Add your github clone URL to the job, fill in the polling field (I've set up jenkins to poll github every 10 minutes)
- I created two jobs - one that polled github every 10 minutes and one that builds each day. Only the daily build generates testflight builds.
Troubleshooting:
My three biggest problems were:
- Jenkins by default runs on localhost (lo), I needed it to run on en0. This is controlled via a switch passed to jenkin's launchd plist.
- Xcodebuild couldn't sign the binary and no keychain dialog was appearing on the mini. I had to manually allow access to the keychain certiciate. See here for more: https://wiki.jenkins-ci.org/display/JENKINS/Xcode+Plugin#XcodePlugin-Userinteractionisnotallowed
- I forgot to turn off sleeping on the Mac Mini and the next daily build didn't happen.