SlideShare a Scribd company logo
1 of 30
Intégration Continue Avec Jenkins Eric Hogue
Qu'est ce que l'intégration Continue?
Installer ant et Jenkins sudo apt-get install default-jdk ant Suivre les instructions sur le site de jenkins Installer les plugins ,[object Object],[object Object],[object Object]
 
Les outils
PHPUnit
Installation sudo apt-get install php5-xdebug php-pear sudo pear upgrade pear sudo pear channel-discover pear.phpunit.de sudo pear channel-discover components.ez.no sudo pear channel-discover pear.symfony-project.com sudo pear install phpunit/PHPUnit
phpunit.xml ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
build.xml ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Plugin xUnit ,[object Object]
Plugin Clover PHP ,[object Object]
Plugin Clover PHP
PHP Code Sniffer
sudo pear install PHP_CodeSniffer Installation:  build.xml <target name=&quot;phpcs&quot;> <exec executable=&quot;phpcs&quot;> <arg line=&quot;--report=checkstyle --report-file=${output}/phpcs/checkstyle.xml --standard=Zend ${basedir}&quot; /> </exec> </target>
Plugin Checkstyle
 
PHP Depend
sudo pear channel-discover pear.pdepend.org sudo pear install pdepend/PHP_Depend-beta Installation:  build.xml      <target name=&quot;pdepend&quot;>          <exec executable=&quot;pdepend&quot;>              <arg line=&quot;                  --jdepend-xml=${output}/pdepend/jdepend.xml --jdepend-chart=${output}/pdepend/dependencies.svg                  --overview-pyramid=${output}/pdepend/overview-pyramid.svg --ignore=Tests/ .      &quot; />          </exec>      </target>
Plugin JDepend
 
PHP Mess Detector
sudo pear channel-discover pear.phpmd.org sudo pear channel-discover pear.pdepend.org sudo pear install --alldeps phpmd/PHP_PMD Installation:  build.xml <target name=&quot;phpmd&quot;>      <exec executable=&quot;phpmd&quot;> <arg line=&quot;. xml               codesize,unusedcode,naming,design               --reportfile ${output}/phpmd/messdetector.xml               --exclude Tests/&quot;           />      </exec> </target>
Plugin PMD
PHP Copy/Paste Detector
sudo pear channel-discover pear.phpunit.de sudo pear channel-discover components.ez.no sudo pear install phpunit/phpcpd Installation:  build.xml <target name=&quot;phpcpd&quot; depends=&quot;prepare&quot;>      <exec executable=&quot;phpcpd&quot;>          <arg line=&quot; --log-pmd ${output}/phpcpd/phpcpd.xml               --min-tokens 30 .&quot; />      </exec> </target>
Plugin DRY
Template for Jenkins Jobs for PHP Projects By Sebastian Bergmann
http://jenkins-php.org/ ,[object Object],[object Object],[object Object],[object Object],[object Object]
Autres possibilités ,[object Object],[object Object],[object Object],[object Object]
Questions? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Contact:

More Related Content

More from Eric Hogue

More from Eric Hogue (7)

Guarding Your Code Against Bugs with Continuous Testing
Guarding Your Code Against Bugs with Continuous TestingGuarding Your Code Against Bugs with Continuous Testing
Guarding Your Code Against Bugs with Continuous Testing
 
Continuous testing In PHP
Continuous testing In PHPContinuous testing In PHP
Continuous testing In PHP
 
La sécurité des communications avec GPG
La sécurité des communications avec GPGLa sécurité des communications avec GPG
La sécurité des communications avec GPG
 
Getting started with TDD - Confoo 2014
Getting started with TDD - Confoo 2014Getting started with TDD - Confoo 2014
Getting started with TDD - Confoo 2014
 
Continuous Testing
Continuous TestingContinuous Testing
Continuous Testing
 
Commencer avec le tdd
Commencer avec le tddCommencer avec le tdd
Commencer avec le tdd
 
Introduction to ci with jenkins
Introduction to ci with jenkinsIntroduction to ci with jenkins
Introduction to ci with jenkins
 

Integration continue

  • 1. Intégration Continue Avec Jenkins Eric Hogue
  • 2. Qu'est ce que l'intégration Continue?
  • 3.
  • 4.  
  • 7. Installation sudo apt-get install php5-xdebug php-pear sudo pear upgrade pear sudo pear channel-discover pear.phpunit.de sudo pear channel-discover components.ez.no sudo pear channel-discover pear.symfony-project.com sudo pear install phpunit/PHPUnit
  • 8.
  • 9.
  • 10.
  • 11.
  • 14. sudo pear install PHP_CodeSniffer Installation:  build.xml <target name=&quot;phpcs&quot;> <exec executable=&quot;phpcs&quot;> <arg line=&quot;--report=checkstyle --report-file=${output}/phpcs/checkstyle.xml --standard=Zend ${basedir}&quot; /> </exec> </target>
  • 16.  
  • 18. sudo pear channel-discover pear.pdepend.org sudo pear install pdepend/PHP_Depend-beta Installation:  build.xml      <target name=&quot;pdepend&quot;>          <exec executable=&quot;pdepend&quot;>              <arg line=&quot;                  --jdepend-xml=${output}/pdepend/jdepend.xml --jdepend-chart=${output}/pdepend/dependencies.svg                  --overview-pyramid=${output}/pdepend/overview-pyramid.svg --ignore=Tests/ .      &quot; />          </exec>      </target>
  • 20.  
  • 22. sudo pear channel-discover pear.phpmd.org sudo pear channel-discover pear.pdepend.org sudo pear install --alldeps phpmd/PHP_PMD Installation:  build.xml <target name=&quot;phpmd&quot;>      <exec executable=&quot;phpmd&quot;> <arg line=&quot;. xml               codesize,unusedcode,naming,design               --reportfile ${output}/phpmd/messdetector.xml               --exclude Tests/&quot;           />      </exec> </target>
  • 25. sudo pear channel-discover pear.phpunit.de sudo pear channel-discover components.ez.no sudo pear install phpunit/phpcpd Installation:  build.xml <target name=&quot;phpcpd&quot; depends=&quot;prepare&quot;>      <exec executable=&quot;phpcpd&quot;>          <arg line=&quot; --log-pmd ${output}/phpcpd/phpcpd.xml               --min-tokens 30 .&quot; />      </exec> </target>
  • 27. Template for Jenkins Jobs for PHP Projects By Sebastian Bergmann
  • 28.
  • 29.
  • 30.

Editor's Notes

  1. Qui suis-je?  - Développe depuis 2001 - Delphi, C++, C#, perl, PHP Mon histoire: - 8 ans dans la même cie - Code vieux de 6 ans - Changements ont des effets imprévisibles - Se croise les doigts avants de déployer - autre cie, code sniffer, mais jamais exécuté
  2. Définition: - Intégration fréquente     - Plus facile - Vérification automatique - Détecte les problèmes rapidement - Transparence
  3. Sun jdk? Ubuntu/Debian -&gt; apt-get RedHat/Fedora -&gt; yum Windows -&gt; setup.exe Mac -&gt; .pkg
  4. - Configurer Git (svn, mercurial...) - Branche -&gt; blank pour toutes - Poll SCM Every Minute - Configurer ant (maven, shell script, windows batch) - Notification, toujours au lead, plus celui qui brise le build
  5. Analyse dynamique Analyse Statique
  6. Analysise Dynamique Le plus important Tests unitaires Couverture de code avec Xdebug
  7. pear config-set auto_discover 1
  8. default basedir output build -&gt; depends  Ajouter tous les outils ici prepare/clean
  9. Couverture par ligne
  10. Nombre = tests qui couvre ligne
  11. Standarts Document que persone ne lit
  12. Fichier xml avec un standard
  13. Projet existant -&gt; Check only new errors Click sur un fichier ammene a l&apos;erreur
  14. Outil d&apos;analyse statique Permet de détecter des problemes potentiels Complexité Noms Longueur
  15. Ca - Afferent Couplings: The number of other packages that depend on this Ce - Efferent Couplings: The number of other packages that classes from this package depend upon Instability: Ratio of coupling (Ce / (Ce + Ca)) Abstraction: Ratio of abstract and concrete classes   (ac / (ac + cc)) D =&gt; Distance V=&gt; Volatility Héritage ANDC -&gt; The  Average Number of Derived Classes AHH -&gt; Average Hierarchy Height   Taille et complexité Cyclomatic Complexity Coupling Fanout -&gt; types référencé Calls -&gt; method calls Abstraction Instability Chart Abstract -&gt; many depends on it -&gt; keep stable Concrete -&gt; many dependencies -&gt; unstable
  16. Types:  Code Size - Cyclomatic complexity - Méthode/classe trop longue - Trop de parametres Design - exit - eval - goto - coupling Naming - Nom variable/méthode court/long - Constructor name has class &lt;&gt; __construct Unsused code
  17. Changer  --min-tokens     def: 70 --min-lines         def: 5
  18. Don&apos;t Repeat Yourself
  19. Montrer Jenkins
  20. Plugins installer command line
  21. Avec CI on peut maintenant avoir confiance en nos changements