Most of us use Jenkins to continuously integrate our projects with every commit to the repository, but when it comes with PHP most of the time is spent “linting”.
This action is badly slow and if your project has a lot of files this will take a good percentage of your build time. A really good approach could be executing this task with different files in parallel. For this you can use the powerful xargs command with -P0, which allows xargs to run as many processes as possible at a time.
find codefolder/ -name "*.php" -print0 | xargs -0 -n1 -P0 php -lSo the final snippet for your Ant based project will be:
<target name="lint">
<exec executable="sh" failonerror="true">
<arg value="-c" />
<arg value="find ${project.paths.php.space-separated} -name *.php -print0 | xargs -0 -n1 -P0 php -l"/>
</exec>
</target>Easy way to install PHP QA tools
A bash snippet that installs phpunit, phploc, phpmd, pdepend and the rest of the PHP QA toolchain in one go through Composer.
Setting up Jenkins in Ubuntu Precise 12.04 for PHP projects
Every step to turn an Ubuntu 12.04 box into a Jenkins continuous integration server for PHP projects.
Command line tools written with PHP (III): writing UNIX daemons
Forking, detaching from the terminal, PID files and signal handling in PHP — plus an honest look at the one problem the language does not let you solve, and what to do about it.