Following on from Beginner’s Guide to Creating Discourse Plugins Part 6: Acceptance Tests and some brief mention here and here
I’ve got a travis setup working which pulls the latest version of Discourse, ‘installs’ the plugin, and runs all the tests. It does this using the discourse_test docker image, so the environment should match up almost exactly with production systems. Any changes to dependencies, including things like ruby/postgres versions should happen seamlessly as the team rebuild the docker image.
Setting it up
- Download this gist, and commit it as
.travis.ymlin the root directory of your plugin’s repository.
- Head over to http://travis-ci.org, and sign up with your GitHub account
- Once you’re signed in, go to your profile page and enable builds for your plugin
- And that’s it! Every time you make a commit or a PR, tests will be run against the tests-passed version
To make sure that new discourse releases don’t break your plugin, you can try setting up Travis’s CRON beta to run the tests every day, regardless of whether you’ve changed the plugin. My setup looks like this:
All available environment variables are listed at the top of docker.rake: