xcodedevopsxcode-server

Setting up Xcode Server to create archives and upload to TestFlight on commit


Up until this point I have been manually archiving and publishing to TestFlight. This wouldn't be an issue except when I include arm7 as a supported arch type, my archival time takes a giant leap from around 90 seconds (only targeting arm64) to 45-50 minutes. Some of my testers are still using 32 bit devices, (iPad 4, iPhone 5), so removing arm7 from my supported arch types isn't an option. I am therefore looking to integrate Xcode Server into my workflow so I can continue development as the server archives my latest commit.

This brings me to my question: what steps are involved in setting up Xcode Server to create an archive and upload to TestFlight (preferably automatically on pushing to my GitHub repo)?

The steps I have taken so far are:

  1. Set up Xcode Server
  2. Create Bot
  3. Re-enter my GitHub username/password (I get an Authentication failed because they are missing?)
  4. Select the remote branch
  5. Select Archive (Installable products and thinned variants) and set the configuration to Release
  6. Integrate (on commit) and clean build always
  7. Build for iOS devices
  8. Check the allow Xcode Server to manage my certificates and automatically add devices to my developer account.
  9. Add server to team (for some reason it keeps getting removed every time I go through these steps)
  10. The following two pages I've so far left blank.

The result of this workflow is a red exclamation next to my server name, with no bots listed underneath it. If I go through the Create Bot wizard again, I need to re-enter my GitHub details, and re-add Xcode Server to my team.

As for uploading the resultant archive, altool appears to be what I need (here). For the time being though I'd be happy if I could get a bot to create the archive and for me to manually upload to TestFlight.


Solution

  • As far as server setup take a look at the articles Honza Dvorsky wrote a while back. Things have changed in Xcode since 2015 but the basic idea is still the same you just do it inside Xcode rather than Server.app now.

    Then take a look at fastlane. You can create a lane that creates an archive and uploads it to TestFlight (along with anything else you want it to do). You can then create a post integration trigger that runs on success and triggers the lane.