Skip to content

Instantly share code, notes, and snippets.

@bendo01
Created May 2, 2012 19:43
Show Gist options
  • Select an option

  • Save bendo01/2579676 to your computer and use it in GitHub Desktop.

Select an option

Save bendo01/2579676 to your computer and use it in GitHub Desktop.
Ant / Jenkins / CakePHP build file ikemekContinuousIntegration build and setting, put build.xml in /Users/Shared/Jenkins/Home/jobs/ikemekContinuousIntegration and specify build.xml in job setting, dont forget to chmod -R 777 App/tmp
<?xml version="1.0" encoding="UTF-8"?>
<project name="ikemekContinuousIntegration" default="build" basedir="/Users/Shared/Jenkins/Home/jobs/ikemekContinuousIntegration/workspace">
<target name="build" depends="prepare,lintModel,lintController,cakeJUnitAndClover,cakeGenerateCoverageHtml,phploc,pdepend,phpcpd,phpcs,cakeGenerateApiHtml"/>
<target name="build-parallel" depends="prepare,tools-parallel"/>
<target name="tools-parallel" description="Run tools in parallel">
<parallel threadCount="2">
<sequential>
<antcall target="pdepend"/>
</sequential>
<antcall target="phploc"/>
<antcall target="phpcpd"/>
</parallel>
</target>
<target name="clean" description="Cleanup build artifacts">
<delete dir="${basedir}/build/api"/>
<delete dir="${basedir}/build/jUnitAndCloverDir"/>
<delete dir="${basedir}/build/resultTestingReport"/>
<delete dir="${basedir}/build/phpLocDir"/>
<delete dir="${basedir}/build/phpDependDir"/>
<delete dir="${basedir}/build/phpMdDir"/>
<delete dir="${basedir}/build/phpCpdDir"/>
<delete dir="${basedir}/build/phpCodeSnifferDir"/>
</target>
<target name="prepare" depends="clean" description="Prepare for build">
<mkdir dir="${basedir}/build/api"/>
<mkdir dir="${basedir}/build/jUnitAndCloverDir"/>
<mkdir dir="${basedir}/build/resultTestingReport"/>
<mkdir dir="${basedir}/build/phpLocDir"/>
<mkdir dir="${basedir}/build/phpDependDir"/>
<mkdir dir="${basedir}/build/phpMdDir"/>
<mkdir dir="${basedir}/build/phpCpdDir"/>
<mkdir dir="${basedir}/build/phpCodeSnifferDir"/>
</target>
<target name="lintModel">
<apply executable="php" failonerror="true">
<arg value="-l" />
<fileset dir="/opt/local/www/ikemek/app/Model">
<include name="**/*.php" />
<modified />
</fileset>
</apply>
</target>
<target name="lintController">
<apply executable="php" failonerror="true">
<arg value="-l" />
<fileset dir="/opt/local/www/ikemek/app/Controller">
<include name="**/*.php" />
<modified />
</fileset>
</apply>
</target>
<target name="cakeJUnitAndClover" description="Generate Clover Xml and junit Xml using cakephp console">
<exec executable="/opt/local/bin/php">
<arg value="/opt/local/www/ikemek/app/Console/cake.php" />
<arg value="testsuite" />
<arg value="app" />
<arg value="AllModel" />
<arg value="--stderr" />
<arg value="--log-junit" />
<arg value="${basedir}/build/jUnitAndCloverDir/junit.xml" />
<arg value="--coverage-clover" />
<arg value="${basedir}/build/jUnitAndCloverDir/clover.xml" />
</exec>
</target>
<target name="cakeGenerateCoverageHtml" description="Generate Testing in HTML Format using cakephp console">
<exec executable="/opt/local/bin/php">
<arg value="/opt/local/www/ikemek/app/Console/cake.php" />
<arg value="testsuite" />
<arg value="app" />
<arg value="AllModel" />
<arg value="--coverage-html" />
<arg value="${basedir}/build/resultTestingReport" />
</exec>
</target>
<target name="phploc" description="Measure project size using PHPLOC">
<exec executable="/opt/local/bin/phploc">
<arg value="--log-csv" />
<arg value="${basedir}/build/phpLocDir/phplocReport.csv" />
<arg value="/opt/local/www/ikemek/app" />
</exec>
</target>
<target name="pdepend" description="Calculate software metrics using PHP_Depend">
<exec executable="/opt/local/bin/pdepend">
<arg value="--ignore=${basedir}/app/Config,${basedir}/app/console,${basedir}/app/Lib,${basedir}/app/Locale,${basedir}/app/Plugin,${basedir}/app/Test,${basedir}/app/tmp,${basedir}/app/Vendor,${basedir}/app/View,${basedir}/app/webroot" />
<arg value="--jdepend-xml=${basedir}/build/phpDependDir/jdepend.xml" />
<arg value="--jdepend-chart=${basedir}/build/phpDependDir/dependencies.svg" />
<arg value="--overview-pyramid=${basedir}/build/phpDependDir/overview-pyramid.svg" />
<arg path="/opt/local/www/ikemek/app" />
</exec>
</target>
<target name="phpcpd" description="Find duplicate code using PHPCPD">
<exec executable="/opt/local/bin/phpcpd">
<arg value="--log-pmd" />
<arg value="${basedir}/build/phpCpdDir/cpd.xml" />
<arg value="--exclude" />
<arg value="app/Config" />
<arg value="--exclude" />
<arg value="app/console" />
<arg value="--exclude" />
<arg value="app/Lib" />
<arg value="--exclude" />
<arg value="app/Locale" />
<arg value="--exclude" />
<arg value="app/Plugin" />
<arg value="--exclude" />
<arg value="app/Test" />
<arg value="--exclude" />
<arg value="app/tmp" />
<arg value="--exclude" />
<arg value="app/Vendor" />
<arg value="--exclude" />
<arg value="app/View" />
<arg value="--exclude" />
<arg value="app/webroot" />
<arg path="/opt/local/www/ikemek/app" />
</exec>
</target>
<target name="phpcs" description="Find coding standard violations using PHP_CodeSniffer and print human readable output. Intended for usage on the command line before committing.">
<exec executable="/opt/local/bin/phpcs">
<arg value="--standard=CakePHP" />
<arg value="/opt/local/www/ikemek/app/Model" />
<arg value="/opt/local/www/ikemek/app/Controller" />
</exec>
</target>
<target name="cakeGenerateApiHtml" description="Generate Api in HTML Format using cakephp api plugin console">
<exec executable="/opt/local/bin/php">
<arg value="/opt/local/www/ikemek/app/Console/cake.php" />
<arg value="ApiGenerator.ApiIndex" />
<arg value="update" />
</exec>
</target>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project name="xprofile" default="build" basedir="/Users/Shared/Jenkins/Home/jobs/xprofile/workspace">
<target name="build" depends="prepare,lintModel,lintController,cakeJUnitAndClover,cakeGenerateCoverageHtml,phploc,pdepend,phpcpd,phpcs,cakeGenerateApiHtml"/>
<target name="build-parallel" depends="prepare,tools-parallel"/>
<target name="tools-parallel" description="Run tools in parallel">
<parallel threadCount="2">
<sequential>
<antcall target="pdepend"/>
</sequential>
<antcall target="phploc"/>
<antcall target="phpcpd"/>
</parallel>
</target>
<target name="clean" description="Cleanup build artifacts">
<delete dir="${basedir}/build/api"/>
<delete dir="${basedir}/build/jUnitAndCloverDir"/>
<delete dir="${basedir}/build/resultTestingReport"/>
<delete dir="${basedir}/build/phpLocDir"/>
<delete dir="${basedir}/build/phpDependDir"/>
<delete dir="${basedir}/build/phpMdDir"/>
<delete dir="${basedir}/build/phpCpdDir"/>
<delete dir="${basedir}/build/phpCodeSnifferDir"/>
</target>
<target name="prepare" depends="clean" description="Prepare for build">
<mkdir dir="${basedir}/build/api"/>
<mkdir dir="${basedir}/build/jUnitAndCloverDir"/>
<mkdir dir="${basedir}/build/resultTestingReport"/>
<mkdir dir="${basedir}/build/phpLocDir"/>
<mkdir dir="${basedir}/build/phpDependDir"/>
<mkdir dir="${basedir}/build/phpMdDir"/>
<mkdir dir="${basedir}/build/phpCpdDir"/>
<mkdir dir="${basedir}/build/phpCodeSnifferDir"/>
</target>
<target name="lintModel">
<apply executable="php" failonerror="true">
<arg value="-l" />
<fileset dir="/opt/local/www/xprofile/app/Model">
<include name="**/*.php" />
<modified />
</fileset>
</apply>
</target>
<target name="lintController">
<apply executable="php" failonerror="true">
<arg value="-l" />
<fileset dir="/opt/local/www/xprofile/app/Controller">
<include name="**/*.php" />
<modified />
</fileset>
</apply>
</target>
<target name="cakeJUnitAndClover" description="Generate Clover Xml and junit Xml using cakephp console">
<exec executable="/opt/local/bin/php54">
<arg value="/opt/local/www/xprofile/app/Console/cake.php" />
<arg value="testsuite" />
<arg value="app" />
<arg value="AllModel" />
<arg value="--stderr" />
<arg value="--log-junit" />
<arg value="${basedir}/build/jUnitAndCloverDir/junit.xml" />
<arg value="--coverage-clover" />
<arg value="${basedir}/build/jUnitAndCloverDir/clover.xml" />
</exec>
</target>
<target name="cakeGenerateCoverageHtml" description="Generate Testing in HTML Format using cakephp console">
<exec executable="/opt/local/bin/php54">
<arg value="/opt/local/www/xprofile/app/Console/cake.php" />
<arg value="testsuite" />
<arg value="app" />
<arg value="AllModel" />
<arg value="--coverage-html" />
<arg value="${basedir}/build/resultTestingReport" />
</exec>
</target>
<target name="phploc" description="Measure project size using PHPLOC">
<exec executable="/opt/local/bin/phploc">
<arg value="--log-csv" />
<arg value="${basedir}/build/phpLocDir/phplocReport.csv" />
<arg value="/opt/local/www/xprofile/app" />
</exec>
</target>
<target name="pdepend" description="Calculate software metrics using PHP_Depend">
<exec executable="/opt/local/bin/pdepend">
<arg value="--ignore=${basedir}/app/Config,${basedir}/app/console,${basedir}/app/Lib,${basedir}/app/Locale,${basedir}/app/Plugin,${basedir}/app/Test,${basedir}/app/tmp,${basedir}/app/Vendor,${basedir}/app/View,${basedir}/app/webroot" />
<arg value="--jdepend-xml=${basedir}/build/phpDependDir/jdepend.xml" />
<arg value="--jdepend-chart=${basedir}/build/phpDependDir/dependencies.svg" />
<arg value="--overview-pyramid=${basedir}/build/phpDependDir/overview-pyramid.svg" />
<arg path="/opt/local/www/xprofile/app" />
</exec>
</target>
<target name="phpcpd" description="Find duplicate code using PHPCPD">
<exec executable="/opt/local/bin/phpcpd">
<arg value="--log-pmd" />
<arg value="${basedir}/build/phpCpdDir/cpd.xml" />
<arg value="--exclude" />
<arg value="app/Config" />
<arg value="--exclude" />
<arg value="app/console" />
<arg value="--exclude" />
<arg value="app/Lib" />
<arg value="--exclude" />
<arg value="app/Locale" />
<arg value="--exclude" />
<arg value="app/Plugin" />
<arg value="--exclude" />
<arg value="app/Test" />
<arg value="--exclude" />
<arg value="app/tmp" />
<arg value="--exclude" />
<arg value="app/Vendor" />
<arg value="--exclude" />
<arg value="app/View" />
<arg value="--exclude" />
<arg value="app/webroot" />
<arg path="/opt/local/www/xprofile/app" />
</exec>
</target>
<target name="phpcs" description="Find coding standard violations using PHP_CodeSniffer and print human readable output. Intended for usage on the command line before committing.">
<exec executable="/opt/local/bin/phpcs">
<arg value="--report=xml" />
<arg value="--report-file=${basedir}/build/phpCodeSnifferDir/checkstyle.xml" />
<arg value="--standard=CakePHP" />
<arg value="/opt/local/www/xprofile/app/Model" />
<arg value="/opt/local/www/xprofile/app/Controller" />
</exec>
</target>
<target name="cakeGenerateApiHtml" description="Generate Api in HTML Format using cakephp api plugin console">
<exec executable="/opt/local/bin/php54">
<arg value="/opt/local/www/xprofile/app/Console/cake.php" />
<arg value="ApiGenerator.ApiIndex" />
<arg value="update" />
</exec>
</target>
</project>
<?xml version='1.0' encoding='UTF-8'?>
<project>
<actions/>
<description>&lt;embed height=&quot;300&quot;&#xd;
src=&quot;http://180.249.61.189/job/ikemekContinuousIntegration/ws/build/phpDependDir/overview-pyramid.svg&quot;&#xd;
type=&quot;image/svg+xml&quot;&#xd;
width=&quot;500&quot;/&gt;&#xd;
&#xd;
&lt;embed height=&quot;300&quot;&#xd;
src=&quot;http://180.249.61.189/job/ikemekContinuousIntegration/ws/build/phpDependDir/dependencies.svg&quot;&#xd;
type=&quot;image/svg+xml&quot;&#xd;
width=&quot;500&quot;/&gt;</description>
<keepDependencies>false</keepDependencies>
<properties>
<org.jenkins.ci.plugins.html5__notifier.JobPropertyImpl>
<skip>false</skip>
</org.jenkins.ci.plugins.html5__notifier.JobPropertyImpl>
</properties>
<scm class="hudson.scm.NullSCM"/>
<canRoam>true</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers class="vector"/>
<concurrentBuild>false</concurrentBuild>
<builders>
<hudson.tasks.Ant>
<targets></targets>
<antName>(Default)</antName>
</hudson.tasks.Ant>
</builders>
<publishers>
<hudson.plugins.checkstyle.CheckStylePublisher>
<healthy></healthy>
<unHealthy></unHealthy>
<thresholdLimit>low</thresholdLimit>
<pluginName>[CHECKSTYLE] </pluginName>
<defaultEncoding></defaultEncoding>
<canRunOnFailed>false</canRunOnFailed>
<useDeltaValues>false</useDeltaValues>
<thresholds>
<unstableTotalAll></unstableTotalAll>
<unstableTotalHigh></unstableTotalHigh>
<unstableTotalNormal></unstableTotalNormal>
<unstableTotalLow></unstableTotalLow>
<failedTotalAll></failedTotalAll>
<failedTotalHigh></failedTotalHigh>
<failedTotalNormal></failedTotalNormal>
<failedTotalLow></failedTotalLow>
</thresholds>
<shouldDetectModules>false</shouldDetectModules>
<dontComputeNew>true</dontComputeNew>
<pattern>build/phpCodeSnifferDir/checkstyle-result.xml</pattern>
</hudson.plugins.checkstyle.CheckStylePublisher>
<hudson.plugins.dry.DryPublisher>
<healthy></healthy>
<unHealthy></unHealthy>
<thresholdLimit>low</thresholdLimit>
<pluginName>[DRY] </pluginName>
<defaultEncoding></defaultEncoding>
<canRunOnFailed>false</canRunOnFailed>
<useDeltaValues>false</useDeltaValues>
<thresholds>
<unstableTotalAll></unstableTotalAll>
<unstableTotalHigh></unstableTotalHigh>
<unstableTotalNormal></unstableTotalNormal>
<unstableTotalLow></unstableTotalLow>
<failedTotalAll></failedTotalAll>
<failedTotalHigh></failedTotalHigh>
<failedTotalNormal></failedTotalNormal>
<failedTotalLow></failedTotalLow>
</thresholds>
<shouldDetectModules>false</shouldDetectModules>
<dontComputeNew>true</dontComputeNew>
<pattern>build/phpCpdDir/cpd.xml</pattern>
<highThreshold>50</highThreshold>
<normalThreshold>25</normalThreshold>
</hudson.plugins.dry.DryPublisher>
<org.jenkinsci.plugins.cloverphp.CloverPublisher>
<publishHtmlReport>false</publishHtmlReport>
<reportDir>build/resultTestingReport/index.html</reportDir>
<xmlLocation>build/jUnitAndCloverDir/clover.xml</xmlLocation>
<disableArchiving>false</disableArchiving>
<healthyTarget>
<methodCoverage>70</methodCoverage>
<statementCoverage>80</statementCoverage>
</healthyTarget>
<unhealthyTarget/>
<failingTarget/>
</org.jenkinsci.plugins.cloverphp.CloverPublisher>
<htmlpublisher.HtmlPublisher>
<reportTargets>
<htmlpublisher.HtmlPublisherTarget>
<reportName>HTML Report Testing</reportName>
<reportDir>/Users/Shared/Jenkins/Home/jobs/ikemekContinuousIntegration/workspace/build/resultTestingReport/</reportDir>
<reportFiles>index.html</reportFiles>
<keepAll>false</keepAll>
<wrapperName>htmlpublisher-wrapper.html</wrapperName>
</htmlpublisher.HtmlPublisherTarget>
</reportTargets>
</htmlpublisher.HtmlPublisher>
<hudson.tasks.junit.JUnitResultArchiver>
<testResults>build/jUnitAndCloverDir/junit.xml</testResults>
<keepLongStdio>false</keepLongStdio>
<testDataPublishers/>
</hudson.tasks.junit.JUnitResultArchiver>
</publishers>
<buildWrappers/>
</project>
@bendo01

bendo01 commented Sep 6, 2012

Copy link
Copy Markdown
Author

put build.xml in /Users/Shared/Jenkins/Home/jobs/ikemekContinuousIntegration

specify path in job setting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment