Using Phing with Travis CI
We’ve started using Travis CI on one of my projects to run some build processes to check that everything looks good before we merge/deploy code. One thing I ran into quite quickly was that I wanted to install phing in order to use the build scripts we already have and use elsewhere, but that it isn’t provided by default by Travis CI.
In fact, you can install phing by adding it to the before_install
section of your .travis.yml
; so the file could look something like this:
language: php php: - "5.4" before_install: - pear channel-discover pear.phing.info - pear install phing/phing - phpenv rehash script: - phing -f src/build.xml phplint
That rehash
is the magic sauce that makes your path pick up phing and so be able to run the command in the script
section. I expect phing to be quite a common requirements for PHP projects, so it’s good to know that it can easily be used with TravisCI.
Why not configure Phing as a development dependency of the project via composer?
In this instance is because the project doesn’t use composer!
Have you considered adding Phing in your composer.json file in the require-dev section ?
The you can use composer by executing the command `vendor/bin/phing`
Good tip. As I just replied to someone else, this project actually doesn’t use composer but for others solving the same problem this could well be handy advice, thanks
It’s quite sad that Phing is not on Travis by default.
I prefer a simple “wget http://www.phing.info/get/phing-latest.phar” and “php phing-latest.phar” to work with it.
Does Travis CI also support SCP-, Git and Liquibase tasks?
Pingback: Links for my PHPDublin phing talk. | Ken Guest’s online diary