This is out-of-date. Now, we recommend using GitHub Actions for this task. See guide.
Following on from Beginner’s Guide to Creating Discourse Plugins Part 6: Acceptance Tests
To set up continuous integration for your plugin, you can use our discourse-plugin-ci
repository. This will run the Discourse core linters (prettify, eslint & rubocop), your plugin’s Rspec tests, and your plugin’s Qunit tests.
For an example, check out discourse-chat-integration
Setting it up
- Copy & paste
.travis.yml
from here to the root directory of your plugin’s repository. - Copy & paste
.rubocop.yml
from here to 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
Cron Job
To make sure that new discourse releases don’t break your plugin, you can try setting up Travis’s CRON to run the tests every day, regardless of whether you’ve changed the plugin. My setup looks like this:
Additional Docker arguments
Do you need to supply additional arguments to the Docker container? You can use the DOCKER_OPTIONS
environment variable for that.
For example, if your plugin depends on another plugin, clone it and export the environment variable in .travis.yml
.
before_script:
- git clone --depth=1 https://github.com/discourse/discourse-plugin-ci
- git clone --depth=1 <git_clone_url> $HOME/plugins/<additional_plugin_name>
script:
- export DOCKER_OPTIONS="-v ${HOME}/plugins/<additional_plugin_name>:/var/www/discourse/plugins/<additional_plugin_name>"
- discourse-plugin-ci/script.sh