This is a a blog post from Thomas Dohmke, CEO at Codenauts UG, creators of HockeyApp. HockeyApp allows you to distribute your betas and collect live crash reports for beta and release apps on Mac OS X, iOS and Android. Before founding Codenauts UG, Thomas worked in the automotive industry and learned the importance of efficient processes. Now he is bringing the same quality to the development of mobile apps.
Don’t Repeat Yourself
One of the most important principles in software development is “Don’t Repeat Yourself (DRY)”. First introduced by Andy Hunt and Dave Thomas in their book, “The Pragmatic Programmer“, it was intended not only for programming, but for all parts of the development process: “Database schemas, test plans, the build system, even documentation.”
The standard build system for iOS development is Xcode. To test a new app or new feature in the simulator or an actual iPhone, I click “Build & Run,” and the app launches after a successful build. When I decide to send this as a beta version to a couple of testers, things get more complicated. If I haven’t already, I need to create a distribution certificate, enter the Unique Device ID (UDID) of all testers’ devices, and put them into a provisioning profile. The certificate and profile are then used by Xcode to sign the build.
Every time we buy a new device or find a new tester, I need to change this profile and make sure that all members of the development team get it on their machines. This is a cumbersome and error-prone process.
What if we instead use the Mac Mini in the corner of our office as a build server? Its main purpose is to connect to our printers, and we rarely print anyway. Now it should pull our project from Bitbucket, build the app, sign it, then upload it to HockeyApp for distribution and crash reporting.
Five Steps to Mobile Automation
We need five steps to make this work:
- Install Xcode from the App Store. The current version is 1.68 GB, so feel free to grab a coffee while the download runs.
- Pull our project from the git repository, copy the distribution certificate and provisioning profile to the machine, and see if it successfully compiles.
- Install Bamboo. It comes as an OS X Installer download, so the setup is easy. When it’s done, I can open the admin interface in my browser by going to http://localhost:8085
- Create a new build plan. Enter the plan name and key; then, configure the source repository. I select Bitbucket, add my credentials, load the list of repositories, and select our project. We push new code to the branch “develop” and merge to “master” for beta builds, so I choose the “master” branch for polling.
- In the next step, I add 4 jobs to this plan:
- Source Code Checkout: Select the repository which was configured above. I prefer to do a clean build on each run, so I set the corresponding checkbox.
- Xcode Build: This task is part of the Xcode plugin which is available from the plugin center. It uses xcodebuild to compile the project and also does all the code-signing stuff. Fill out the form as shown in the screenshot.
- Zip dSYM: The dSYM bundle is needed for crash symbolication, so a command task compresses it to a zip file which can be uploaded to a server.
- Upload to HockeyApp: This task is also part of the Xcode plugin. Its configuration is simple: enter the paths to the build results, enter the paths to the HockeyApp API token, and decide if testers should be notified via email.
Easy Crash Reporting
Save Time and Prevent Errors
Get Me Started
Get started with a free trial by signing up at HockeyApp today.
New to Bamboo?
Download Bamboo and get started with a free trial.
Once you have Bamboo installed, download the Xcode plugin from the Atlassian Plugin Exchange to start building.