SlideShare a Scribd company logo
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 Git Plugin Github Plugin Green Balls
 
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 <phpunit bootstrap=&quot;Tests/bootstrap.php&quot;>      <testsuites>          <testsuite name=&quot;Demo&quot;>              <directory>.</directory> </testsuite>      </testsuites>      <logging>          <log type=&quot;coverage-html&quot;               target=&quot;build/phpunit/html&quot; title=&quot;CIDemo&quot;              charset=&quot;UTF-8&quot; yui=&quot;true&quot; highlight=&quot;true&quot;              lowUpperBound=&quot;35&quot; highLowerBound=&quot;70&quot; />          <log type=&quot;coverage-clover&quot; target=&quot;build/phpunit/clover.xml&quot;/>          <log type=&quot;junit&quot; target=&quot;build/phpunit/junit.xml&quot;               logIncompleteSkipped=&quot;false&quot; />      </logging> </phpunit>
build.xml <project name=&quot;CIDemo&quot; default=&quot;build&quot; basedir=&quot;.&quot;>      <property name=&quot;output&quot; location=&quot;${basedir}/build/&quot; />      <target name=&quot;build&quot; depends=&quot;prepare,phpunit&quot;>      </target>      <target name=&quot;prepare&quot; depends=&quot;clean&quot;>          <mkdir dir=&quot;${output}&quot; />      </target>      <target name=&quot;clean&quot;>          <delete dir=&quot;${output}&quot; />      </target>      <target name=&quot;phpunit&quot;>          <exec executable=&quot;phpunit&quot; failonerror=&quot;true&quot; />      </target> </project>
Plugin xUnit Résultats des tests unitaires
Plugin Clover PHP Rapports sur la couverture des tests
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/ Tout ce qu'il faut pour un projet PHP   Les plugins nécessaires   Un fichier build.xml   Un template pour Jenkins   PHP Project Wizard (PPW)
Autres possibilités Phing/Rake Autres tests (Selenium, Behat) Déployement  automatique/continue   ...
Questions? GitHub: https://github.com/EricHogue/ SlideShare: http://www.slideshare.net/EricHogue Blog: http://erichogue.ca/ Twitter: @ehogue Email: phpquebec@erichogue.ca LinkedIn http://ca.linkedin.com/in/ehogue Contact:

More Related Content

PPTX
Continuous Integration for Salesforce1 Platform
PPTX
Developing NuGet
PDF
JCertif 2012 : Integration continue avec Jenkins
PDF
Au secours, mon application est brisée - Ou comment déboguer
PDF
Introduction à l'intégration continue en PHP
PDF
Commencer avec le TDD
PDF
Introduction à l’intégration continue avec Jenkins
PDF
Introduction to Continuous Integration with Jenkins
Continuous Integration for Salesforce1 Platform
Developing NuGet
JCertif 2012 : Integration continue avec Jenkins
Au secours, mon application est brisée - Ou comment déboguer
Introduction à l'intégration continue en PHP
Commencer avec le TDD
Introduction à l’intégration continue avec Jenkins
Introduction to Continuous Integration with Jenkins

More from Eric Hogue (7)

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

Integration continue

  • 1. Intégration Continue Avec Jenkins Eric Hogue
  • 2. Qu'est ce que l'intégration Continue?
  • 3. Installer ant et Jenkins sudo apt-get install default-jdk ant Suivre les instructions sur le site de jenkins Installer les plugins Git Plugin Github Plugin Green Balls
  • 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. phpunit.xml <phpunit bootstrap=&quot;Tests/bootstrap.php&quot;>      <testsuites>          <testsuite name=&quot;Demo&quot;>              <directory>.</directory> </testsuite>      </testsuites>      <logging>          <log type=&quot;coverage-html&quot;               target=&quot;build/phpunit/html&quot; title=&quot;CIDemo&quot;              charset=&quot;UTF-8&quot; yui=&quot;true&quot; highlight=&quot;true&quot;              lowUpperBound=&quot;35&quot; highLowerBound=&quot;70&quot; />          <log type=&quot;coverage-clover&quot; target=&quot;build/phpunit/clover.xml&quot;/>          <log type=&quot;junit&quot; target=&quot;build/phpunit/junit.xml&quot;               logIncompleteSkipped=&quot;false&quot; />      </logging> </phpunit>
  • 9. build.xml <project name=&quot;CIDemo&quot; default=&quot;build&quot; basedir=&quot;.&quot;>      <property name=&quot;output&quot; location=&quot;${basedir}/build/&quot; />      <target name=&quot;build&quot; depends=&quot;prepare,phpunit&quot;>      </target>      <target name=&quot;prepare&quot; depends=&quot;clean&quot;>          <mkdir dir=&quot;${output}&quot; />      </target>      <target name=&quot;clean&quot;>          <delete dir=&quot;${output}&quot; />      </target>      <target name=&quot;phpunit&quot;>          <exec executable=&quot;phpunit&quot; failonerror=&quot;true&quot; />      </target> </project>
  • 10. Plugin xUnit Résultats des tests unitaires
  • 11. Plugin Clover PHP Rapports sur la couverture des tests
  • 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. http://jenkins-php.org/ Tout ce qu'il faut pour un projet PHP   Les plugins nécessaires   Un fichier build.xml   Un template pour Jenkins   PHP Project Wizard (PPW)
  • 29. Autres possibilités Phing/Rake Autres tests (Selenium, Behat) Déployement  automatique/continue   ...
  • 30. Questions? GitHub: https://github.com/EricHogue/ SlideShare: http://www.slideshare.net/EricHogue Blog: http://erichogue.ca/ Twitter: @ehogue Email: phpquebec@erichogue.ca LinkedIn http://ca.linkedin.com/in/ehogue Contact:

Editor's Notes

  • #2: 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é
  • #3: Définition: - Intégration fréquente     - Plus facile - Vérification automatique - Détecte les problèmes rapidement - Transparence
  • #4: Sun jdk? Ubuntu/Debian -&gt; apt-get RedHat/Fedora -&gt; yum Windows -&gt; setup.exe Mac -&gt; .pkg
  • #5: - 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
  • #6: Analyse dynamique Analyse Statique
  • #7: Analysise Dynamique Le plus important Tests unitaires Couverture de code avec Xdebug
  • #8: pear config-set auto_discover 1
  • #10: default basedir output build -&gt; depends  Ajouter tous les outils ici prepare/clean
  • #12: Couverture par ligne
  • #13: Nombre = tests qui couvre ligne
  • #14: Standarts Document que persone ne lit
  • #15: Fichier xml avec un standard
  • #16: Projet existant -&gt; Check only new errors Click sur un fichier ammene a l&apos;erreur
  • #18: Outil d&apos;analyse statique Permet de détecter des problemes potentiels Complexité Noms Longueur
  • #21: 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
  • #23: 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
  • #26: Changer  --min-tokens     def: 70 --min-lines         def: 5
  • #27: Don&apos;t Repeat Yourself
  • #28: Montrer Jenkins
  • #29: Plugins installer command line
  • #31: Avec CI on peut maintenant avoir confiance en nos changements