Firefox extensions with Travis CI

Developing an extension for Firefox is no different than developing anything else and CI is a good idea. It’s actually very easy to use Travis to run your test suite. For those that don’t know, Travis is a great resource for running CI on your open source projects for free.

Travis will install any version of Firefox you need and as it has them cached it’s much quicker than downloading it yourself. Specify the version with an addons element. The commands in the before_script section setup a headless window service and unpack Firefox. The tar command uses a wildcard to match the Firefox version requested, less to remember when updating the version. The environment variable JPM_FIREFOX_BINARY tells jpm where to find Firefox. This should be all you need to run jpm on any jpm based extension with Travis.

language: node_js
env:
  global:
    - DISPLAY=:99.0
    - JPM_FIREFOX_BINARY=$TRAVIS_BUILD_DIR/firefox/firefox
addons:
  firefox: "38.0"
before_script:
  - sh -e /etc/init.d/xvfb start
  - tar xvjf /tmp/firefox-*.tar.bz2 -C $TRAVIS_BUILD_DIR/
  - npm install jpm -g
script:
  - jpm test

You can see this in action with a little project of mine over at Travis.

Leave a Reply

Your email address will not be published.