Slide 1

Slide 1 text

SUPERCHARGING iOS DEVELOPMENT Dal Rupnik CONTINUOUS INTEGRATION

Slide 2

Slide 2 text

CONTINUOUS INTEGRATION 2 WORKFLOW - DEVELOPMENT This is usually our workflow. Our project work flow consists of roughly 5 big phases.  SPECS  SETUP  CODE  TEST  PUBLISH  Feedback from Client

Slide 3

Slide 3 text

CONTINUOUS INTEGRATION 3 TOOLS - QUITE A FEW ON THE MARKET EACH PLATFORM
 IS SPECIFIC  CocoaPods Gradle Homebrew Jenkins Kiwi Bundler Mina Capistrano Composer Magallanes

Slide 4

Slide 4 text

CONTINUOUS INTEGRATION 4 OUR FOCUS - WHAT WILL WE COVER Strive not to be a success, but rather to be of value.bears - Albert Einstein Today we will focus on test and publish phases. What is there that could speed up those phases in our workflow?

Slide 5

Slide 5 text

TESTING FOR A GOOD CONTINUOUS
 INTEGRATION, WE NEED A GOOD TEST SETUP. 

Slide 6

Slide 6 text

CONTINUOUS INTEGRATION 6 TESTING - WHAT TEST CASES DO WE COVER There are three main types of tests on iOS. Each testing type has it’s specific tools, libraries and methods to work with. Unit Tests Test small components by separating it from larger modules.  Integration Tests Integrate components into modules and test them again working in together.  UI Tests Test user interfaces and animations on different screens and orientations. 

Slide 7

Slide 7 text

CONTINUOUS INTEGRATION 7 UNIT TESTING - EASY AND CLEAR TESTING  Xcode   XCTest Built in Xcode Kiwi Behaviour Driven Dev Specta & Expecta R-Spec BDD / TDD

Slide 8

Slide 8 text

CONTINUOUS INTEGRATION 8 UNIT TESTING - CHOICE OF FRAMEWORKS - (void)testUsernameLoad { XCTestExpectation *expectation = [self expectationWithDescription:@"Testing Async"]; [view.user loadWithCompletion:^{ XCTAssertEqual(label.text, @"Foo"); [expectation fulfill]; } [self waitForExpectationsWithTimeout:5.0 handler:^(NSError *error) { if(error) { XCTFail(@"Failed with error: %@", error); } }]; } it("equals YES", ^ { expect(view.isHidden).to.equal(YES); }); it(@"sets the user's name", ^ { [view.user load]; expect(label.text).will.equal(@"Foo"); }); From XCTests on the left to Specs on the right. Specs make really easy to read and understanding test code.

Slide 9

Slide 9 text

CONTINUOUS INTEGRATION 9 UI TESTING - WHY DO WE NEED TO TEST UI Design Code  SCREENS With newest devices, we have many different device sizes and screens. USER FLOWS When we update the code, user flows still need to start and complete correctly. ANIMATIONS Are we sure the animations complete correctly on all screens and devices? Are they fluid in all cases?

Slide 10

Slide 10 text

CONTINUOUS INTEGRATION PROCESS IN DEVELOPMENT WORKFLOW

Slide 11

Slide 11 text

CONTINUOUS INTEGRATION 11 BASICS - WHAT EXACTLY IS CI  Build Application  Clean Solution  Reports Test results Test Run all cases Success Output Commit Input

Slide 12

Slide 12 text

CONTINUOUS INTEGRATION 12 XCODE - BUILT IN XCODE BOTS COCOAHEADS

Slide 13

Slide 13 text

BUT THAT IS NOT ALL IS IT? AWESOME  DISTRIBUTION

Slide 14

Slide 14 text

CONTINUOUS INTEGRATION 14 DISTRIBUTION - NEED AN ONLINE SERVICE Need to choose a distribution service. This is a place where our application files will be hosted. TestFlight Owned by Apple and integrated into iTunes, previously separate service. Crashlytics Beta Owned by Twitter, began as a crash reporting service. Supports more platforms. HockeyApp Premium service with powerful API, for multi platform deployment. DeployGate Premium app distribution with additional services such as analytics and crash reporting.

Slide 15

Slide 15 text

CONTINUOUS INTEGRATION 15 DISTRIBUTION - A CLIENT WISHES TO SEE OUR WORK       Create a group Online service Invite testers Online service Add devices Apple Developer Portal Run tests Xcode Provisioning profile Apple Developer Portal Build application Xcode Download TBC Wait for registration I want to see

Slide 16

Slide 16 text

CONTINUOUS INTEGRATION 16 DISTRIBUTION       Create an archive Xcode Package the archive Xcode Sign & Export Xcode .ipa file Choose testers Online Service Upload to Service Desktop app or browser Write change log Online Service Repeat for every build Provisioning profile Lets assume it is a success - A CLIENT WISHES TO SEE OUR WORK

Slide 17

Slide 17 text

CONTINUOUS INTEGRATION 17 DISTRIBUTION - GETS VERY FRUSTRATING See where this is going? Yes, we hate it too. But, it does not have to be this way.

Slide 18

Slide 18 text

CONTINUOUS INTEGRATION 18 TOOLS - HOW CAN WE SOLVE THE PROBLEMS GitHub Service hooks 1 Bash Command line scripts 2 Ruby Easy & useful 3 Homebrew Installing tools 4 CocoaPods Dependency manager 5 xctool Facebook’s Build Tool 6 CI Server A Mac or a service 7 Gems Existing gems 

Slide 19

Slide 19 text

CONTINUOUS INTEGRATION 19 PROBLEMS - WHAT PROBLEMS DID WE ENCOUNTER 1. Load UDID’s from distribution service 2. Adding devices to Apple 3. Modifying provisioning profiles 4. Installing certificates 5. Downloading profiles 6. Notifications and messaging 7. Building application 8. Running tests 9. Signing application 10. Uploading build To make it work as a system in CLI Many problems had to be tackled and many systems had to be connected.

Slide 20

Slide 20 text

CONTINUOUS INTEGRATION 20 DISTRIBUTION SERVICES - HOW DO WE READ UDID’S Scraping website and calling API. Each service displays device UDID’s differently. Ruby Mechanize to the rescue. INSTALL GEM ATLANTISPRO TestFlight App Crashlytics Beta

Slide 21

Slide 21 text

CONTINUOUS INTEGRATION 21 DEVELOPER PORTAL - DOES APPLE PROVIDE AN API Sadly, Apple does not care much. But developers do. Cupertino Gem comes to our help. Devices Displays registered devices on portal Profiles Edits and downloads provisioning profiles Certificates Lists and downloads certificates App IDs Lists all Application IDs and bundles

Slide 22

Slide 22 text

CONTINUOUS INTEGRATION 22 BUILDING APP - XCODE COMMAND LINE TOOLS BUILD Builds in any architecture 1 TEST Tests with any SDK 2 REPORT Different outputs 3 PARALLEL Runs tests in parallel 4 xctool WRAPS XCODEBUILD

Slide 23

Slide 23 text

CONTINUOUS INTEGRATION 23 UPLOADING BUILD - HOW DO WE UPLOAD A BUILD Another Gem will do the job. Gem install Shenzhen and distribute with command line. iTunes Connect Uploads a build to iTunes Connect HockeyApp Uploads an .ipa file to HockeyApp TestFlight Old TestFlight portal also supported Crashlytics Beta Sends builds to Crashlytics Beta

Slide 24

Slide 24 text

CONTINUOUS INTEGRATION 24 SUMMARY - DISTRIBUTION PROCESS Deployment cycle Activated either by a CI server or command line Building Builds for all specified devices  Signing Signs with correct code identity  Distribute Deploys to specific service    Provisioning Downloads the new provisioning profile  New devices Add devices to Apple Developer Portal  Git Push Starts the process CLI interface Easy to use on client or CI server 

Slide 25

Slide 25 text

CONTINUOUS INTEGRATION 25 ALL TOGETHER - AN UNIFIED PROCESS dominus integrate Will do this entire process for you automatically. Any server Also works on Travis CI server Little setup Almost no configuration needed Uses Git Deploy can be hooked to a specific branch Notifications Fully integrated HipChat D

Slide 26

Slide 26 text

… OR ANOTHER RUBY GEM TRY  FASTLANE

Slide 27

Slide 27 text

CONTINUOUS INTEGRATION 27 LINKS - EVERYTHING WE TALKED ABOUT If you are interested in tools, here are the links. Of course, many other tools exist, that we did not mention. Do not be afraid to try those out. Specta & Expecta - https://github.com/specta/expecta Atlantis - https://github.com/Legoless/Atlantis Cupertino - https://github.com/nomad/cupertino Shenzhen - https://github.com/nomad/shenzhen Dominus - https://github.com/Legoless/Dominus Fastlane - https://github.com/KrauseFx/fastlane  TOOLS FOR CONTINUOUS INTEGRATION Some tools mentioned in this talk.

Slide 28

Slide 28 text

QUESTIONS? Go Ahead, Don’t Hesitate! ?

Slide 29

Slide 29 text

CONTINUOUS INTEGRATION 29 SOCIAL NETWORKS - IF YOU WANT TO GET IN CONTACT THANK YOU! Have a great meetup, guys!  /Legoless  @thelegoless  arvystate.net  /dalrupnik /Legoless