iOS Developer Library — Prerelease

Developer

Xcode Server and Continuous Integration Guide

On This Page

Introduction

About This Technology

In Xcode, continuous integration is the process of automating and streamlining the building, analyzing, testing, and archiving of your Mac and iOS apps, in order to ensure that they are always in a releasable state. In a continuous integration workflow, you write apps locally in Xcode on your development Mac and check them into a source code repository. You then send them to Xcode Server, a service provided by OS X Server, for processing. In Xcode on your development Mac, you set up bots that run on the server. These bots process your apps, using the source code in your repository, and report back the results. Each run of a bot is called an integration, and these runs occur regularly throughout the development life cycle of your app. See Figure I-1.

Figure I-1Xcode continuous integration workflow image: ../art/continuous_integration_2x.png

The goal of continuous integration is to improve software quality, and there are a number of ways this is achieved:

  • Catching problems quickly, easily, and early. Bot integrations can be set up to run every time you commit a code change to your source code repository, on a specific schedule, or whenever you manually initiate them. This allows you to identify code problems throughout the development process, fix problems as they occur, and prevent smaller problems from cascading into larger ones.

  • Enhancing collaboration. In a continuous integration workflow, your entire team (or selected individuals) can create bots, trigger integrations, view activity, and download builds. If problems are introduced, the person whose code change caused the failure is notified automatically.

  • Broadening test coverage. When working locally, testing your app on multiple devices with multiple configurations is a manual and time intensive process. In a continuous integration workflow, it’s automatic and easy. Just plug multiple devices into the server or configure your workflow to use multiple simulators, configure your bots accordingly, and let the system do the work for you.

  • Generating build and test statistics over time. In a continuous integration workflow, all progress and failure is logged. At any given time, you can see where your app is in the development process and how it has matured over time.

At a Glance

Follow the steps outlined in this document to set up a continuous integration workflow using Xcode Server.

Install and Set Up Xcode Server

The first step in implementing a continuous integration workflow is to install OS X Server and configure Xcode Server to perform your integrations. Even if you’ve never set up a server before, you’ll find the process for setting up OS X Server and enabling Xcode Server to be quick and straightforward.

Connect Xcode Server to Source Code Repositories

In order for a bot to perform an integration of a project in Xcode Server, the bot must have access to the project’s source code. Xcode Server supports two popular source control systems: Git and Subversion. On your development Mac, you write the source code and push it to a source code repository. This repository can be hosted on a remote server (Git or Subversion) or in OS X Server (Git only). The bot pulls your latest source code whenever it performs an integration. See Figure I-2.

Figure I-2Xcode Server source code repository interaction image: ../art/sourcecode_repositories_2x.png

Create and Run Bots

Bots are at the center of the Xcode Server automated workflow. Bots build and test your projects with the schemes you specify. Because Xcode Server can access the source code repositories of your projects, you can create and schedule bots to run periodically, on every source code commit, or manually. You can also configure bots to send email notification of the success or failure of their integrations. Xcode Server also allows your bots to conduct performance testing and initiate pre- and postintegration triggers.

Monitor and Manage Bots

Xcode Server provides detailed information about the status of its integrations through Xcode on your development Mac, a browser, and email notifications. In the Xcode report navigator on your development Mac, you can manage bots, view their test results, read integration logs, initiate or cancel integrations, and download product archives. Xcode Server also hosts a bots website, where you and members of your development team can use a web browser to view the status of bot integrations and download assets and products. Bots can also be set up to send email notifications when integrations succeed, fail, or generate warnings. See Figure I-3.

Figure I-3Xcode Server activity reporting workflow image: ../art/activity_reporting_2x.png

Prerequisites

When setting up a continuous integration workflow, it’s a good idea to have an understanding of how to test and debug Xcode apps. For detailed information on testing and debugging, see Testing with Xcode, Debug Your App, and Instruments User Guide.

See Also

With OS X Server, small organizations and workgroups without an IT department can take full advantage of the benefits of a server. In addition to Xcode Server, OS X Server can provide other services to Mac, Windows, and UNIX computers, and to iOS devices such as iPhone, iPad, and iPod touch. You use the Server app to turn on the services you want to provide, customize service settings, and turn off services you don’t need. Services include Calendar, Contacts, DHCP, DNS, File Sharing, FTP, Mail, Messages, NetInstall, Open Directory, Profile Manager, Software Update, Time Machine, VPN, Websites, Wiki, and Xsan.

For information about setting up and administering these services while running the Server app, choose Help > Server Help. An administration guide, OS X Server: Advanced Administration, is also available online.