At Imagine Easy, we pride ourselves on building great products on a great foundation. A great foundation means to also focus on code quality, and with said quality, the right amount of tests and (of course) coding standards.
For continuous integration and continuous delivery, we’re hugely invested in a platform called Travis-CI. At the very minimum Travis-CI allows us to run tools like phpunit and php codesniffer on code pushes. On successful builds (and merges) it also hooks into our in-house continuous deployment service (to be show-cased later :)).
Travis-CI is a hosted service — it’s in the cloud. When code is pushed, a VM is started and our tooling is run.
In order to keep track of improvements and regressions, we utilize a rubygem called
travis-artifacts, which allows anyone to store reports generated on Amazon S3.
travis-artifacts is a neat little tool, however, it comes with a not so small ruby dependency called Nokogiri.
Nokogiri is an XML parser which is probably used inside
travis-artifacts or one of its dependencies when they talk to the Amazon APIs to store files on Amazon S3.
Nokogiri is about 150 MB once installed and needs to be downloaded and compiled during each test run, which implies a considerable slowdown and essentially build backlog when we try to advance.
Since most (if not all) our builds run in a PHP environment, we decided to improve this situation.
travis-artifacts.php - https://github.com/easybiblabs/travis-artifacts.php
The code is free for use (and open-sourced under a simplified BSD license). We try to mimic the API of the travis-artifacts tool. In a nutshell, here’s how you integrate it into your PHP project:
Because the tool is available through packagist, you add the following to your
On Travis-CI, ensure development dependencies are installed (in
before_script: composer install --dev --prefer-dist
To publish build artifacts, add the following:
after_script: ./vendor/bin/travis-artifacts --path=results --root=/home/travis
This assumes that the results from your tools are stored in a results directory.
Along with these modifications to your
.travis.yml, our tool expects/uses the following environment variables. In case you have not used
travis-artifacts before, the following is also required:
So simple! :) So easy(bib)!
In summary, we saw between 1 to 2 minute faster builds. Since we try to keep our builds fast (and usually under 5 minutes), this is a hefty improvement!
We hope the code is useful to others.
All feedback and pull requests are always very welcome.