SlideShare a Scribd company logo
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
–  Committer since 2010
–  Maven integration
–  Xcode, Appaloosa plugins …
"   Apache Maven
–  Committer since 2004 and
member of the Project
Management Committee
–  Coauthor of « Apache
Maven »
•  published by Pearson (in
French)
" eXo platform
–  Software Factory
Manager
–  In charge of tools
and methods
"   Contact me
–  http://aheritier.net
–  Twitter : @aheritier
–  Skype : aheritier
3http://goo.gl/XWGDy
Jenkins User Conference Paris, 17 April 2012 #jenkinsconf
Mathieu Hausherr
"   iOS
–  Developer since 2008
"   Other mobile platforms
–  Android, Bada, Blackberry,
Windows Phone 7...
"   Octo Technology
–  Mobile Expert
–  Installation of software
factories for customers
"   Contact me
–  Mail: mha@octo.com
–  Twitter : @mhausherr
4http://goo.gl/XWGDy
Jenkins User Conference Paris, 17 April 2012 #jenkinsconf
Slide legend
http://goo.gl/XWGDy 5
"   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
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
6http://goo.gl/XWGDy
Jenkins User Conference Paris, 17 April 2012 #jenkinsconf
CONCEPTS
Goals of Jenkins-CI on iOS
7http://goo.gl/XWGDy
Jenkins User Conference Paris, 17 April 2012 #jenkinsconf
Reminder: Apple application
provisioning strategy
Validity
Limite of
devices
Apple
validation
Availability
Ad Hoc 1 year 100 NO Everybody
In House 1 year ∞ NO
Only for
companies
App Store For life ∞ YES Everybody
8http://goo.gl/XWGDy
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
9http://goo.gl/XWGDy
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
10http://goo.gl/XWGDy
Jenkins User Conference Paris, 17 April 2012 #jenkinsconf
Continuous integration concepts
Developer
Developer
Source code
+ tests
Unit
tests
SenTesting
Source code
+ tests1
1
2
3
Software
Factory
Building
application
Jenkins
Code
versionning
Git
Static
analysis
Clang
11http://goo.gl/XWGDy
Jenkins User Conference Paris, 17 April 2012 #jenkinsconf
Continuous deployment concepts
Publish
Building
application
Jenkins
Private
store
Appaloosa
Download
Documentation
generation
Apple doc
1
2
4
Code
versionning
Git
Push
5
6
User
devices
Software
Factory
Archive4
Archive
Public
store
App Store
Submit
5
6 Download
12http://goo.gl/XWGDy
Jenkins User Conference Paris, 17 April 2012 #jenkinsconf
Appaloosa concept
13http://goo.gl/XWGDy
Jenkins User Conference Paris, 17 April 2012 #jenkinsconf
Getting your device
UDID
We need your device UDID to
be able to push apps to your
device
1.  Download “UDID sender” on
the App Store
2.  Send UDID via E-Mail to
mha@octo.com
http://goo.gl/XWGDy 14
Jenkins User Conference Paris, 17 April 2012 #jenkinsconf
HOW TO
Step by step guide for Jenkins-CI on iOS
15http://goo.gl/XWGDy
Jenkins User Conference Paris, 17 April 2012 #jenkinsconf
Plugins installation
Ø  Home
Ø  Manage Jenkins
Ø  Manage Plugins
Ø  Install these plugins
•  Appaloosa
•  Clang Scan-Build
•  Git
•  Xcode
16http://goo.gl/XWGDy
Jenkins User Conference Paris, 17 April 2012 #jenkinsconf
Plugins 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.
17http://goo.gl/XWGDy
Jenkins User Conference Paris, 17 April 2012 #jenkinsconf
What if I soon have a Jenkins on a non
Mac server?
•  Why use a non Mac
Jenkins?
–  Regroup all your jobs
–  Maintain only one
instance of Jenkins
–  Create dependencies
between mobile and not
mobile projects
•  How use a non Mac
Jenkins?
–  Create Mac OS node
–  Only need a SSH
connection
http://goo.gl/XWGDy 18
Master Node
Scheduling
build
Jenkins
Code
versionning
Git
MacOS Node
Building
application
XCode
Jenkins User Conference Paris, 17 April 2012 #jenkinsconf
Node 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
19http://goo.gl/XWGDy
Jenkins User Conference Paris, 17 April 2012 #jenkinsconf
Affect job to a node
•  Create a “MacOSX” label
•  Force job to run on
“MacOSX”-labeled nodes
20http://goo.gl/XWGDy
Jenkins User Conference Paris, 17 April 2012 #jenkinsconf
Xcode bug for iOS unit
testing
Source: http://
www.raingrove.com/
2012/03/28/running-ocunit-and-
specta-tests-from-command-
line.html
•  Edit your RunPlatformUnitTests
sudo vim `xcode-select -print-path`/
Platforms/iPhoneSimulator.platform/
Developer/Tools/RunPlatformUnitTests
Replace
Warning ${LINENO} "Skipping tests; the
iPhoneSimulator platform does not currently
support application-hosted tests (TEST_HOST
set)."
By:
export CFFIXED_USER_HOME="$
{BUILT_PRODUCTS_DIR}/UserHome/"
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}"
21http://goo.gl/XWGDy
Jenkins User Conference Paris, 17 April 2012 #jenkinsconf
Configure your project
for Unit Tests
•  Check run action for your
Test target
•  Share your Scheme
22http://goo.gl/XWGDy
Jenkins User Conference Paris, 17 April 2012 #jenkinsconf
Add Xcode unit testing
build 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
23http://goo.gl/XWGDy
Jenkins User Conference Paris, 17 April 2012 #jenkinsconf
Write a test
-  (void)test_parseRoomsFromDictionary_!
returnObjectsArrayForCorrectDictionnary!
{!
// Given!
NSDictionary *dictionnary =
[NSDictionary dictionaryWithObject:
[NSArray array] forKey:KEY_ROOMS];!
!
// When!
NSArray* rooms = [JUCEventsService
parseRoomsFromDictionary:dictionnary];!
!
// Then!
STAssertTrue([rooms isKindOfClass:
[NSArray class]],nil);!
}
•  Use SenTestKit Framework
•  Add Mock With OCMock
24http://goo.gl/XWGDy
Jenkins User Conference Paris, 17 April 2012 #jenkinsconf
Add clang static
analysis build phase
•  Configure your target
25http://goo.gl/XWGDy
Jenkins User Conference Paris, 17 April 2012 #jenkinsconf
Appaloosa jenkins’
integration
•  Check IPA generation
•  Add Appaloosa step to your
project
•  Receive Push Notification
Token: igjrz4w701ynrkzd2zwh2u450ilg00dg
26http://goo.gl/XWGDy
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
27http://goo.gl/XWGDy
Jenkins User Conference Paris, 17 April 2012 #jenkinsconf
Generate Apple Doc
•  Install Apple Doc
https://github.com/tomaz/
appledoc
•  Command line
appledoc conf.plist
<outfile>
•  Add an “aggregate” target
to the project
Perform automatic doc
generation locally
28http://goo.gl/XWGDy
Jenkins User Conference Paris, 17 April 2012 #jenkinsconf
HANDS ON … LET’S GO
Jenkins set-up, from GitHub to your device
29http://goo.gl/XWGDy
Jenkins User Conference Paris, 17 April 2012 #jenkinsconf
Fork on github the
sample project
http://goo.gl/alKgW
And then clone your
fork
git clone git://
github.com/XXXX/
JenkinsSample.git
30http://goo.gl/XWGDy
Jenkins User Conference Paris, 17 April 2012 #jenkinsconf
Setup a continuous
integration job
Setup Git
http://goo.gl/XWGDy 31
Jenkins User Conference Paris, 17 April 2012 #jenkinsconf
Setup a continuous
integration job
Add a Clang Scan-Build Phase
http://goo.gl/XWGDy 32
Jenkins User Conference Paris, 17 April 2012 #jenkinsconf
Setup a continuous
integration job
Add an Xcode build step to
execute 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 #jenkinsconf
Setup a continuous
integration job
Activate Clang and unit tests
reports
http://goo.gl/XWGDy 34
Jenkins User Conference Paris, 17 April 2012 #jenkinsconf
Fix the test
In
JUC ParisTests/JUC_ParisTests.m
Comment the failling test
Commit and push on github
git add .
git commit
git push
Relaunch your build
http://goo.gl/XWGDy 35
Jenkins User Conference Paris, 17 April 2012 #jenkinsconf
Change your Bundle
Id
In
Project Properties > JUC Paris
Target > Summary
Change
Bundle identifier to
com.jenkins.juc-
paris.app.yourname
Commit and push on github
git add .
git commit
git push
http://goo.gl/XWGDy 36
Jenkins User Conference Paris, 17 April 2012 #jenkinsconf
Add a deployment
Job
Same github settings
Create 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 #jenkinsconf
Appaloosa installation
on your device
http://goo.gl/hQ2Ue
http://goo.gl/XWGDy 38
Jenkins User Conference Paris, 17 April 2012 #jenkinsconf
Appaloosa installation
on your device
Account information
•  Login:
mha+juc@octo.com
•  Password:
jenkins 
http://goo.gl/XWGDy 39
Jenkins User Conference Paris, 17 April 2012 #jenkinsconf
Add a deployment
Job
Setup Appaloosa with this token :
igjrz4w701ynrkzd2zwh2u450ilg00dg
http://goo.gl/XWGDy 40
Jenkins User Conference Paris, 17 April 2012 #jenkinsconf
Enjoy
41http://goo.gl/XWGDy
Jenkins User Conference Paris, 17 April 2012 #jenkinsconf
Thank You To Our Sponsors
Platinum Sponsor
Silver Sponsor
Gold Sponsor
42http://goo.gl/XWGDy

More Related Content

PPTX
Евгений Бова: "Modularity in Java: introduction to Jigsaw through the prism o...
PPTX
Константин Маркович: "Creating modular application using Spring Boot "
PPTX
PhoneGap Day 2016 EU: Creating the Ideal Cordova Dev Environment
PDF
Introducing OWASP OWTF Workshop BruCon 2012
PDF
How do I Write Testable Javascript so I can Test my CF API on Server and Client
PDF
Testing Automaton - CFSummit 2016
PDF
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
PDF
Intro 2 docker
Евгений Бова: "Modularity in Java: introduction to Jigsaw through the prism o...
Константин Маркович: "Creating modular application using Spring Boot "
PhoneGap Day 2016 EU: Creating the Ideal Cordova Dev Environment
Introducing OWASP OWTF Workshop BruCon 2012
How do I Write Testable Javascript so I can Test my CF API on Server and Client
Testing Automaton - CFSummit 2016
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Intro 2 docker

What's hot (20)

PPTX
Zalenium - Czyli lepszy Selenium Grid
PDF
Null July - OWTF - Bharadwaj Machiraju
PPTX
Intro to JavaScript Tooling in Visual Studio Code
PPTX
Selenoid + Allure - How to use these tools together?
PDF
How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016
PDF
End to-end testing from rookie to pro
PDF
Create, test, secure, repeat
PPTX
Defcon - Veil-Pillage
PDF
Continuous Integration Testing in Django
PDF
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
PDF
OWASP OWTF - Summer Storm - OWASP AppSec EU 2013
PDF
Magento and Continuous Integration - Damian Luszczymak
PDF
Testing Your Code as Part of an Industrial Grade Workflow
PPTX
Selenoid & Allure - how to make them work together?
PDF
Java fx smart code econ
PDF
Cocoa pods
PDF
2013 10-28 php ug presentation - ci using phing and hudson
PDF
Why Your Site is Slow: Performance Answers for Your Clients
PPTX
PhoneGap day 2016 EU: Simulating Cordova Plugins in the Browser
ODP
Building JBoss AS 7 for Fedora
Zalenium - Czyli lepszy Selenium Grid
Null July - OWTF - Bharadwaj Machiraju
Intro to JavaScript Tooling in Visual Studio Code
Selenoid + Allure - How to use these tools together?
How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016
End to-end testing from rookie to pro
Create, test, secure, repeat
Defcon - Veil-Pillage
Continuous Integration Testing in Django
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
OWASP OWTF - Summer Storm - OWASP AppSec EU 2013
Magento and Continuous Integration - Damian Luszczymak
Testing Your Code as Part of an Industrial Grade Workflow
Selenoid & Allure - how to make them work together?
Java fx smart code econ
Cocoa pods
2013 10-28 php ug presentation - ci using phing and hudson
Why Your Site is Slow: Performance Answers for Your Clients
PhoneGap day 2016 EU: Simulating Cordova Plugins in the Browser
Building JBoss AS 7 for Fedora
Ad

Viewers also liked (7)

PDF
CRaSH @ JUGSummerCamp 2012 - Quickie
PDF
CRaSH the shell for the Java Virtual Machine
PDF
eXoer on the grill: eXo Add-ons factory using Docker and Codenvy
PPT
eXo Platform 4.4 Released: Work Better with More Context!
PDF
When Collaboration Drives Your Digital Transformation
PDF
Introduce Bootstrap 3 to Develop Responsive Design Application
PDF
Modèles Business Open Source - Success story eXo
CRaSH @ JUGSummerCamp 2012 - Quickie
CRaSH the shell for the Java Virtual Machine
eXoer on the grill: eXo Add-ons factory using Docker and Codenvy
eXo Platform 4.4 Released: Work Better with More Context!
When Collaboration Drives Your Digital Transformation
Introduce Bootstrap 3 to Develop Responsive Design Application
Modèles Business Open Source - Success story eXo
Ad

Similar to Hands on iOS developments with Jenkins (20)

PDF
Hands on iOS developments with jenkins
PDF
PHP - Programming language war, does it matter
KEY
Using Jenkins with iOS projects
PPT
Enterprise PHP (PHP London Conference 2008)
PDF
When to use Serverless? When to use Kubernetes?
PDF
Integração contínua com Jenkins
PDF
O365Con19 - Things I've Learned While Building a Product on SharePoint Modern...
PDF
JUC Paris 2012 — Jenkins @ Nuxeo
PPT
Enterprise PHP (Zend UK Business Conference)
PPTX
What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...
PDF
JUC Europe 2015: Jenkins-Based Continuous Integration for Heterogeneous Hardw...
PPTX
NCDevCon 2017 - Cross Platform Mobile Apps
PPTX
Selenium Training in Chennai
PPTX
Solving the Automation Puzzle - how to select the right automation framework ...
PDF
JavaOne 2017 CON2902 - Java Code Inspection and Testing Power Tools
PDF
Vibe Coding_ Develop a web application using AI (1).pdf
PPTX
Build software like a bag of marbles, not a castle of LEGO®
PDF
Shifting landscape of mobile automation, and the future of Appium - Jonathan ...
PDF
JenkinsPy workshop
PDF
Developing modern java web applications with java ee 7 and angular js
Hands on iOS developments with jenkins
PHP - Programming language war, does it matter
Using Jenkins with iOS projects
Enterprise PHP (PHP London Conference 2008)
When to use Serverless? When to use Kubernetes?
Integração contínua com Jenkins
O365Con19 - Things I've Learned While Building a Product on SharePoint Modern...
JUC Paris 2012 — Jenkins @ Nuxeo
Enterprise PHP (Zend UK Business Conference)
What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...
JUC Europe 2015: Jenkins-Based Continuous Integration for Heterogeneous Hardw...
NCDevCon 2017 - Cross Platform Mobile Apps
Selenium Training in Chennai
Solving the Automation Puzzle - how to select the right automation framework ...
JavaOne 2017 CON2902 - Java Code Inspection and Testing Power Tools
Vibe Coding_ Develop a web application using AI (1).pdf
Build software like a bag of marbles, not a castle of LEGO®
Shifting landscape of mobile automation, and the future of Appium - Jonathan ...
JenkinsPy workshop
Developing modern java web applications with java ee 7 and angular js

More from eXo Platform (12)

PPTX
Workshop blockchain au service de l engagement - 20-3-2019
PDF
Digitalisation RH –Avec ou sans les DRH
PDF
De l'Intranet institutionnel à la Digital Workplace : la démarche du groupe d...
PPTX
L’Intranet, socle de l’entreprise digitale !
PPTX
Un hub collaboratif unique et intégré : les pour et les contre
PPTX
Intranet Project: Roll-out Strategy & Pain Points to consider
PDF
How we migrate 350+ Maven CI jobs to Pipeline as Code with Jenkins 2 and Docker
PPT
Peut-on décider un changement de culture d'entreprise?
PPTX
Conférence sur la Digital Workplace au Salon Intranet & Collaboratif
PPT
eXo Platform - Votre plateforme de travail collaboratif
PDF
Solutions to your employee disengagement
PPT
Performance testing and_reporting_with_j_meter by Le Van Nghi
Workshop blockchain au service de l engagement - 20-3-2019
Digitalisation RH –Avec ou sans les DRH
De l'Intranet institutionnel à la Digital Workplace : la démarche du groupe d...
L’Intranet, socle de l’entreprise digitale !
Un hub collaboratif unique et intégré : les pour et les contre
Intranet Project: Roll-out Strategy & Pain Points to consider
How we migrate 350+ Maven CI jobs to Pipeline as Code with Jenkins 2 and Docker
Peut-on décider un changement de culture d'entreprise?
Conférence sur la Digital Workplace au Salon Intranet & Collaboratif
eXo Platform - Votre plateforme de travail collaboratif
Solutions to your employee disengagement
Performance testing and_reporting_with_j_meter by Le Van Nghi

Recently uploaded (20)

PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
Cloud computing and distributed systems.
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPT
Teaching material agriculture food technology
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Big Data Technologies - Introduction.pptx
PDF
Electronic commerce courselecture one. Pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
20250228 LYD VKU AI Blended-Learning.pptx
The AUB Centre for AI in Media Proposal.docx
Cloud computing and distributed systems.
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Teaching material agriculture food technology
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Encapsulation_ Review paper, used for researhc scholars
Diabetes mellitus diagnosis method based random forest with bat algorithm
Review of recent advances in non-invasive hemoglobin estimation
NewMind AI Weekly Chronicles - August'25 Week I
Mobile App Security Testing_ A Comprehensive Guide.pdf
Machine learning based COVID-19 study performance prediction
Programs and apps: productivity, graphics, security and other tools
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Big Data Technologies - Introduction.pptx
Electronic commerce courselecture one. Pdf

Hands on iOS developments with Jenkins

  • 1. 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
  • 2. 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
  • 3. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Arnaud Héritier "   Jenkins –  Committer since 2010 –  Maven integration –  Xcode, Appaloosa plugins … "   Apache Maven –  Committer since 2004 and member of the Project Management Committee –  Coauthor of « Apache Maven » •  published by Pearson (in French) " eXo platform –  Software Factory Manager –  In charge of tools and methods "   Contact me –  http://aheritier.net –  Twitter : @aheritier –  Skype : aheritier 3http://goo.gl/XWGDy
  • 4. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Mathieu Hausherr "   iOS –  Developer since 2008 "   Other mobile platforms –  Android, Bada, Blackberry, Windows Phone 7... "   Octo Technology –  Mobile Expert –  Installation of software factories for customers "   Contact me –  Mail: mha@octo.com –  Twitter : @mhausherr 4http://goo.gl/XWGDy
  • 5. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Slide legend http://goo.gl/XWGDy 5 "   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
  • 6. 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 6http://goo.gl/XWGDy
  • 7. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf CONCEPTS Goals of Jenkins-CI on iOS 7http://goo.gl/XWGDy
  • 8. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Reminder: Apple application provisioning strategy Validity Limite of devices Apple validation Availability Ad Hoc 1 year 100 NO Everybody In House 1 year ∞ NO Only for companies App Store For life ∞ YES Everybody 8http://goo.gl/XWGDy
  • 9. 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 9http://goo.gl/XWGDy
  • 10. 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 10http://goo.gl/XWGDy
  • 11. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Continuous integration concepts Developer Developer Source code + tests Unit tests SenTesting Source code + tests1 1 2 3 Software Factory Building application Jenkins Code versionning Git Static analysis Clang 11http://goo.gl/XWGDy
  • 12. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Continuous deployment concepts Publish Building application Jenkins Private store Appaloosa Download Documentation generation Apple doc 1 2 4 Code versionning Git Push 5 6 User devices Software Factory Archive4 Archive Public store App Store Submit 5 6 Download 12http://goo.gl/XWGDy
  • 13. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Appaloosa concept 13http://goo.gl/XWGDy
  • 14. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Getting your device UDID We need your device UDID to be able to push apps to your device 1.  Download “UDID sender” on the App Store 2.  Send UDID via E-Mail to mha@octo.com http://goo.gl/XWGDy 14
  • 15. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf HOW TO Step by step guide for Jenkins-CI on iOS 15http://goo.gl/XWGDy
  • 16. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Plugins installation Ø  Home Ø  Manage Jenkins Ø  Manage Plugins Ø  Install these plugins •  Appaloosa •  Clang Scan-Build •  Git •  Xcode 16http://goo.gl/XWGDy
  • 17. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Plugins 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. 17http://goo.gl/XWGDy
  • 18. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf What if I soon have a Jenkins on a non Mac server? •  Why use a non Mac Jenkins? –  Regroup all your jobs –  Maintain only one instance of Jenkins –  Create dependencies between mobile and not mobile projects •  How use a non Mac Jenkins? –  Create Mac OS node –  Only need a SSH connection http://goo.gl/XWGDy 18 Master Node Scheduling build Jenkins Code versionning Git MacOS Node Building application XCode
  • 19. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Node 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 19http://goo.gl/XWGDy
  • 20. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Affect job to a node •  Create a “MacOSX” label •  Force job to run on “MacOSX”-labeled nodes 20http://goo.gl/XWGDy
  • 21. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Xcode bug for iOS unit testing Source: http:// www.raingrove.com/ 2012/03/28/running-ocunit-and- specta-tests-from-command- line.html •  Edit your RunPlatformUnitTests sudo vim `xcode-select -print-path`/ Platforms/iPhoneSimulator.platform/ Developer/Tools/RunPlatformUnitTests Replace Warning ${LINENO} "Skipping tests; the iPhoneSimulator platform does not currently support application-hosted tests (TEST_HOST set)." By: export CFFIXED_USER_HOME="$ {BUILT_PRODUCTS_DIR}/UserHome/" 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}" 21http://goo.gl/XWGDy
  • 22. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Configure your project for Unit Tests •  Check run action for your Test target •  Share your Scheme 22http://goo.gl/XWGDy
  • 23. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Add Xcode unit testing build 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 23http://goo.gl/XWGDy
  • 24. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Write a test -  (void)test_parseRoomsFromDictionary_! returnObjectsArrayForCorrectDictionnary! {! // Given! NSDictionary *dictionnary = [NSDictionary dictionaryWithObject: [NSArray array] forKey:KEY_ROOMS];! ! // When! NSArray* rooms = [JUCEventsService parseRoomsFromDictionary:dictionnary];! ! // Then! STAssertTrue([rooms isKindOfClass: [NSArray class]],nil);! } •  Use SenTestKit Framework •  Add Mock With OCMock 24http://goo.gl/XWGDy
  • 25. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Add clang static analysis build phase •  Configure your target 25http://goo.gl/XWGDy
  • 26. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Appaloosa jenkins’ integration •  Check IPA generation •  Add Appaloosa step to your project •  Receive Push Notification Token: igjrz4w701ynrkzd2zwh2u450ilg00dg 26http://goo.gl/XWGDy
  • 27. 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 27http://goo.gl/XWGDy
  • 28. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Generate Apple Doc •  Install Apple Doc https://github.com/tomaz/ appledoc •  Command line appledoc conf.plist <outfile> •  Add an “aggregate” target to the project Perform automatic doc generation locally 28http://goo.gl/XWGDy
  • 29. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf HANDS ON … LET’S GO Jenkins set-up, from GitHub to your device 29http://goo.gl/XWGDy
  • 30. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Fork on github the sample project http://goo.gl/alKgW And then clone your fork git clone git:// github.com/XXXX/ JenkinsSample.git 30http://goo.gl/XWGDy
  • 31. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Setup a continuous integration job Setup Git http://goo.gl/XWGDy 31
  • 32. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Setup a continuous integration job Add a Clang Scan-Build Phase http://goo.gl/XWGDy 32
  • 33. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Setup a continuous integration job Add an Xcode build step to execute tests •  Use a schema (JUC Paris) •  SDK = iphonesimulator •  Config = Debug •  Args = TEST_AFTER_BUILD=YES •  Clean test reports http://goo.gl/XWGDy 33
  • 34. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Setup a continuous integration job Activate Clang and unit tests reports http://goo.gl/XWGDy 34
  • 35. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Fix the test In JUC ParisTests/JUC_ParisTests.m Comment the failling test Commit and push on github git add . git commit git push Relaunch your build http://goo.gl/XWGDy 35
  • 36. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Change your Bundle Id In Project Properties > JUC Paris Target > Summary Change Bundle identifier to com.jenkins.juc- paris.app.yourname Commit and push on github git add . git commit git push http://goo.gl/XWGDy 36
  • 37. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Add a deployment Job Same github settings Create an Xcode build step •  Target = JUC Paris •  Config = Release •  Setup versions •  Build IPA •  Embedded profile http://goo.gl/XWGDy 37
  • 38. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Appaloosa installation on your device http://goo.gl/hQ2Ue http://goo.gl/XWGDy 38
  • 39. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Appaloosa installation on your device Account information •  Login: mha+juc@octo.com •  Password: jenkins  http://goo.gl/XWGDy 39
  • 40. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Add a deployment Job Setup Appaloosa with this token : igjrz4w701ynrkzd2zwh2u450ilg00dg http://goo.gl/XWGDy 40
  • 41. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Enjoy 41http://goo.gl/XWGDy
  • 42. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Thank You To Our Sponsors Platinum Sponsor Silver Sponsor Gold Sponsor 42http://goo.gl/XWGDy