-
-
Save Yennick/5c9c0d9de88009a1618d to your computer and use it in GitHub Desktop.
build.xml to run PHPUnit for CakePHP using DBTest by CakeDC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project name="name-of-project" default="build"> | |
<target name="build" | |
depends="prepare,dbtest,cake,lint,phpcs-ci,phploc,pdepend,phpmd-ci,phpcpd"/> | |
<target name="build-parallel" | |
depends="prepare,dbtest,cake,lint,tools-parallel"/> | |
<target name="tools-parallel" description="Run tools in parallel"> | |
<parallel threadCount="2"> | |
<sequential> | |
<antcall target="pdepend"/> | |
<antcall target="phpmd-ci"/> | |
</sequential> | |
<antcall target="phpcpd"/> | |
<antcall target="phpcs-ci"/> | |
<antcall target="phploc"/> | |
</parallel> | |
</target> | |
<target name="clean" description="Cleanup build artifacts"> | |
<delete dir="${basedir}/build/api"/> | |
<delete dir="${basedir}/build/code-browser"/> | |
<delete dir="${basedir}/build/coverage"/> | |
<delete dir="${basedir}/build/logs"/> | |
<delete dir="${basedir}/build/pdepend"/> | |
</target> | |
<target name="prepare" depends="clean" description="Prepare for build"> | |
<mkdir dir="${basedir}/build/api"/> | |
<mkdir dir="${basedir}/build/code-browser"/> | |
<mkdir dir="${basedir}/build/coverage"/> | |
<mkdir dir="${basedir}/build/logs"/> | |
<mkdir dir="${basedir}/build/pdepend"/> | |
<mkdir dir="${basedir}/build/phpdoc"/> | |
</target> | |
<target name="lint" description="Perform syntax check of sourcecode files"> | |
<apply executable="php" failonerror="true"> | |
<arg value="-l" /> | |
<fileset dir="${basedir}/app/Config"> | |
<include name="**/*.php" /> | |
<modified /> | |
</fileset> | |
<fileset dir="${basedir}/app/Controller"> | |
<include name="**/*.php" /> | |
<modified /> | |
</fileset> | |
<fileset dir="${basedir}/app/View"> | |
<include name="**/*.php" /> | |
<include name="**/*.ctp" /> | |
<modified /> | |
</fileset> | |
<fileset dir="${basedir}/app/Model"> | |
<include name="**/*.php" /> | |
<include name="**/*.ctp" /> | |
<modified /> | |
</fileset> | |
<fileset dir="${basedir}/app/Test"> | |
<include name="**/*.php" /> | |
<modified /> | |
</fileset> | |
</apply> | |
</target> | |
<target name="phploc" description="Measure project size using PHPLOC"> | |
<exec executable="phplocb"> | |
<arg value="--log-csv" /> | |
<arg value="${basedir}/build/logs/phploc.csv" /> | |
<arg path="${basedir}/app" /> | |
</exec> | |
</target> | |
<target name="pdepend" description="Calculate software metrics using PHP_Depend"> | |
<exec executable="pdepend"> | |
<arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml" /> | |
<arg value="--jdepend-chart=${basedir}/build/pdepend/dependencies.svg" /> | |
<arg value="--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg" /> | |
<arg path="${basedir}/app/Controller,${basedir}/app/Model" /> | |
</exec> | |
</target> | |
<target name="phpmd" | |
description="Perform project mess detection using PHPMD and print human readable output. Intended for usage on the command line before committing."> | |
<exec executable="phpmd"> | |
<arg path="${basedir}/app/Controller,${basedir}/app/View,${basedir}/app/Model" /> | |
<arg value="text" /> | |
<arg value="/var/lib/jenkins/files/phpmd.xml" /> | |
<arg value="--extensions php" /> | |
</exec> | |
</target> | |
<target name="phpmd-ci" description="Perform project mess detection using PHPMD creating a log file for the continuous integration server"> | |
<exec executable="phpmd"> | |
<arg path="${basedir}/app/Controller,${basedir}/app/View,${basedir}/app/Model" /> | |
<arg value="xml" /> | |
<arg value="codesize,design,naming,unusedcode" /> | |
<arg value="--reportfile" /> | |
<arg value="${basedir}/build/logs/pmd.xml" /> | |
<arg value="--extensions php" /> | |
</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="phpcs"> | |
<arg value="--extensions=php,ctp" /> | |
<arg value="--standard=CakePHP" /> | |
<arg path="${basedir}/app" /> | |
</exec> | |
</target> | |
<target name="phpcs-ci" description="Find coding standard violations using PHP_CodeSniffer creating a log file for the continuous integration server"> | |
<exec executable="phpcs"> | |
<arg value="--extensions=php,ctp" /> | |
<arg value="--report=checkstyle" /> | |
<arg value="--report-file=${basedir}/build/logs/checkstyle.xml" /> | |
<arg value="--standard=CakePHP" /> | |
<arg value="-n" /> | |
<arg value="${basedir}/app" /> | |
<arg value="--ignore=app/Plugin,app/Vendor,app/tmp,App/Locale,app/Opauth" /> | |
</exec> | |
</target> | |
<target name="phpcpd" description="Find duplicate code using PHPCPD"> | |
<exec executable="phpcpd"> | |
<arg value="--log-pmd" /> | |
<arg value="${basedir}/build/logs/pmd-cpd.xml" /> | |
<arg path="${basedir}/app" /> | |
</exec> | |
</target> | |
<target name="dbtest" description="Run unit tests"> | |
<exec executable="app/Console/cake"> | |
<arg value="DbTest.db_test" /> | |
<arg value="-i" /> | |
</exec> | |
</target> | |
<target name="cake" description="Run unit tests"> | |
<exec executable="app/Console/cake"> | |
<arg value="DbTest.db_test" /> | |
<arg value="app" /> | |
<arg value="AllTests" /> | |
<arg value="--stderr" /> | |
<arg value="--coverage-clover" /> | |
<arg path="build/logs/clover.xml" /> | |
<arg value="--log-junit" /> | |
<arg path="build/logs/junit.xml" /> | |
<arg value="--coverage-html" /> | |
<arg path="build/coverage/" /> | |
</exec> | |
</target> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment