Continuous Integration is a must have for all modern development projects, including iOS apps. Thanks to Travis you can setup full stack CI environment in minutes. This includes not only automatic unit testing on server side, but also deploying your mobile app to testers in real time.
My sample project provides full-stack continuous integration environment. It takes advantage of a free Travis-CI service.
Development flow is as follows:
- Commit and push changes to the repository
- Travis CI will fetch changes and update dependencies defined in Podfile using Cocoapods
- Build project for iPhone Simulator and run unit tests
- Build project for distribution
- Sign app with distribution certificate contained in the repository
- Upload signed IPA and dSYM files to TestFlight API
- If app's build version changed, notify teammates via TestFlight
The project itself is just a simple application with one view controller that displays a label and button. You can test the integrated crash reporting tool by tapping on the button – it will cause the app to crash.
Project’s dependencies are managed by Cocoapods. API tokens and distribution certificate private keys are encrypted and securely stored in the repository.
You can use Travis-CI for open-source projects, and deploy your app automatically. If you would like to try my script and configuration for your project, just install the Travis tool:
gem install travis
secure statements in
.travis.yml file with output from commands:
travis encrypt "TF_TEAM_TOKEN=your_testflight_team_token" travis encrypt "TF_API_TOKEN=your_testflight_api_token" travis encrypt "KEY_PASSWORD=password_used_to_secure_certificates_private_key"
Check out my example project on GitHub.
Do you use iOS Continuous Integration for your projects?
This article was also published on EL Passion blog.