Hosted continuous integration services for PHP
Today, I’ve been evaluating popular hosted CI services to see how well they’re working with PHP and how much they cost.
drone.io is free for Open Source projects (one concurrent build). Paid plans for private repositories start at 25 $ / month. Builds are configured on the Web site. PHP support is marked as “beta” for good reasons: PHP 5.5.1 and composer are pretty much outdated. By default, builds are triggered by commits to all branches (can be limited).
If you don’t mind the old PHP version, you can update composer and run phpunit like this:
curl -sS https://getcomposer.org/installer | php php composer.phar update --prefer-source --no-interaction phpunit
Codeship is free for private projects (up to 100 builds / month). Open Source projects get unlimited builds. Paid plans start at 49 $ / month. Just like drone.io, build scripts are configured on the Web site. Since builds are triggered by commits to all branches, you’ll get “[Build failed]” notification mails even if branches are changed, that don’t contain code (for example “gh-pages” for GitHub Pages). PHP versions 5.3, 5.4, 5.5 and 5.6 are available.
My setup commands for PHP 5.6 and fetching composer dependencies look like this:
phpenv local 5.6 composer update --prefer-source --no-interaction
The next version of Codeship is supposed to support YAML files in a similar fashion as CircleCI and Travis CI.
CircleCI offers unlimited builds for free (one concurrent build). Paid plans start at 50 $ / month. The user interface can be a bit confusing at first.
Builds are configured on the Web site or in a circle.yml file that’s checked into the repository (like Travis CI):
general: branches: ignore: - gh-pages dependencies: override: - 'composer update --prefer-source --no-interaction' test: override: - phpunit machine: php: version: 5.6.14
Currently supported PHP versions are 5.3.3 up to 7.0.0RC7.
Travis CI is by far the most mature and popular service. It’s completely free for Open Source projects. Paid plans start at 129 $ / month.
Builds are configured in a .travis.yml file that’s checked into the repository:
language: php sudo: false php: - 5.5 - 5.6 - 7.0 - hhvm before_script: - composer install --dev script: phpunit --configuration phpunit.xml.dist
You can run your tests on multiple PHP versions in parallel and don’t need to provide exact version strings like “5.5.9”. Even Facebook’s HHVM (HipHop Virtual Machine) is supported. Tests are only executed (and a notification email sent) if a .travis.yml file was found.
While Travis CI certainly is the best hosted continuous integration service for Open Source projects, it’s also the most expensive one for private repositories. Budget-oriented users save some money with Codeship or CircleCI, if they can accept minor trade-offs. drone.io can not be recommended for PHP projects.