Automation DevOps Featured iOSDev

Xcode9 + Xcode Server = Comprehensive iOS Continuous Integration

At WWDC 2017, Apple announces something that made almost every iOS developer smile, a session on ‘What’s New in Signing for Xcode and Xcode Server‘.  It’s hard to explain, how easy it becomes to perform Continuous Integration for Apple platforms especially iOS and macOS using Xcode 9 and Xcode Server.

CI Before Xcode 9

The iOS Continuous Integration before Xcode 9 release was very challenging. As people might have tried following things

  • Fought long battle to setup CI server machines with certificates and profiles.
  • Used Ruby based tool like Fastlane to automate the process of analysing, building, testing and code signing.
  •  Used other third party cloud CI services like TravisCI, CircleCI or self-hosted solutions like Jenkins, TeamCity to use bash scripted build or automated build from  Fastlane
  • Used tools like xctool by Facebook or Bluepill by LinkedIn to parallelize testing on multiple devices and Simulators.
  • Used third party Ruby-based tools like xcov, xcpretty for code coverage and test reporting.
  • Used Xcode Server with macOS Server app and Xcode Service for CI but still fighting with code signing and parallel execution.

Xcode Server with Xcode 9 made all these things of past. You rarely need the things above now. Xcode Server handles it all for us so easily. Thank all the developers working on developer tools to make this happen. Let’s see what’s changes

CI After Xcode 9

In Xcode 9, we have following new CI related features integrated within Xcode

  • Xcode Server is inbuilt with Xcode 9 so no need to have separate macOS app.
  • Xcode Server bot has new tabs for code signing’ and parallel testing on multiple devices and simulators with automatic provisioning of devices.
  • Automatically signing of both development and distribution signing.
  • Xcode Server creates distribution IPA with automated or manual signing
  • Xcode Sever does not launch simulator anymore still able to run in parallel.

Now, we will see that in action how easy to setup and use Xcode Server.

Setting Up Xcode Server

As mentioned earlier, Xcode Server no longer needs macOS Server app, it’s now built inside Xcode. We can see “Servers & Bots”  tab in the Xcode Preference. We can setup Xcode Server using local Mac or another Mac. We need to select the Mac and Integration user. See the GIF below to understand the process of enabling Xcode Server.

Once the service is running, we are good to create our Xcode bots to perform the continuous integration. In this tutorial, we will create a bot for both macOS and iOS application. We will create Bot for Swift package XCFit for macOS and Demo app XCS-Demo for iOS.

Creating Bots for iOS Apps – iOS

We will use Demo app XCS-Demo for iOS to set up Xcode Server. We have regular steps to create bots from  Xcode “Product -> Create Bot” and name the bot as “XCFit Bot”. Next step is to add Github Repo to the Bot. We have to add Git Repo with SSH. Xcode will ask you to trust the identity repository. You have to select “Trust” and use credential of existing SSH Key. Once successfully authorised, we should able to configure build. The build configuration is the main stage to configure what we want to perform as part of the build. We will see following main configuration options.

  • Scheme
  • Actions –  Analyse, Test, Archive and
  • Configurations

Next screen will be on scheduling the Bot integration which is self-explanatory.

Next, we have the option to add code signing. We can have the option to give Xcode Server access to developer portal and it will do everything for us. We have other option to choose a certificate from server machine for manual signing.

Automated Code Signing

Parallel Testing

We click next we have seen to select devices for testing and there is “Run tests in parallel” tick box which enables parallel execution on multiple simulators.


Test Reporting

Once bot finishes running tests, we get nice little reports within Xcode itself. The Test Reporting in Xcode Server looks like this:

Watch it in Action

The entire action looks like this:

Creating Bots for Swift Packages – macOS

Swift packages don’t need to be run inside simulator or devices. We can run them on macOS. Let’s create a bot for Swift package XCFit. It’s much simpler and quicker than iOS


We just saw some shiny new features of Xcode Server but what will benefit that will bring for business or team

  • No need to write scripts for build automation  or manage CI servers for certificates and profiles
  • We can achieve continuous delivery by setting Xcode Server within few clicks

Missing Features

Although, Apple engineers made Xcode Server awesome there are couple of features still missing

  • Support for testing Pull Request  just like TravisCI
  • Uploading the IPA to iTunes Connect or TestFlight
  • do you think anything else?


With Xcode 9 and Xcode Server, we have almost everything in single place. It’s time to retire many tools from toolbox e.g  Fastlanexctool by Facebook or Bluepill by LinkedIn or other CI servers like TravisCI, CircleCI or self-hosted CI solutions like Jenkins, TeamCity. It’s time to completely switch to Xcode Server.

  • Jonas Reichert

    I think Xcode Server is still missing many important features, that’s why I can’t agree with your conclusion of your otherwise nice article. E.g. there is no way to say “keep only the last x integrations” of each bot, you still have to manually delete each integration via Server API. Manually deleting IntegrationAssets folder on my Mac does not reset the list of integrations anymore. etc.

    • Hi @jonas_reichert:disqusThanks a lot for your comment. I agree that there is still some maintainace needed to keep the server in sync. We can easily automate these maintenance task with scripts that can run as part of lounchd or cron job. Do you face any other issues in terms of code signing etc ?

  • Kashif Jilani

    Thats really good tutorial, Previously I need to use Mac OS X server and Bot. Now its super duper easy.

  • Hi @Matvdg:disqus Thanks a lot for your comment. I will try to answer your question as per my knowledge 🙂
    1) I think accessing remotely is still possible as long as machine in the network and has host name even if server is being embedded in Xcode. You might see the Xcode Server web page with bots status as well as OTA installation link if it works 🙂
    2) Yes. At the moment Xcode Server just doing iPA for us. We can write custom script to upload that iPA file to various places e,g Fabric, HockyApp or similar. We can also upload it to TestFlight by setting Post Script Trigger and using Apple’s xcrun agvtool .. Or you can run Fatstlane pilot action to upload it t TestFlight but using pilot is not required. You can get more info about avgtool using $ xcrun avgtool command
    Hope that help 🙂

    Don’t worry about English, I am not English too and my English is horrible as well 🙂

    • Mathieu Vandeginste

      Thanks a lot for your answer! I’ll try that asap!

  • Craig Fisher

    Would you happen to have a good resource to follow in order to create a Bot the the Server API? For the life of me, when following apple documentation, I cannot create a new bot (POST) nor can I update an existing bot (PATCH). Keep in mind I’m trying to use the GitHub webhooks so I have to kick everything off through a URL Payload.

    I can do everything else within the API like calling bots, query specific bots, etc. But creating and updating a bot are throwing me for a loop with 500 errors. I’ve scoured the interwebs and have found nothing in terms of a how to on how to create a bot from scratch but the Server API seems pretty straightforward. I’m hoping that I’m just missing something simple here…

    • Hi @disqus_LwtBkChPrI:disqus Thanks for your comment and sorry for the delayed responding. I haven’t tried latest API to create BOT though POST request. I am still looking for clean solution for the test Pull Request. The old softwares Buildasaur and XBotBuilder are broken as well. I will try if I can create bots using POST and update you

    • Hi @disqus_LwtBkChPrI:disqus I tried creating the bot with POST but I am also getting ‘Internal Server Error” have you raised but or radar for this ? This is really annoying Or have you found any workaround for this?

  • Nishant Singh

    I Have:
    MacOS High Sierra: 10.13.1
    macOS Server: 5.4
    Xcode: 9

    How to setup Xcode server on public domain? like We have our own server.

    Please help

    • Hi @Nishant .. You can access Xcode Server with its canonical hostname within your network. You need to give it a name if your domains if you want to access it, what’s the purpose to make Xcode Server public ?

  • Luan Nguyen

    I’m trying with XCode9 XCS without any third services such as TravisCI, fastlane,.., facing a problem with XCS as described below:
    Once an integration takes place, the source code will be clean completely and fetch the latest one from the repo, as I’m experiencing and guess so. I didn’t store Pods and Carthage folders in git. There are no respective folders after fetching in XCS local. I have added 2 pre-integration scripts:
    1. for Pod: if [ -e “Pods”]: `pod update` else `pod install`
    2. for Carthage: using CarfileDiff to cache Carthage to speed-up following a relevant article on your site.

    Seems like pod and carthage always get run from scratch whenever the bot starts an integration.
    Is there any reasonable way to cache Pods and Carthage frameworks for future integrations if their frameworks are available and up-to-date?

    • Hi Luan, thanks for your comment and apologies for the delayed responding. I think if you are managing servers yourself then you have to implement caching for pods and Carthage yourself. TravisCI has done that already for the OSX images. It’s lot of work to do for self hosted CI solutions