xcode server & xcode 7 bots
TRANSCRIPT
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/
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
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
UI Testinghttp://www.mokacoding.com/blog/xcode-7-ui-testing/
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.
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
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
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)
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
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
xcodebuild• Build / Test / Coverage is also available using
xcodebuild outside of Xcode Server
• Coverage Data is also available, but messy - NSKeyedArchiver
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)