Basic Continuous Integration Server with Symfony and Hudson
This is the absolute minimal setup I was able to find to get a continuous integration server running for Symfony that would report a failed build if any of the project’s unit tests failed. I tried a couple different CI servers and Hudson seemed to be the best mix of easy to install, configure, and use that was also free/open-source.
- Install and run Hudson
- Navigate to Manage Hudson > Manage Plugins > Available and install the TextFinder plugin
- Create a new job in Hudson for your Symfony site
- Add an Execute Shell build step with a command of “symfony test:all”. Note: if your project root dir is not your site dir then you will need to first cd to your site dir.
- Enable the Hudson Text Finder post-build action with the following settings:
- Check the Also search the console output checkbox
- Enter “All tests successful” for the regular expression
- Check the Succeed if found checkbox
Once this is configured, your builds will fail unless all of your tests pass. The build will also fail if you have no tests. If you have a failed build, you’ll need to look at the build’s console output to determine the failing tests—no fancy test report pages—remember I said this is the absolute minimal setup. This is basically a limitation of Symfony’s built-in Lime unit testing framework (it only outputs to the console). Using Phing combined with PHPUnit or SimpleTest I expect to be able to generate a JUnit-compatible XML file that Hudson has built-in support for.