Home > Continuous Integration > Continuous Integration and Automated Deployment for PHP

Continuous Integration and Automated Deployment for PHP

I had set up the Continuous Integration for a few Ruby on Rails products including Workstreamr and PaidInterviews. It was easy with rake, the ci_reporter plugin, rcov and Bamboo. I also used Capistrano for automated deployments after each build. A new product development started a few days ago and I was called upon to setup the Continuous Integration platform again. It was different this time though. This new product was to be developed in PHP.
Rake is a general purpose build tool just like ant and maven. And Capistrano is the best deployment tool I have encountered so far. So the choice was easy. This is how I created a rake task to execute all the unit tests and produce test coverage reports with PHPUnit.

Yeah, yeah, I know, I could have done the same thing with a shell script. But when I start creating tasks for database migration and such, things are going to get messy and tracking dependencies wouldn’t be easy with shell script.

PHPUnit can also produce coverage reports. So I included the second task which would produce coverage reports.

Now for the deployment script.

And now I bundle all this up neatly in a shell script and give it to Bamboo. Here is what my build-deploy.sh script looks like:

#/bin/bash
rake build:report_coverage
cap remote deploy

  1. No comments yet.
  1. No trackbacks yet.