Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Xcode Server & Xcode 7 Bots

4,494 views

Published on

A lightning talk overview on the features of Xcode Server, and the new features introduced with Xcode 7 at WWDC 2015 for Continuous Integration and Deployments.

Learn how Xcode Server works, how it integrates with Xcode, and how bots can help alert you, when something has gone wrong.

Published in: Mobile
  • Be the first to comment

Xcode Server & Xcode 7 Bots

  1. 1. Xcode Server / Xcode 7 Bots @forbze
  2. 2. Xcode Server • Part of OS X Server - Installed from Mac App Store • CI • Testing (Unit / Functional) • Static Analysis • Build Archiving • Can also host Git Repo http://localhost/
  3. 3. Bots • Xcode Server Service hosts bots • Configured and created in Xcode • Product > Create Bot • Configuration Set which includes “integration” parameters • build trigger • output path • etc. • Pre/Post Build Triggers
  4. 4. Xcode 7 • Much nicer API for managing bots in Xcode • JSON API for interacting with Xcode service • Code Coverage • UI Testing • Xcode UI Updates - Can show results over time in a graph
  5. 5. UI Testing http://www.mokacoding.com/blog/xcode-7-ui-testing/
  6. 6. Coverage Report
  7. 7. Problems • Xcode 7 is still beta - had lots of weird install bugs (beta 2 fixed some of these) • Running tests on devices is not straight forward - build logs aren’t always obvious (maybe because my Xcode server was on a VM?) • If you shut down the server temporarily and then launch Xcode - it forgets all the bots you have set up.
  8. 8. Benefits • Bots live in the same IDE as the code • Simple to use / configured • Trigger scripts can be written in any scripting language bash / perl / swift etc. • Reporting is available to all team members within Xcode • Reporting is inline with code (i.e. code coverage) • Multiple bots - per branch, different schedules & build triggers
  9. 9. Nice Integration • Triggers provide very simple manner to integrate with existing tools - such as HockeyApp upload… i.e. #!/bin/sh mkdir -p /tmp/$XCS_BOT_NAME/$XCS_INTEGRATION_NUMBER/ cd /tmp/$XCS_BOT_NAME/$XCS_INTEGRATION_NUMBER/ wget -O upload$XCS_INTEGRATION_NUMBER.ipa $XCS_PRODUCT curl -F "status=2" -F "notify=1" -F "notes=Some new features and fixed bugs." -F "notes_type=0" -F "ipa=@upload$XCS_INTEGRATION_NUMBER.ipa" -H "X-HockeyAppToken: 4567abcd8901ef234567abcd8901ef23" https://rink.hockeyapp.net/api/2/apps/1234567890abcdef1234567890abcdef/app_versions/upload
  10. 10. Lots of integration opportunities JSON API too if environment variables aren’t enough…
  11. 11. Integration Example • Using IFTTT to send SMS on build success / failure #!/bin/sh curl -X POST -H "Content-Type: application/json" -d "{"value1": "$XCS_BOT_NAME","value2":"$XCS_INTEGRATION_RESULT"}" https://maker.ifttt.com/trigger/Build_Complete/with/key/ aBCDeFgHHiJKl123noP • Could have used any IFTTT channel instead of SMS - or direct native API’s (i.e. HipChat / Slack)
  12. 12. More Integration • Using the JSON API - we can also trigger integrations. • Xcode Server can be integrated into an existing build pipeline • e.g. Bamboo triggers a build via the JSON API
  13. 13. Issues • Xcode client / server need to be able to communicate - on same network, or with network changes • Tests can’t be easily re-used for an Android project • Code based tests - not BDD… • Unit tests still work with Specta / Kiwi • Not clear how well it performs & scales
  14. 14. xcodebuild • Build / Test / Coverage is also available using xcodebuild outside of Xcode Server • Coverage Data is also available, but messy - NSKeyedArchiver
  15. 15. Recommendation • Wait for stable build of Xcode • Start using Xcode Server on projects where the environment suits it - local network, Mac Mini, no Android project etc. • Build an “centralised” Xcode server which is available externally for other projects (VPN / HTTPS)
  16. 16. Want to learn more? • Watch WWDC15 presentation - “Continuous Integration and Code Coverage in Xcode” @forbzeThanks!

×