Hands on iOS developments with jenkins
Upcoming SlideShare
Loading in...5
×
 

Hands on iOS developments with jenkins

on

  • 4,881 views

This workshop explains how to setup an environment to build/test/deploy iOS applications using Jenkins CI server and an AppAloosa private store

This workshop explains how to setup an environment to build/test/deploy iOS applications using Jenkins CI server and an AppAloosa private store

Statistics

Views

Total Views
4,881
Slideshare-icon Views on SlideShare
4,872
Embed Views
9

Actions

Likes
6
Downloads
69
Comments
0

2 Embeds 9

https://twimg0-a.akamaihd.net 8
https://si0.twimg.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Hands on iOS developments with jenkins Hands on iOS developments with jenkins Presentation Transcript

    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Hands-On iOS Developments with Jenkins Arnaud Héritier eXo Platform http://www.exoplatform.com Mathieu Hausherr Octo Technology http://www.octo.com http://goo.gl/XWGDy 1
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Polls•  English or french ?•  Who is already doing iOS developments ?•  Who is already using JenkinsCI ?•  Who is already using JenkinsCI to manage iOS developments ? http://goo.gl/XWGDy 2
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Arnaud Héritier "   Jenkins " eXo platform –  Committer since 2010 –  Software Factory –  Maven integration Manager –  Xcode, Appaloosa plugins … –  In charge of tools and methods "   Apache Maven "   Contact me –  Committer since 2004 and –  http://aheritier.net member of the Project Management Committee –  Twitter : @aheritier –  Coauthor of « Apache –  Skype : aheritier Maven » •  published by Pearson (in French) http://goo.gl/XWGDy 3
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Mathieu Hausherr "   iOS "   Octo Technology –  Developer since 2008 –  Mobile Expert –  Installation of software factories for customers "   Other mobile platforms –  Android, Bada, Blackberry, Windows Phone 7... "   Contact me –  Mail: mha@octo.com –  Twitter : @mhausherr http://goo.gl/XWGDy 4
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Slide legend "   If you have a mac with XCode, follow us. "   In this slide you have something to do. "   In this slide we explain a workaround. Don’t be afraid by this explanation. You only need it tomorrow at home for your own Software factory. "   Find these slides here http://goo.gl/XWGDy 5
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Hands-On iOS Developments with Jenkins "   Concepts –  iOS specificities –  Continuous integration –  Continuous deployment "   How to –  Step by step Jenkins server setup –  Tips & Tricks to deals with Apple’s bug "   Hands on –  Prepare the Sample App –  Setup your Jenkins jobs –  Deploy your app on your device http://goo.gl/XWGDy 6
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Goals of Jenkins-CI on iOS CONCEPTS http://goo.gl/XWGDy 7
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconfReminder: Apple applicationprovisioning strategy Limite of Apple Validity Availability devices validation Ad Hoc 1 year 100 NO Everybody Only for In House 1 year ∞ NO companies App Store For life ∞ YES Everybody http://goo.gl/XWGDy 8
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Certificate management pitfalls•  Certificate with the same name doesn’t work•  Create specific keychains per project –  Never use default keychain•  “security set-default” command isn’t thread safe –  Allow only one executor per server http://goo.gl/XWGDy 9
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Why automatic distribution is useful for?•  Speedup the feedback loop with early adopters and QA Teams•  Improve time to market –  Spend time to develop instead of distribute•  Resign apps for certificates expiration –  Ad Hoc and In House certificates expire after one year –  Rebuild all your app safely http://goo.gl/XWGDy 10
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconfContinuous integration concepts SenTesting Clang Software Factory Source code Unit Static 1 + tests tests analysis Developer 3 Git Jenkins 2 Code Building versionning application 1 Source code + tests Developer http://goo.gl/XWGDy 11
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconfContinuous deployment concepts Apple doc Software Factory Documentation generation App Store Submit 2 5 Git Jenkins 4 Archive Public store 1 Archive Building 6 Download Code versionning application Appaloosa Push 4 Publish 5 6 Private Download store User devices http://goo.gl/XWGDy 12
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconfAppaloosa concept http://goo.gl/XWGDy 13
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconfGetting your deviceUDIDWe need your device UDID tobe able to push apps to yourdevice1.  Download “UDID sender” on the App Store2.  Send UDID via E-Mail to mha@octo.com http://goo.gl/XWGDy 14
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Step by step guide for Jenkins-CI on iOS HOW TO http://goo.gl/XWGDy 15
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconfPlugins installationØ  HomeØ  Manage JenkinsØ  Manage PluginsØ  Install these plugins •  Appaloosa •  Clang Scan-Build •  Git •  Xcode http://goo.gl/XWGDy 16
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconfPlugins configuration•  By default Xcode plugin settings should be good for a standard installation•  Clang Static Analyzer binaries have to be downloaded from http://clang- analyzer.llvm.org/ and extracted on the server or agent where they’ll be used•  In “System settings” (Clang Scan-Build Plugin part) you need to add at least one installation. http://goo.gl/XWGDy 17
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconfWhat if I soon have a Jenkins on a nonMac server? Git•  Why use a non Mac Jenkins? –  Regroup all your jobs Code versionning –  Maintain only one instance of Jenkins Master Node –  Create dependencies Jenkins between mobile and not mobile projects Scheduling build•  How use a non Mac Jenkins? MacOS Node –  Create Mac OS node XCode –  Only need a SSH connection Building application http://goo.gl/XWGDy 18
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconfNode creation•  To create an agent dedicated for xcode builds you need to create a node with : •  A label to select jobs for which you’ll use it •  A SSH connection with a password less private key •  The path for Clang checker binaries http://goo.gl/XWGDy 19
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconfAffect job to a node•  Create a “MacOSX” label•  Force job to run on “MacOSX”-labeled nodes http://goo.gl/XWGDy 20
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconf sudo vim `xcode-select -print-path`/ Platforms/iPhoneSimulator.platform/ Developer/Tools/RunPlatformUnitTestsXcode bug for iOS unittesting Replace Warning ${LINENO} "Skipping tests; theSource: http:// iPhoneSimulator platform does not currentlywww.raingrove.com/ support application-hosted tests (TEST_HOST2012/03/28/running-ocunit-and- set)."specta-tests-from-command- By:line.html export CFFIXED_USER_HOME="$ {BUILT_PRODUCTS_DIR}/UserHome/"•  Edit your RunPlatformUnitTests mkdir -p "${CFFIXED_USER_HOME}" mkdir -p "${CFFIXED_USER_HOME}/Library/ Caches" mkdir "${CFFIXED_USER_HOME}/Library/ Preferences" mkdir "${CFFIXED_USER_HOME}/Documents" export OTHER_TEST_FLAGS="$ {OTHER_TEST_FLAGS} - RegisterForSystemEvents" RunTestsForApplication "${TEST_HOST}" "$ {TEST_BUNDLE_PATH}" http://goo.gl/XWGDy 21
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconfConfigure your projectfor Unit Tests•  Check run action for your Test target•  Share your Scheme http://goo.gl/XWGDy 22
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconfAdd Xcode unit testingbuild phase•  Commit your scheme on GIT•  Use Scheme instead of target for testing. Use target only for building.•  Set SDK to iphonesimulator•  Set Configuration to Debug•  Add TEST_AFTER_BUILD=YES in Custom xcodebuild arguments http://goo.gl/XWGDy 23
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconf -  (void)test_parseRoomsFromDictionary_! returnObjectsArrayForCorrectDictionnary! {!Write a test // Given!•  Use SenTestKit Framework NSDictionary *dictionnary = [NSDictionary dictionaryWithObject:•  Add Mock With OCMock [NSArray array] forKey:KEY_ROOMS];! ! // When! NSArray* rooms = [JUCEventsService parseRoomsFromDictionary:dictionnary];! ! // Then! STAssertTrue([rooms isKindOfClass: [NSArray class]],nil);! } http://goo.gl/XWGDy 24
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconfAdd clang staticanalysis build phase•  Configure your target http://goo.gl/XWGDy 25
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconfAppaloosa jenkins’integration•  Check IPA generation•  Add Appaloosa step to your project•  Receive Push Notification Token: igjrz4w701ynrkzd2zwh2u450ilg00dg http://goo.gl/XWGDy 26
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Publish to the App Store•  Apple doesn’t provide API•  Need manual actions –  On a Mac –  Without proxy http://goo.gl/XWGDy 27
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconfGenerate Apple Doc•  Install Apple Dochttps://github.com/tomaz/appledoc•  Command lineappledoc conf.plist<outfile>•  Add an “aggregate” target to the projectPerform automatic docgeneration locally http://goo.gl/XWGDy 28
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Jenkins set-up, from GitHub to your device HANDS ON … LET’S GO http://goo.gl/XWGDy 29
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconfFork on github thesample projecthttp://goo.gl/alKgWAnd then clone yourforkgit clone git://github.com/XXXX/JenkinsSample.git http://goo.gl/XWGDy 30
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconfSetup a continuousintegration jobSetup Git http://goo.gl/XWGDy 31
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconfSetup a continuousintegration jobAdd a Clang Scan-Build Phase http://goo.gl/XWGDy 32
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconfSetup a continuousintegration jobAdd an Xcode build step toexecute tests•  Use a schema (JUC Paris)•  SDK = iphonesimulator•  Config = Debug•  Args = TEST_AFTER_BUILD=YES•  Clean test reports http://goo.gl/XWGDy 33
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconfSetup a continuousintegration jobActivate Clang and unit testsreports http://goo.gl/XWGDy 34
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconfFix the testInJUC ParisTests/JUC_ParisTests.mComment the failling testCommit and push on githubgit add .git commitgit pushRelaunch your build http://goo.gl/XWGDy 35
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconfChange your BundleIdInProject Properties > JUC ParisTarget > SummaryChangeBundle identifier tocom.jenkins.juc-paris.app.yournameCommit and push on githubgit add .git commitgit push http://goo.gl/XWGDy 36
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconfAdd a deploymentJobSame github settingsCreate an Xcode build step•  Target = JUC Paris•  Config = Release•  Setup versions•  Build IPA•  Embedded profile http://goo.gl/XWGDy 37
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconfAppaloosa installationon your device http://goo.gl/hQ2Ue http://goo.gl/XWGDy 38
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconfAppaloosa installationon your deviceAccount information•  Login: mha+juc@octo.com•  Password: jenkins  http://goo.gl/XWGDy 39
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconfAdd a deploymentJobSetup Appaloosa with this token :igjrz4w701ynrkzd2zwh2u450ilg00dg http://goo.gl/XWGDy 40
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconfEnjoy http://goo.gl/XWGDy 41
    • Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Thank You To Our Sponsors Platinum Sponsor Gold Sponsor Silver Sponsor http://goo.gl/XWGDy 42