Skip to content

Instantly share code, notes, and snippets.

@ftdysa
Created March 14, 2014 15:14
Show Gist options
  • Save ftdysa/9549659 to your computer and use it in GitHub Desktop.
Save ftdysa/9549659 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<project name="project" default="build-parallel">
<target name="build" depends="prepare,lint,phploc,pdepend,phpmd-ci,phpcs-ci,phpcpd,phpunit,behat,phpdox"/>
<target name="build-parallel" depends="prepare,lint,tools-parallel,phpunit,behat,phpdox"/>
<target name="tests" depends="prepare,phpunit,behat"/>
<target name="tools-parallel" description="Run tools in parallel">
<parallel threadCount="4">
<sequential>
<antcall target="pdepend"/>
<antcall target="phpmd"/>
<antcall target="phpcpd"/>
<antcall target="phpcs"/>
<antcall target="phploc"/>
</sequential>
</parallel>
</target>
<target name="clean" description="Cleanup build artifacts">
<echo message="Starting clean target"/>
<delete dir="${basedir}/app/cache"/>
<delete dir="${basedir}/app/logs"/>
<delete dir="${basedir}/build/api"/>
<delete dir="${basedir}/build/behat"/>
<delete dir="${basedir}/build/coverage"/>
<delete dir="${basedir}/build/logs"/>
<delete dir="${basedir}/build/pdepend"/>
<delete dir="${basedir}/build/phpdox"/>
<echo message="Ending clean target"/>
</target>
<target name="prepare" depends="clean" description="Prepare for build">
<echo message="Starting prepare target"/>
<mkdir dir="${basedir}/app/cache"/>
<mkdir dir="${basedir}/app/logs"/>
<mkdir dir="${basedir}/build/api"/>
<mkdir dir="${basedir}/build/behat"/>
<mkdir dir="${basedir}/build/coverage"/>
<mkdir dir="${basedir}/build/coverage/html"/>
<mkdir dir="${basedir}/build/coverage/xml"/>
<mkdir dir="${basedir}/build/logs"/>
<mkdir dir="${basedir}/build/pdepend"/>
<mkdir dir="${basedir}/build/phpdox"/>
<touch file="${basedir}/build/coverage/index.html"/>
<touch file="${basedir}/build/behat/temp.log"/>
<exec executable="composer">
<env key="JENKINS_ANT" value="true"/>
<env key="ANT_BEHAT_BUILD" value="${build}"/>
<arg value="--prefer-dist"/>
<arg value="-v"/>
<arg value="install"/>
</exec>
<exec executable="/usr/bin/php">
<arg value="${basedir}/app/console"/>
<arg line="cache:flush default"/>
</exec>
<echo message="Ending prepare target"/>
</target>
<target name="lint" description="Perform syntax check of sourcecode files">
<echo message="Starting lint target"/>
<apply executable="php" failonerror="true">
<arg value="-l"/>
<fileset dir="${basedir}/src">
<include name="**/*.php"/>
<modified/>
</fileset>
<fileset dir="${basedir}/tests">
<include name="**/*.php"/>
<modified/>
</fileset>
</apply>
<apply executable="php" failonerror="true">
<arg value="${basedir}/app/console"/>
<arg value="twig:lint"/>
<arg value="--env=test"/>
<fileset dir="${basedir}/src">
<include name="**/*.twig"/>
</fileset>
</apply>
<echo message="Ending lint target"/>
</target>
<target name="phploc" description="Measure project size using PHPLOC">
<echo message="Starting phploc target"/>
<exec executable="${basedir}/bin/phploc">
<arg value="--log-csv"/>
<arg value="${basedir}/build/logs/phploc.csv"/>
<arg value="--log-xml"/>
<arg value="${basedir}/build/phpdox/phploc.xml"/>
<arg path="${basedir}/src"/>
</exec>
<echo message="Ending phploc target"/>
</target>
<target name="pdepend" description="Calculate software metrics using PHP_Depend">
<echo message="Starting pdepend target"/>
<exec executable="${basedir}/bin/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}/src"/>
</exec>
<echo message="Ending pdepend target"/>
</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.">
<echo message="Starting phpmd target"/>
<exec executable="${basedir}/bin/phpmd">
<arg path="${basedir}/src"/>
<arg value="text"/>
<arg value="${basedir}/build/phpmd.xml"/>
</exec>
<echo message="Ending phpmd target"/>
</target>
<target name="phpmd-ci" description="Perform project mess detection using PHPMD creating a log file for the continuous integration server">
<echo message="Starting phpmd-ci target"/>
<exec executable="${basedir}/bin/phpmd">
<arg path="${basedir}/src"/>
<arg value="xml"/>
<arg value="${basedir}/build/phpmd.xml"/>
<arg value="--reportfile"/>
<arg value="${basedir}/build/logs/pmd.xml"/>
</exec>
<echo message="Ending phpmd-ci target"/>
</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.">
<echo message="Starting phpcs target"/>
<exec executable="${basedir}/bin/phpcs">
<arg value="--standard=${basedir}/build/phpcs.xml"/>
<arg path="${basedir}/src"/>
</exec>
<echo message="Ending phpcs target"/>
</target>
<target name="phpcs-ci" description="Find coding standard violations using PHP_CodeSniffer creating a log file for the continuous integration server">
<echo message="Starting phpcs-ci target"/>
<exec executable="${basedir}/bin/phpcs" output="/dev/null">
<arg value="--report=checkstyle"/>
<arg value="--report-file=${basedir}/build/logs/checkstyle.xml"/>
<arg value="--standard=${basedir}/build/phpcs.xml"/>
<arg path="${basedir}/src"/>
</exec>
<echo message="Ending phpcs-ci target"/>
</target>
<target name="phpcpd" description="Find duplicate code using PHPCPD">
<echo message="Starting phpcpd target"/>
<exec executable="${basedir}/bin/phpcpd">
<arg value="--log-pmd"/>
<arg value="${basedir}/build/logs/pmd-cpd.xml"/>
<arg path="${basedir}/src"/>
</exec>
<echo message="Ending phpcpd target"/>
</target>
<target name="phpunit" description="Run unit tests with PHPUnit">
<echo message="Starting phpunit target"/>
<exec executable="${basedir}/bin/phpunit" failonerror="true"/>
<echo message="Ending phpunit target"/>
</target>
<target name="behat" description="Run feature tests with behat">
<echo message="Starting behat target"/>
<exec executable="${basedir}/bin/behat">
<arg line="--profile ci --out null,build/behat.html,build/behat.log"/>
</exec>
<echo message="Ending begat target"/>
</target>
<target name="phpdox" description="Generate API documentation using phpDox">
<echo message="Starting phpdox target"/>
<exec executable="${basedir}/bin/phpdox"/>
<echo message="Ending phpdox target"/>
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment