Continuous integration, Hudson and PHP Setting up under Ubuntu – PART 1

Continuous Integration is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily – leading to multiple integrations per day.
Each integration is verified by an automated build (including test) to detect integration errors as quickly as possible.

In this tutorial we will try install Hudson which is a continuous integration server under Ubuntu 10.4

Install Xdebug

We will install xdebug using pear :

sudo apt-get install  php-pear

install xdebug through pecl

sudo pecl install xdebug
sudo vi /etc/php5/conf.d/xdebug.ini

Then Add

zend_extension=/usr/lib/php5/20090626+lfs/xdebug.so

Note : find the correct generated library under /usr/lib/php5/

To test if every thing is okye type :

php --version

And you will have something like this :

php --version
PHP 5.3.2-1ubuntu4.5 with Suhosin-Patch (cli) (built: Sep 17 2010 13:41:55)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans

Installing PHPUnit

PHPUnit will be used for write unit tests :

pear channel-discover pear.phpunit.de
pear channel-discover pear.symfony-project.com
pear install phpunit/PHPUnit

Install JAVA

sudo vi /etc/apt/sources.list

add

deb http://us.archive.ubuntu.com/ubuntu/ hardy multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ hardy multiverse
deb http://us.archive.ubuntu.com/ubuntu/ hardy-updates multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ hardy-updates multiverse
sudo apt-get update

sudo apt-get install sun-java6-bin

Installing Ant

sudo apt-get install ant

Installing Hudson

And finally install hudson

apt-get install daemon

wget -O /tmp/key http://hudson-ci.org/debian/hudson-ci.org.key
sudo apt-key add /tmp/key

wget -O /tmp/hudson.deb http://hudson-ci.org/latest/debian/hudson.deb
sudo dpkg --install /tmp/hudson.deb

At this point you can test if everything is ok :

http://[host]:8080/

In the next tutorial i will try to explain how to install common used plugins for PHP Development and how to create build.xml the ant file configuration for common build jobs.

you can now move to part two of this tutorial : http://www.hbensalem.com/php/continuous-integration-hudson-and-php-setting-up-under-ubuntu-part-1/

Ressources :

http://techportal.ibuildings.com/2010/09/20/building-a-continuous-integration-server-for-php-with-hudson/
http://blog.jepamedia.org/2009/10/28/continuous-integration-for-php-with-hudson/
http://ubuntuforums.org/showthread.php?t=525257
http://www.martinfowler.com/articles/continuousIntegration.html

3 Replies to “Continuous integration, Hudson and PHP Setting up under Ubuntu – PART 1”

  1. Thanks for sharing! Very helpful. Why i came to this page is because i installed hudson with apt-get install hudson and then number of other packages were installed like libgcj etc and then it was showing Error 500.

    It worked with your procedure above.

  2. If you are getting an error “missing phpize” while installing xdebug, try installing php5-dev before (sudo apg-get install php5-dev). Then is works…

Leave a Reply