ios - continuous integration · > brew install caskroom/cask/oclint > brew install sloccount...
TRANSCRIPT
Mr. Jenkins
Gerd Bernhardt
iOS - Continuous Integration
A Freelancer’s Experience
Installation and Configuration Useful Plugins Software-Metrics Mobile Development Process Integration
Overview
• Installation
• Plugins
• Jobs
• Process Integration
• Alternatives
Installation
Physical Machines / Cloud
8.27.3
Virtual Machines
8.2
• Support Different Versions
• Support Different Clients / Apple-IDs
• Scalable
• Manageable & Stable
• Fast Enough
• Backup Jenkins Home
3https://jenkins.io/doc/book/hardware-recommendations/
Installation> brew install jenkins > brew services start jenkins
• Homebrew Installation cp instead of ln -svf /usr/local/opt/jenkins/*.plist ~/Library/LaunchAgents
• Own Local User Account
• Setup SSHssh-keygen
4
✓ http://localhost:8080
Installation - Launch Agent
• Enable Automatic Login
• Lock Screen Automatically
• LoginHook Launch Agent
5
Installation - Accounts• Own Apple-ID / SCM Account
• Apple Distribution Certificate + Agent’s Private Key
• SCM SSH Access
• 2FA + Fastlane Apple Account: Enable App Specific Password
Manage Jenkins -> Configure System
6
Installation - Xcode• Enable Code Coverage
• Share Workspace Scheme
Xcode Edit Schemes Xcode Manage Schemes
Plugin Visualisation
8
1. Build Monitor View
3. Description Setter2. Build-Name-Setter 4. Build Failure Analyzergit rev-parse --short HEAD git reflog show —all` git rev-list HEAD | wc -l | tr -d ' '
Feature Name Number of Tests
RegEx based learning
Plugin Metrics
9
• SLOCCount Plugin
• DRY Plug-in (CPD)
• PMD Plugin (obj-c) Swift: https://github.com/yopeso/Taylor
• Static Analysis Collector Plugin
• Cobertura Plugin
Intallation: Manage Jenkins -> Manage Plugins
Plugin Metrics• SLOCcount
• CPD
• PMD > brew install Caskroom/cask/oclint
> brew install sloccount
> brew install pmd
Alternatively to Fastlane use : xcodebuild + oclint-xcodebuild
10
Generate compile_commands.json
> oclint-json-compilation-database \ -e Pods \ -- -report-type=pmd -o=lint.xml
Xcode - Coverage
• Install Slather
• Configure
• Run
11
> slather coverage
> brew install slather
More Plugins
• Locks and Latches Plugin or via script e.g.:
• Job Configuration History PluginAlternatively use SCM, backup ~/.jenkins/jobs
• Post-build Actions Plugin
12
Job Setup
• SCM / Build Trigger
• Setup Build Steps
• Post Actions
Process Integration
• Development (Build + Test) frequently / periodically
• Pull Request Builds (Build + Test + Ship private) device test, look and feel
• PO / QA Builds (Build + Ship internal) nightly, takes longer
• Quality Builds (Build + Test + Analyze) nightly, takes longer
• Release Builds (Build + Test + Ship public)
Jenkins CLI
• Executes Commands e.g. restart / build
• Add SSH KeyJenkins / People / Configure
• Run Commands> java -jar jenkins-cli.jar -s http://localhost:8080/ build CocoaHeadsiOS9
> curl -X POST -u <user>:<token> http://localhost:8080/job/<JobName>/build
or use curl like:
Alternatives
https://www.jetbrains.com/teamcity/
Hosted Platforms