Mobile software engineer, science geek, and a happy husband / father.
As any iPhone application developer who’s released at least a single app to the App Store will tell you, releasing your app is a terrible pain in the…well, it’s not a fun experience. After your second or third app you start to get the hang of things, but there’s still pain and suffering involved. Managing certificates, getting settings configured properly, and iterating between development, AdHoc beta builds, and the final App Store release builds, all make the process seem tediously manual and prone to human error.
In professional software development shops, you would use a Continuous Integration server to monitor your source control repository, check out changes as they’re submitted, compile, test and package up builds, and notify developers of the build’s health via emails and a web-based “Dashboard”. I missed having this while developing my PhoneGap-based iPhone applications, so I decided to once and for all bring good development practices to my iPhone work.
Why do I need to configure automated builds anyway?
I get this a lot from people when I’m trying to convince them of the need for automated builds. I personally find it hard to imagine people getting by without them in a single-developer project, let alone when multiple developers contribute to a project.
Monitoring the health of an application
Lets face it, we’re human, and we make mistakes. It’s alright to break code from time to time, but what really sucks is when you find out far too late. Did your recent changes accidentally eliminate your Entitlements.plist file, thus breaking distribution or release builds? Do you have a file or library you forgot to check in, meaning when you delete the project from your working directory all those changes will just vanish?
Instead of having to remember to check each of those things manually (which, lets face it, you’ll forget at least half of the things you’re supposed to do inevitably), why not have an automated system tell you every time you make a change? And if you’re in a multi-developer project, you’ll be able to see who broke the build and what change specifically broke it.
Always be ready for distributing your application
Many times in the natural course of development you’ll break code. You’ve gotta break something in order to improve it. But sometimes someone (your wife, a client, a beta tester) will want to try out your application before you have an opportunity to finish off your recent changes. Instead of spending ages back-tracking your work to get your application to compile, why not rely on your automated build system to keep archives of previously successful builds?
Release what you test
Since you want to test an application before you release it to the App Store, you’ll probably create an Ad-Hoc distribution build to give to friends, family, or official beta testers before you bundle your application up to send to the App Store. Maybe your testers will find bugs, maybe they won’t. But at the end of the day that compiled app bundle you just created isn’t actually what you submit to Apple. You need to compile a completely different app bundle with very different files stored in a Zip file, and if you’re not careful you could potentially be releasing something different than what you tested.
Why not have your automated build system create both your Ad-Hoc distribution build as well as an App Store release build every time? That way you’re not only always ready to release something to the App Store, but you can be guaranteed that you’re submitting to Apple the exact code that your testers evaluated.
More benefits than I can list
If you’re really serious about best practices, you’ll probably want to write unit tests for your code and have those run after your code has been compiled, but before your build is packaged and archived. Just because your code compiles doesn’t mean that it will behave correctly. And lets face it, if you have a lot of tests, you’ll never wait for all of them to run throughout the course of your work. So by running your tests as a prerequisite to a build succeeding, you’re guaranteed that you’ve got a safety net.
There’s plenty of other best practices that having an automated build system can help with, so what I’m discussing here will just cover the tip of the iceberg. If I’ve convinced you that automating your builds, read on.