Marcin's Musings

Random bits of stuff

Continous Integration for CFML Projects

| Comments

I recently took on the task of trying to make the FW/1 test suite run on Travis CI. With a bit of experimentation and hacking it now works! This might be the first open source CFML project with Continous Integration tests, and as a resource for the community I thought it would be good to release the relevant parts as a template of sorts. Presenting the CFML CI project:

The README contains instructions for integrating with your CFML project.

What’s Continous Integration?

Stepping back a bit, you may be wondering what Continous Integration (CI) actually is. Roughly speaking, it’s the idea that your tests / build process is run continously, automatically, whenever a change is made to the repository – giving you immediate feedback if the changes are going to break the build.

Travis CI

Travis CI is a CI Software as a Service (SaaS) platform, originally started for the open source community. It provides a number of different language environments for running tests in – including Java. Travis CI is free to use for open source projects (but your builds are public), and integrates closely with Github. What this means is that when a FW/1 Pull Request is opened now, it will automatically have the tests run by Travis, and the results will be shown in Github – giving you plenty of warning before you merge a “broken build”.

It also provides you a nice image you can stick in your Github README (or anywhere else) with the current status of the build, for example this is the live status of the CFML CI project:

Build Status

The process

There were a few modifications required to a few components in order to get everything working smoothly:

  • A patch was required to MXUnit as on a default Railo install it tries to output some null properties in the XML output which was causing a failure.
  • Modifications were required to the Ant Runner CFC as some of the FW/1 tests set the status code to 500 (error) which flowed through to the test output causing a failure
  • A custom output Ant task was written that takes the output from the test runner and displays it on the Ant console, otherwise on Travis CI if the tests failed you would not get any feedback as to which test had failed in the console.

The scripts currently only work with Railo, because Adobe does not provide an equivalent to Railo Express which makes a simple download / extract / run process impossible on ACF. Need to experiment with the idea of installing and configuring ACF locally and creating a “ready to run” package.

The future

There’s still a bit of work I’d like to put into this, some of it a bit simpler than others:

  • support for multiple versions of Railo, and Adobe ColdFusion
  • create a new version of the MXUnit Ant task that integrates the console output as well as fixing some other minor issues
  • there’s already brief guides for running on Travis and Jenkins, but provide documentation for integrating with other CI servers (Bamboo, ??)
  • make it work on Windows (it’s very unix dependent right now – would probably involve rewriting the helper script in something more portable) – although this isn’t a high priority for me

As always with open source, feel free to contribute your code or comments via the Github repo!