Resources for a PHP and Hudson CI Integration

Yesterday I finally had the time to setup my first continuous integration environment. Possible solutions for CI are phpUnderControl, Hudson or Arbit. Although phpUnderControl is the most wide-spread, but from I heard complex to setup/maintain, solution supposedly a hack and Arbit just in an early Alpha I decided to give Hudson a shoot. Another reason for this decision, I heard it has a simple plugin architecture and is easy to install and use. Additionally Hudson is easily integrated into Netbeans and Redmine, and I use both tools regularly in development.

My motivation to dive into CI is easily explained. I just never felt it was necessary to add a continuous integration enviroment to my projects, since I had one or two simple bash scripts that did the job. In general this is rather annoying, because they mostly only run PHPUnit and have to be done using a cronjob or manually, without any real process of notification. Additionally you have no way to navigate the test-results, code-coverage and no history of the last builds. For projects like Doctrine 2 we have the additional requirement to support 4 different database platforms, i.e. 4 different PHPUnit configurations. Currently that is solved by me using a Bash script that iterates over the configuration file names and invokes PHPUnit.

There are already some awesome sources how to get Hudson and PHP working. I'll list them here:

All those guides are already awesome and I would recommend choosing one of those to install Hudson, I think i can't add anything new to those. I have used Sebastians Howto, however i also like the third one. David Luhmans guide adds lots of details that are important to get the different parts of a build process to work.

Now what these tutorials all do is that they use a bash command to execute the build process or specifiy an Ant Build file. However there is also a Phing Build process plugin for Hudson that allows to specify the build.xml targets to execute in the process. From the "Available Plugins" list you can choose the "Phing plugin".

After installation you have to configure the Phing install. The Phing Plugin Wiki Page shows how to do this. You have to go to "Manage Hudson" => "Configure System" and look for Phing. There you find the dialog to configure your phing installations.

In the context of choosing a build script for your project you can now choose "Phing" instead of Ant:

You can enter the targets to build, for example on my local Hudson instance I only execute "test" for Doctrine 2, since I am not interested in the building and deployment onto the PEAR channel at this development stage.

From inside Netbeans you can then start builds by pointing to the Hudson instance. See this tutorial by one of the Hudson + Netbeans Developers. You can then start all the builds from inside Netbeans and be notified of the success or failure.

Share This Post

  • Share on Twitter
  • Facebook
  • Share on deli.cio.us
  • Share on Digg
  • Share on reddit
  • Share on StumbleUpon

Tags

This post is untagged.

Comments


nurul ferdous
Feb, 07. 2010

yeah hudson rocks!



sebs
Feb, 07. 2010

ty ;)



hermanradtke
Feb, 07. 2010

Another good Hudson + Phing resource: http://www.davegardner.me.uk/blog/2009/11/09/continuous-integration-for-php-using-hudson-and-phing/



johann-peter hartmann
Feb, 08. 2010

PHPUnderControl is not a hack, it's just a customization of CruiseControl - which itself is the most widespread CI platform right now. But since the configuration of CruiseControl is a PITA and the popularity is decreasing fast, Hudson is probably the better choice right now.
Greetings, johann



norbert
Feb, 08. 2010

Just tried Hudson this weekend. The whole administration via web interface is awesome. I wouln't go back du CC and phpUnderControl.

Greetings



manuel pichler
Feb, 08. 2010

Hi Benjamin,

here I must really insist. phpUnderControl isn't a hack, it's patch set for CruiseControl. Maybe CC and phpUnderControl aren't the best solutions. But this combination is a widely used Continuous-Integration environment and imho it has pushed the CI topic far more than other projects in the PHP ecosystem.

Greetings
Manuel



beberlei
Feb, 08. 2010

@Manuel, sorry I did not mean to diminish your work and you're correct phpUC has done the PHP Ecosystem real good. I was just meaning that I heard from various sources that CC isn't the most easy system and that PHPUC inherited this legacy. I have rewritten the sentence to be less agitating and more to the point.



christian
Feb, 11. 2010

Actually I tried CC and hudson and so far I have to say the time you have to spend on Hudson is significantly less than CC/phpUC. I wouldn't go as far as saying Hudson is superior but the web configuration is a major bonus!

Read about my experiences at http://test.ical.ly (in German)

Cheers
/Christian


Write a Comment