Xcode
Prerequisites
- Apple Xcode 4 – or later version
- Certificates and provisioning profiles – You must install all required developer certificates and provisioning profiles on every machine that Bamboo will use to run your build. See the App Distribution Guide for more information.
- Bamboo Xcode support plugin – The latest Xcode plugin installed in your Bamboo server.
- ios-sim (optional when building Mac applications) – a command line utility used to launch the iOS Simulator from the command line. If you have homebrew installed, you can install it by running
brew install ios-sim
. For other installation methods, see the ios-sim website. - Cocoapods (optional if you do not have a
Podfile
in your project) – Cocoapods is the library dependency manager for Mac OS X. In order for Bamboo to install dependencies from your Podfile (if you have created one), Bamboo will need it installed on all systems where the build should run.
Testing iOS applications
To have tests automatically run on the iOS Simulator and reported within Bamboo you must make some changes to your Xcode project's test bundles and add the Xcode build task to your Job within Bamboo.
Configuring your Xcode project automated simulator tests
Without modifications, Apple does not support running unit tests in the simulator using the xcodebuild
terminal utility which Bamboo uses to automate builds and tests.
Using ios-sim and a small modification to the RunUnitTests script phase in the test bundle it's possible to overcome this limitation.
Change the content of the script to:
if [ "$RUN_UNIT_TEST_WITH_IOS_SIM" = "YES" ]; then
test_bundle_path="$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.$WRAPPER_EXTENSION"
ios-sim launch "$(dirname "$TEST_HOST")" --setenv DYLD_INSERT_LIBRARIES=/../../Library/PrivateFrameworks/IDEBundleInjection.framework/IDEBundleInjection --setenv XCInjectBundle="$test_bundle_path" --setenv XCInjectBundleInto="$TEST_HOST" --args -SenTest All "$test_bundle_path"
echo "Finished running tests with ios-sim"
else
"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests"
fi
Configuring the Xcode task for testing
To configure a Xcode to test an iOS project task:
- Navigate to the Tasks configuration tab for the job (this will be the default job if creating a new plan).
- Select the name of an existing Xcode task, or select Add task > Xcode to create a new task.
Complete the following settings:
Task description
A description of the task, which is displayed in Bamboo.
Disable this task
Check, or clear, to selectively run this task.
Add condition to task
Make task run only when a certain condition is met.
You can find conditions on Atlassian Marketplace or implement your own.
Apple SDK
The Apple SDK to target during the build.
Report test results
Report and store any OCUnit/SenTestKit results run during the build.
Run tests in iOS simulator
Provides the RUN_UNIT_TEST_WITH_IOS_SIM variable used in the custom build phase to run the unit tests on the simulator.- Select Save.
Updating the available SDKs when Xcode is upgraded
When you upgrade Xcode you may need to update Bamboo with the correct SDK information.
If you use remote agents:
- Run
xcode-build -showsdks
from the command line. - Log in as an administrator.
- In the upper-right corner of the screen, selectAdministration> Overview.
- Under Build resources, select Agents.
- On the Agents summary page, pick the agent you wish for the new SDK capability to be present on.
- Select Add capability and pick Xcode SDK from the Capability type field.
- Set a name for the SDK (e.g. OS X 10.9).
- Set an SDK label (e.g. macosx10.9).