Xcode

On this page

Still need help?

The Atlassian Community is here for you.

Ask the community

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:

  1. Navigate to the Tasks configuration tab for the job (this will be the default job if creating a new plan).
  2. Select the name of an existing Xcode task, or select Add task > Xcode to create a new task.
  3. 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.


  4. Select Save.

Xcode task type configuration screen

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 local agents:

  1. Log in as an administrator.
  2. In the upper-right corner of the screen, select
    Administration bamboo administration icon
    > Overview.
  3. Under Build resources, select Server capabilities.
  4. Select Detect server capabilities.

If you use remote agents:

  1. Run xcode-build -showsdks from the command line.
  2. Log in as an administrator.
  3. In the upper-right corner of the screen, select
    Administration bamboo administration icon
    > Overview.
  4. Under Build resources, select Agents.
  5. On the Agents summary page, pick the agent you wish for the new SDK capability to be present on.
  6. Select Add capability and pick Xcode SDK from the Capability type field.
  7. Set a name for the SDK (e.g. OS X 10.9).
  8. Set an SDK label (e.g. macosx10.9).
    Add capability to an agent screen



Last modified on Oct 9, 2023

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.