Slide 1

Slide 1 text

Build Automation & Distribution Matt Thomas

Slide 2

Slide 2 text

Why?

Slide 3

Slide 3 text

My company has over 50 apps on the App Store

Slide 4

Slide 4 text

50+ Apps! • Bug Fixes • Timely Release of New Features

Slide 5

Slide 5 text

…but why should you? Computers were literally made for it!

Slide 6

Slide 6 text

Why You Should Automate Eliminate Environment Issues

Slide 7

Slide 7 text

Why You Should Automate Send Apps to Testers

Slide 8

Slide 8 text

Why You Should Automate Stay Focused on Coding

Slide 9

Slide 9 text

Why You Should Automate Continuous Integration?

Slide 10

Slide 10 text

How?

Slide 11

Slide 11 text

Building

Slide 12

Slide 12 text

xcodebuild

Slide 13

Slide 13 text

xcodebuild • Core to all automation • Installed with Xcode • xcodebuild -help & man xcodebuild

Slide 14

Slide 14 text

xcodebuild -usage xcodebuild -project xcodebuild -scheme

Slide 15

Slide 15 text

buildactions • clean • build • archive • install* • test* * Mac only you can specify multiple at once

Slide 16

Slide 16 text

xcodebuild info xcodebuild -list

Slide 17

Slide 17 text

xcodebuild info xcodebuild -showBuildSettings

Slide 18

Slide 18 text

xcodebuild info xcodebuild -showsdks

Slide 19

Slide 19 text

xcodebuild tips • Multiple Xcode Installs? • Use DEVELOPER_DIR environment variable to select.

Slide 20

Slide 20 text

xcodebuild tips • Error running xcodebuild? • Run xcodebuild -license and accept.

Slide 21

Slide 21 text

xcodebuild tips • More information • WWDC 2012 Session 404 - Building from the Command Line with Xcode

Slide 22

Slide 22 text

Distribution

Slide 23

Slide 23 text

Distributing to Testers • Device Needs to be Provisioned • (max 100) • User Needs Provisioning Profile

Slide 24

Slide 24 text

Distributing to Testers • A packaged app — .ipa file • Provisioning profile Email

Slide 25

Slide 25 text

How do I make .ipa? xcrun -sdk iphoneos PackageApplication \ \ -o

Slide 26

Slide 26 text

How do I make .ipa? xcrun -sdk iphoneos PackageApplication \ \ -o \ --sign \ --embed re-sign the .ipa

Slide 27

Slide 27 text

OTA Install • Easiest User Experience • Annoying Setup • Bring your own server • Must use absolute URLs • No error messages, just “fails”

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

HTML Link Download Me MIME types application/octet-stream ipa text/xml plist Link itms-services://? action=download-manifest& url=http://foobar.com/MyApp.plist

Slide 30

Slide 30 text

Other Tools

Slide 31

Slide 31 text

xcodebuild-rb github.com/lukeredpath/xcodebuild-rb

Slide 32

Slide 32 text

gem install xcodebuild-rb • Rake interface for xcodebuild • Clean, Build, Archive • Shows Progress!

Slide 33

Slide 33 text

xcodebuild-rb example XcodeBuild::Tasks::BuildTask.new do |t| t.target = "MyApp" t.configuration = "Release" end rake xcode:cleanbuild Rakefile Terminal

Slide 34

Slide 34 text

shenzhen github.com/mattt/shenzhen

Slide 35

Slide 35 text

gem install shenzhen • command line tool: ipa • Clean, Build, Archive, Distribute • TestFlight • HockeyApp • FTP

Slide 36

Slide 36 text

shenzhen example ipa build \ --workspace MyApp.xcworkspace\ --scheme MyApp \ --configuration Release \ --clean \ --archive

Slide 37

Slide 37 text

shenzhen example ipa distribute:hockeyapp \ --token API_TOKEN \ --notes "New Stuff"

Slide 38

Slide 38 text

Jenkins + Xcode Plugin jenkins-ci.org wiki.jenkins-ci.org/display/JENKINS/Xcode+Plugin

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

Other Services

Slide 41

Slide 41 text

HockeyApp & TestFlight hockeyapp.net testflightapp.com

Slide 42

Slide 42 text

HockeyApp & TestFlight similarities • Easy OTA Distribution • Crash Reports • Analytics • Tester Feedback

Slide 43

Slide 43 text

HockeyApp & TestFlight differences • HockeyApp • More platforms (iOS, Android, Mac) • More API Access • TestFlight • Free

Slide 44

Slide 44 text

Continuous Integration Continuous Integration is a software development practice where members of a team integrate their work frequently… Each integration is verified by an automated build (including test) to detect integration errors as quickly as possible. martinfowler.com/articles/continuousIntegration.html

Slide 45

Slide 45 text

Continuous Integration • Automated Builds • With Testing • To Find Errors Quickly

Slide 46

Slide 46 text

The State of iOS Unit Testing

Slide 47

Slide 47 text

Unit Testing in Xcode

Slide 48

Slide 48 text

Unit Testing outside Xcode

Slide 49

Slide 49 text

Unit Testing outside Xcode is awful ‘test’ build action doesn’t work for iOS

Slide 50

Slide 50 text

Unit Testing outside Xcode is awful TEST_AFTER_BUILD=YES doesn’t work

Slide 51

Slide 51 text

Unit Testing outside Xcode is awful Can’t launch simulator from command line

Slide 52

Slide 52 text

Unit Testing outside Xcode is awful Hacks require editing an internal tool: /Tools/ RunPlatformUnitTests.include

Slide 53

Slide 53 text

New Testing Service Hoping to solve these issue

Slide 54

Slide 54 text

cisimple cisimple.com

Slide 55

Slide 55 text

cisimple • New continuous integration service for iOS & Android • Just entered public beta • GitHub, TestFlight, HockeyApp support

Slide 56

Slide 56 text

cisimple • Build each time commit is pushed • Run OCUnitTests • Run UIAutomation Instrument

Slide 57

Slide 57 text

Xcode Build Automation How it affected my work

Slide 58

Slide 58 text

Before Xcode Automation It took 2 developers 3 days to do all of our builds

Slide 59

Slide 59 text

After Xcode Automation 1 Developer 20 Minutes Spare Machine

Slide 60

Slide 60 text

Matt Thomas @mthomas codecaffeine.com