The Journey Towards 
Continuous Integration 
Sebastian Marek (@proofek)
One Morning Long Ago
At the Foot of Mount Doom 
▪ Increased maintenance 
time 
▪ growing problem numbers 
▪ code harder to understand 
and follow 
▪ complex and time 
consuming testing
Looking for help!
First frustrations 
▪ ad hoc builds 
▪ mixture of php3 and php4 and php5 
▪ learn as you go 
▪ no standards
Forming up the fellowship
Calling the coucil 
Who? 
▪ managers 
▪ developers 
! 
What? 
▪ threats 
▪ opportunities 
▪ planning 
▪ implementation 
http://www.flickr.com/photos/pedromourapinheiro/3272323691/in/photostream/
It’s always about the money 
▪ Design debt 
▪ Late fees 
▪ Interests 
http://www.flickr.com/photos/your_teacher/1040476355/in/photostream/
Finding the best way 
VS.
Support and roadmap 
http://www.flickr.com/photos/jannem/3312115991/in/photostream/
Metrics and reports 
http://www.flickr.com/photos/aussiegall/286709039/in/photostream/
Joining more powerful allies
Automation 
http://www.flickr.com/photos/matthileo/3552898254/in/photostream/
East front
phpUnderControl
Automated builds 
▪ Cruisecontrol addon 
▪ PHPUnit integration 
▪ phpDocumentor 
integration 
▪ code metrics generation 
▪ code coverage reports 
▪ checkstyle report 
integration 
▪ PHP Depend integration 
▪ PHPMD support 
▪ and many more
PHPUnit 
Industry recognised xUnit testing framework for PHP, 
supporting: 
▪ mock objects 
▪ database testing 
▪ code coverage analysis 
▪ continuous integration platforms, like CruiseControl, 
Jenkins, Bamboo
phpDocumentor 
▪ automated documentation 
for PHP generated from 
code 
▪ supports different formats 
and templates: HTML, 
PDF, XML 
▪ easily configurable
PHP_Codesniffer 
▪ Based on defined coding standards 
▪ Detects coding standards violations 
▪ Extendable and configurable 
▪ Codebrowser
Code coverage report 
▪ Be always on top of your tests 
▪ Code coverage ratio 
▪ Configurable thresholds 
▪ XML and HTML format
Software metrics - PHP Depend 
Code measures: 
▪ Cyclomatic Complexity 
▪ NPath Complexity 
▪ CodeRank 
▪ Lines Of Code
PHP Mess Detector 
Intelligent code analyser: 
▪ Possible bugs 
▪ Suboptimal code 
▪ Overcomplicated 
expressions 
▪ Unused parameters, 
methods, properties
Buildbox maintenance 
▪ New modules added 
▪ Increased build time 
▪ Often crashes 
▪ Stability problems 
▪ Hardware issues
Upgrades needed
Jenkins
Jenkins – next generation 
▪ easy installation 
▪ easy configuration 
▪ plugin support 
▪ distributed builds 
▪ multi-language support 
▪ dependency tracking
One ring to rule them all 
http://www.flickr.com/photos/cosmic_bandita/2218419160/in/photostream/
Business wide visibilty 
▪ Meaningful reports 
▪ Responsibility and ownership 
▪ KPI 
▪ Goals
West front
SonarQube 
▪ quality management 
platform 
▪ continuous analysis 
▪ easily extendable and 
configurable
SonarQube
Radiator view
Reports
Reports
Reports
Reports
The army needs to follow the leader 
▪ Lead by example 
▪ firm, but friendly and helpful 
▪ never forget about training 
▪ clear and simple rules 
▪ praise vs. punishment
You broke the build!
Where's the build?
Works on my machine?!
Implementing CI culture 
http://www.infoq.com/articles/Continuous-Delivery-Maturity-Model
Implementing CI culture 
▪ Implementing a development model supporting CI 
▪ Scaling the build 
▪ One way to build 
▪ Build artefacts 
▪ Build updates in JIRA 
▪ Code reviews
Time 
Gitflow 
release 
develop branches hotfixes master 
feature 
branches 
Feature 
for 
future 
Tag 
1.0 
Major 
feature for 
next release 
From this point 
on, “next release” 
means the release 
after 1.0 
Severe bug 
fixed for 
production: 
hotfix 0.2 
Bugfixes 
from rel. 
branch may 
be 
continuously 
merged back 
Tag 
0.1 
Tag 
0.2 
Incorporate 
bugfix in 
develop 
Start of 
release 
branch for 
1.0 
Only 
bugfixes! 
Author: Vincent Driessen 
Original blog post: http://nvie.com/ 
archives/323
Scaling the build
From polling to pushing 
▪ git polling ineffective 
▪ git hooks supporting build automation 
▪ Jenkins Build Per Branch 
▪ self maintainable 
▪ create jobs for newly created branches
Maven 
▪ build automation 
▪ controlling dependencies
Build artefacts 
Composer & Satis
Code reviews
Better communication and monitoring 
▪ build updates in JIRA 
▪ wall boards 
▪ weekly quality metrics
Functional testing 
▪ Automated web apps 
testing 
▪ Regression testing 
▪ Headless builds
It’s your time now
Quick guide 
1. Investigate 
2. Trial 
3. Form a team 
4. Small steps 
5. Be visible 
6. Automate
Resources 
▪ PHPUnit - http://www.phpunit.de/ 
▪ Jenkins - http://jenkins-ci.org/ 
▪ SonarQube - http://www.sonarqube.org/ 
▪ phpDocumentor - http://www.phpdoc.org/ 
▪ PHP_CodeSniffer - http://pear.php.net/package/ 
PHP_CodeSniffer/ 
▪ PHP Depend - http://pdepend.org/ 
▪ PHP Mess Detector - http://phpmd.org/ 
▪ Selenium - http://seleniumhq.org/ 
▪ xDebug - http://www.xdebug.org/ 
▪ http://www.infoq.com/articles/Continuous-Delivery-Maturity- 
Model 
▪ http://entagen.github.io/jenkins-build-per-branch/
CodeClub - https://www.codeclub.org.uk 
+ + + 
Volunteer Code Club Projects Venue Children 
A nationwide network of volunteer-led after school 
coding clubs for children aged 9-11
Sebastian Marek 
@proofek 
Thank you 
http://joind.in/11823

The Journey Towards Continuous Integration

  • 1.
    The Journey Towards Continuous Integration Sebastian Marek (@proofek)
  • 2.
  • 3.
    At the Footof Mount Doom ▪ Increased maintenance time ▪ growing problem numbers ▪ code harder to understand and follow ▪ complex and time consuming testing
  • 4.
  • 5.
    First frustrations ▪ad hoc builds ▪ mixture of php3 and php4 and php5 ▪ learn as you go ▪ no standards
  • 6.
    Forming up thefellowship
  • 7.
    Calling the coucil Who? ▪ managers ▪ developers ! What? ▪ threats ▪ opportunities ▪ planning ▪ implementation http://www.flickr.com/photos/pedromourapinheiro/3272323691/in/photostream/
  • 8.
    It’s always aboutthe money ▪ Design debt ▪ Late fees ▪ Interests http://www.flickr.com/photos/your_teacher/1040476355/in/photostream/
  • 9.
  • 10.
    Support and roadmap http://www.flickr.com/photos/jannem/3312115991/in/photostream/
  • 11.
    Metrics and reports http://www.flickr.com/photos/aussiegall/286709039/in/photostream/
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
    Automated builds ▪Cruisecontrol addon ▪ PHPUnit integration ▪ phpDocumentor integration ▪ code metrics generation ▪ code coverage reports ▪ checkstyle report integration ▪ PHP Depend integration ▪ PHPMD support ▪ and many more
  • 17.
    PHPUnit Industry recognisedxUnit testing framework for PHP, supporting: ▪ mock objects ▪ database testing ▪ code coverage analysis ▪ continuous integration platforms, like CruiseControl, Jenkins, Bamboo
  • 18.
    phpDocumentor ▪ automateddocumentation for PHP generated from code ▪ supports different formats and templates: HTML, PDF, XML ▪ easily configurable
  • 19.
    PHP_Codesniffer ▪ Basedon defined coding standards ▪ Detects coding standards violations ▪ Extendable and configurable ▪ Codebrowser
  • 20.
    Code coverage report ▪ Be always on top of your tests ▪ Code coverage ratio ▪ Configurable thresholds ▪ XML and HTML format
  • 21.
    Software metrics -PHP Depend Code measures: ▪ Cyclomatic Complexity ▪ NPath Complexity ▪ CodeRank ▪ Lines Of Code
  • 22.
    PHP Mess Detector Intelligent code analyser: ▪ Possible bugs ▪ Suboptimal code ▪ Overcomplicated expressions ▪ Unused parameters, methods, properties
  • 23.
    Buildbox maintenance ▪New modules added ▪ Increased build time ▪ Often crashes ▪ Stability problems ▪ Hardware issues
  • 24.
  • 25.
  • 26.
    Jenkins – nextgeneration ▪ easy installation ▪ easy configuration ▪ plugin support ▪ distributed builds ▪ multi-language support ▪ dependency tracking
  • 27.
    One ring torule them all http://www.flickr.com/photos/cosmic_bandita/2218419160/in/photostream/
  • 28.
    Business wide visibilty ▪ Meaningful reports ▪ Responsibility and ownership ▪ KPI ▪ Goals
  • 29.
  • 30.
    SonarQube ▪ qualitymanagement platform ▪ continuous analysis ▪ easily extendable and configurable
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
    The army needsto follow the leader ▪ Lead by example ▪ firm, but friendly and helpful ▪ never forget about training ▪ clear and simple rules ▪ praise vs. punishment
  • 38.
  • 39.
  • 40.
    Works on mymachine?!
  • 41.
    Implementing CI culture http://www.infoq.com/articles/Continuous-Delivery-Maturity-Model
  • 42.
    Implementing CI culture ▪ Implementing a development model supporting CI ▪ Scaling the build ▪ One way to build ▪ Build artefacts ▪ Build updates in JIRA ▪ Code reviews
  • 43.
    Time Gitflow release develop branches hotfixes master feature branches Feature for future Tag 1.0 Major feature for next release From this point on, “next release” means the release after 1.0 Severe bug fixed for production: hotfix 0.2 Bugfixes from rel. branch may be continuously merged back Tag 0.1 Tag 0.2 Incorporate bugfix in develop Start of release branch for 1.0 Only bugfixes! Author: Vincent Driessen Original blog post: http://nvie.com/ archives/323
  • 44.
  • 45.
    From polling topushing ▪ git polling ineffective ▪ git hooks supporting build automation ▪ Jenkins Build Per Branch ▪ self maintainable ▪ create jobs for newly created branches
  • 46.
    Maven ▪ buildautomation ▪ controlling dependencies
  • 47.
  • 48.
  • 49.
    Better communication andmonitoring ▪ build updates in JIRA ▪ wall boards ▪ weekly quality metrics
  • 50.
    Functional testing ▪Automated web apps testing ▪ Regression testing ▪ Headless builds
  • 51.
  • 52.
    Quick guide 1.Investigate 2. Trial 3. Form a team 4. Small steps 5. Be visible 6. Automate
  • 53.
    Resources ▪ PHPUnit- http://www.phpunit.de/ ▪ Jenkins - http://jenkins-ci.org/ ▪ SonarQube - http://www.sonarqube.org/ ▪ phpDocumentor - http://www.phpdoc.org/ ▪ PHP_CodeSniffer - http://pear.php.net/package/ PHP_CodeSniffer/ ▪ PHP Depend - http://pdepend.org/ ▪ PHP Mess Detector - http://phpmd.org/ ▪ Selenium - http://seleniumhq.org/ ▪ xDebug - http://www.xdebug.org/ ▪ http://www.infoq.com/articles/Continuous-Delivery-Maturity- Model ▪ http://entagen.github.io/jenkins-build-per-branch/
  • 54.
    CodeClub - https://www.codeclub.org.uk + + + Volunteer Code Club Projects Venue Children A nationwide network of volunteer-led after school coding clubs for children aged 9-11
  • 55.
    Sebastian Marek @proofek Thank you http://joind.in/11823