Automated iPhone Builds

At Nutshell, we’re a small team juggling a lot of different tasks. Automating key processes really helps us move quickly and stay focused. As Andy mentioned, we’re leveraging Hudson as our continuous integration server to handle builds and deployment, including for our iPhone app.

Why automate iPhone builds?

Hudson can poll our central Git repository’s master branch for changes. With each commit it runs through the iPhone app’s test suite and builds, packages and deploys an internal iPhone app to our shared Dropbox folder. At that point, every team member can install the app onto their phone and bask in its glory (or bugs, depending on how early it is in the development cycle).

Hudson setup

You can do a lot with Hudson, but for now, with respect to our iPhone app, its sole job is to run a straightforward build script when changes are pushed to the Git repo. Since the Xcode tools and iPhone SDK are required to build the app, we have a Hudson node running on a Mac Mini to handle the job.

Hudson Build Script

Build script

Our build script is the meat of the Hudson job. It lives within our app’s source tree, under ./Scripts/ContinuousIntegration/build.sh. The ContinuousIntegration directory represents an aggregate target we created within our Xcode project, which simply runs the same script.

Xcode Continuous Integration Target

Taking influence from this Stack Overflow answer, we’ve created a build script to:

  1. Unlock the Keychain that holds our iPhone Developer Certificate.

  2. Build and run the Xcode target which holds our test suite, entitled LogicTests. If this suite doesn’t pass, then the script exits with a nonzero, failing status.

  3. Build our application target, Nutshell

  4. Package an iPhone app archive that’s installable on our internal devices.

  5. Copy the archive to our Dropbox share so we can all access it.

With all of this, sharing a runnable app with any Nutshell team member is as easy as git push origin master.

In a future post, I’ll outline what’s needed to have your continuous integration server build an App Store submission, determine and set release numbers, as well as how unit and integration testing fits into an iPhone app’s development cycle.

Andrew Sardone

Andrew is a software developer at Nutshell, passionate about web and mobile technologies. He lives in Ann Arbor and can be seen walking all over town. You can also find him on Twitter or in line for the release of most Apple products.

ONE FEEDBACK

  1. Daniel says:

    Thanks for the great tutorial. It shows exactly what I need to set up the development cycle environment

LEAVE A COMMENT