Integration continue

30
Intégration Continue Avec Jenkins Eric Hogue

Transcript of Integration continue

Intégration ContinueAvec Jenkins

Eric Hogue

Qu'est ce que l'intégration Continue?

Installer ant et Jenkinssudo 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-pearsudo pear upgrade pearsudo pear channel-discover pear.phpunit.desudo pear channel-discover components.ez.nosudo pear channel-discover pear.symfony-project.comsudo pear install phpunit/PHPUnit

phpunit.xml<phpunit bootstrap="Tests/bootstrap.php"> <testsuites> <testsuite name="Demo"> <directory>.</directory></testsuite> </testsuites> <logging> <log type="coverage-html" target="build/phpunit/html" title="CIDemo" charset="UTF-8" yui="true" highlight="true" lowUpperBound="35" highLowerBound="70" /> <log type="coverage-clover" target="build/phpunit/clover.xml"/> <log type="junit" target="build/phpunit/junit.xml" logIncompleteSkipped="false" /> </logging></phpunit>

build.xml<project name="CIDemo" default="build" basedir="."> <property name="output" location="${basedir}/build/" /> <target name="build" depends="prepare,phpunit"> </target> <target name="prepare" depends="clean"> <mkdir dir="${output}" /> </target> <target name="clean"> <delete dir="${output}" /> </target>

<target name="phpunit"> <exec executable="phpunit" failonerror="true" /> </target></project>

Plugin xUnitRésultats des tests unitaires

Plugin Clover PHPRapports sur la couverture des tests

Plugin Clover PHP

PHP Code Sniffer

sudo pear install PHP_CodeSnifferInstallation:

build.xml<target name="phpcs"><exec executable="phpcs"><arg line="--report=checkstyle--report-file=${output}/phpcs/checkstyle.xml--standard=Zend${basedir}" /></exec></target>

Plugin Checkstyle

PHP Depend

sudo pear channel-discover pear.pdepend.orgsudo pear install pdepend/PHP_Depend-beta

Installation:

build.xml <target name="pdepend"> <exec executable="pdepend"> <arg line=" --jdepend-xml=${output}/pdepend/jdepend.xml--jdepend-chart=${output}/pdepend/dependencies.svg --overview-pyramid=${output}/pdepend/overview-pyramid.svg--ignore=Tests/. " /> </exec> </target>

Plugin JDepend

PHP Mess Detector

sudo pear channel-discover pear.phpmd.orgsudo pear channel-discover pear.pdepend.orgsudo pear install --alldeps phpmd/PHP_PMD

Installation:

build.xml<target name="phpmd"> <exec executable="phpmd"><arg line=". xml codesize,unusedcode,naming,design --reportfile ${output}/phpmd/messdetector.xml --exclude Tests/" /> </exec></target>

Plugin PMD

PHP Copy/Paste

Detector

sudo pear channel-discover pear.phpunit.desudo pear channel-discover components.ez.nosudo pear install phpunit/phpcpd

Installation:

build.xml<target name="phpcpd" depends="prepare"> <exec executable="phpcpd"> <arg line=" --log-pmd ${output}/phpcpd/phpcpd.xml --min-tokens 30 ." /> </exec></target>

Plugin DRY

Template for Jenkins Jobs for PHP

ProjectsBy 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: [email protected]• LinkedIn http://ca.linkedin.com/in/ehogue

Contact: