2. Introduction
First off, If you are interested in CI (Continuous Integration) & CD (Continuous development) for
iOS app then you are at right place. In this presentation, I will show how to set up CI server & CD
using TeamCity & Hockey App.
We will use:
1. TeamCity
2. Xcode
3. Hockey (create an account if you don’t have)
4. Java Updated version must be in your mac system.
Download TeamCity for Mac OS and unzip anywhere you want in your system.
Create a Hockey app Account.
Create a certificate & provisioning profile (Dev/Adhoc/Prod) on Apple developer account & install
in Xcode.
3. TeamCity Server Setup
Steps configure TeamCity Server
1. Unzip TeamCity in your Mac system
2. Move to folder bin (YourFolder ->TeamCity -> bin). You will get a file named ‘runAll.sh’
3. Open Terminal in your mac
4. Move to bin folder path on terminal (e.g. cd /Users/Gagan/Documents/TeamCity/bin) & enter
5. Type sh runAll.sh start and press enter.
6. On success, open http://localhost:8111 in your browser & wait.
7. When all configuration information is stored. Click Proceed.
8. Next screen Accept Licence & in next screen create account.
4. Adding Project VCS
In order to add a project on TeamCity, Open localhost:8111 browser
1. Click ‘Administration’ on top right hand of the screen.
2. Select option ‘Create Project’ under projects.
3. On next page, select ‘Manually’ option & enter your project detail. Note that parent project
would be by default ‘Root Project’.
4. Click ‘Create’
5. On Next Screen under Build configuration , select ‘Create Build Configuration’
6. On next screen add Build Id & other detail & select ‘Create’. Here Parent project would be your
project name (Already populated).
7. New Screen would be VCS screen.
8. Select type of VCS (in my case git).
9. Add a VCS Root Name what you wish.
10. Add your Git fetch URL. Add your brach name (by default would be master).
11. Select ‘Authentication Method’ as password & enter your GIT username & password detail.
12. Select ‘Test Connection’. It must be successful if you have entered correct info.
13. Select create.
5. Adding Project Build Steps
Build steps are the most important in CI & CD setup.
From right hand side of the local browser screen of your added app, Select ‘Build Steps’.
BUILD-STEP 1: Compile App
1. Select ‘Add Build Steps’
2. Choose Runner Type as ‘Xcode project’.
3. Give the step name as ‘Compile App’.(optional & you may put what you want).
4. Add ‘Path to the project or workspace’ by selecting most right hand side icon. it will
automatically parse your project & populates available option in project. In my case I am using
Workspace.
5. Select your scheme. if you are unable to find scheme then you need to make your app
schemes as shared & push the code again to reflect here (How to: on Last Screen of this
tutorial)
6. Select your scheme name & save.
6. Adding Project Build Steps
From right hand side of the local browser screen of your added app, Select ‘RUN’.
• It will take time and must be successful.
• Once completed move to your TeamCity folder at path /yourFolder/TeamCity/buildAgent/work’
• You will get a complete copy of your source code under a alphanumeric name folder.
• Now create a plist file name as ‘exportOptions.plist’
• Add following content in your plist from this PAGE. Read it carefully. You have to modify as per
your requirement.
• Place ‘exportOptions.plist’ file inside your downloaded project root folder.
7. Adding Project Build Steps
In this step we will create Archive file of the app, Select ‘Build Steps’ & add a new build step
BUILD-STEP 2: Archive App
1. Choose Runner Type as ‘Command Line’.
2. Give the step name as ‘Archive App’.
3. Select Run as ‘Custom Script’
4. Add below script in ‘Custom Script’ section
xcodebuild -workspace <WorkSpaceName>.xcworkspace -scheme <AppName> archive -
archivePath PathToAchive/<AppName>.xcarchive
For example:
xcodebuild -workspace DemoApps.xcworkspace -scheme AppOne archive -archivePath
/Users/Gagan/Documents/TeamCity/buildAgent/work/e9007099257627f0/AppOne.xcarchive
5. Click to Save
8. Adding Project Build Steps
In this step we will create IPA file of the app, Select ‘Build Steps’ & add a new build step
BUILD-STEP 3: Create App IPA
1. Choose Runner Type as ‘Command Line’.
2. Give the step name as ‘Create App IPA’.
3. Select Run as ‘Custom Script’
4. Add below script in ‘Custom Script’ section
xcrun xcodebuild -exportArchive -exportPath build -archivePath <AppName>.xcarchive -
exportOptionsPlist exportOptions.plist
For example:
xcrun xcodebuild -exportArchive -exportPath build -archivePath AppOne.xcarchive -
exportOptionsPlist exportOptions.plist
9. Adding Project Build Steps
In this step we will upload IPA file on Hockey app account, Select ‘Build Steps’ & add a new build step
BUILD-STEP 4: Upload App IPA on Hockey App
1. Choose Runner Type as ‘Command Line’.
2. Give the step name as ‘Upload App IPA’.
3. Select Run as ‘Custom Script’
4. Add below script in ‘Custom Script’ section
set -x
curl -F “status=2” -F “notify=0” -F “notes=Build %build.counter%” -F "notes_type=0" -F
“ipa=@/pathToIPA/<AppName>.ipa" -H "X-HockeyAppToken: <HokeyAppToken>"
https://rink.hockeyapp.net/api/2/apps/upload
For example:
set -x
curl -F “status=2” -F “notify=0” -F “notes=Build %build.counter%” -F "notes_type=0" -F
"ipa=@/Users/Gagan/Documents/TeamCity/buildAgent/work/e9007099257627f0/build/AppOne.ipa" -H "X-
HockeyAppToken: 23WXXXXXX38065168eeec6” https://rink.hockeyapp.net/api/2/apps/upload
10. Adding Project Build Steps
In this step we will remove created IPA file, Select ‘Build Steps’ & add a new build step
BUILD-STEP 5: Delete App’s IPA
1. Choose Runner Type as ‘Command Line’.
2. Give the step name as ‘Delete App IPA’.
3. Select Run as ‘Custom Script’
4. Add below script in ‘Custom Script’ section
rm /<PathToIPA>/<AppName>.ipa
rm -rf
For example:
rm /Users/Gagan/Documents/TeamCity/buildAgent/work/e9007099257627f0/build/AppOne.ipa
rm -rf
11. Adding Project Build Steps
In the last you would have total FIVE steps in your app ‘Build Steps’. See Screen Shot. Now you
can run the app on Local host to compile & upload IPA on Hockey. DONE :) Enjoy.
12. Shared Scheme Setting in
Xcode
• In Xcode, Select Edit Scheme under Product.
• Click on Manage Scheme.
• For your project, choose workspace name from drop down & Click on shared. See screen shot
• Chose close.
• Push the code in Git repo. After these steps you would able to find schemes name in Build step1.