New CI Features with Xcode 9 & Xcode Server

Federico Mazzini
Major League
Published in
3 min readJul 4, 2017

--

While exploring new ways of improving our development processes in Lateral View, we started fiddling with With Xcode 9 (now Beta). It comes with the possibility of saving a lot of scripting and certificate management. And the possibility of retiring a bunch of tools related to Continuous Integration: Fastlane, CircleCI, Jenkins, TeamCity, Bluepill and TravisCI (More on this last one at te end).

Surprised? You are getting it right. Xcode 9 comes with a built-in Xcode Server that sits on MacOS’s Menu bar. With it we can:

  • Manage which users of the OS are allowed to run tests.
  • Configure a mailing service to send reports after each integration.
  • Set a timeout for integrations.

Xcode Server is activated through Xcode settings and these options are configured through Xcode settings, but, our Xcode Server instance is independent of Xcode itself. After we installed Xcode and finished the initial configuration of its built in Xcode Server, we can close Xcode and let our new Xcode server instance freely perform integrations as a host as it will remain active until we explicitly turn it off.

Look for the Bots in Xcode settings and Xcode Report Navigator

That’s fine but how do we use it? It’s surprisingly easy. All we have to do is open Xcode from any machine, and under the old Report Navigator screen we’ll see a section for that machine’s Xcode Server. If we right click it, well have the option to create a Bot. Bots will be the stars of our CI solutions. As we can configure them with a bunch of new useful options, in this order:

  • Naming the bot.
  • Selecting the instance of Xcode Server in which the bot will perform the integrations (we can specify the ip address of a remote OS instance with Xcode 9, and thus, Xcode Server installed, this is particularly useful).
  • Choose a remote project branch for the Bot to watch.
  • Save valid credentials for the bot to fetch this branch for each integration.
  • Specify the scheme that the bot will use to run integrations (Xcode 9 will ask us to push new scheme information, as this is needed for the bot to work).
  • Specify which actions to perform on integration and with settings to apply: Analyze, Test, Coverage, App Region and Archiving.
  • Choose Debug or Release Configuration.
  • Choose whether we integrate manually, on commit, or periodically (choosing a window frame between integrations at will).
  • Choose when to perform a project Clean: Never, Always, per Day, per Week.
  • Choose which devices to Test: All or specific devices. Depending on the simulators we have installed.
  • Choose if the devices will perform the test in parallel or not.
  • Choose if we allow Xcode Server to manage certificates and profiles, also automatically adding missing devices to the team (very useful).
  • Set up environment variables and arguments passed to xcodebuild.
  • Configure integration triggers: Scripts and Emails.

So we can create, configure, and watch the bots from Xcode in our machines, and they will watch our remote branch and perform the integrations from the server of ur liking. Great!

There are but a couple of not so small caveats:

  • Integrations do not support repository pull requests. We still need third party tools like TravisCI.
  • Generated IPA’s do not go to iTunes Connect automatically.

If you want to know more about technology and innovation, check us out at Lateral View or subscribe to our newsletter!

--

--