-
Notifications
You must be signed in to change notification settings - Fork 307
Travis CI integration
Test Stack is designed to easily integrate with the Travis CI continuous integration service. In order to enable Travis CI for your project, you must first create a .travis.yml
in your repository root that will load and execute Test Stack. For a typical project using Sauce Labs, it should look like this:
language: node_js
node_js:
- 0.8
env:
global:
# Sauce Labs are OK with this and it is currently necessary to expose this information for testing pull requests;
# please get your own free key if you want to test yourself
- SAUCE_USERNAME: username
- SAUCE_ACCESS_KEY: access-key
install:
- git submodule update --init --recursive
- git clone --recursive https://github.com/csnover/dojo2-teststack.git ../teststack
- cd ../teststack
- npm install --production
script: node runner.js config=my-package/test/teststack
If you are not OK exposing your Sauce Labs username and access key, you may use secure environment variables to encrypt them (travis encrypt "SAUCE_USERNAME=username SAUCE_ACCESS_KEY=access-key"
). However, this will mean that pull requests are no longer tested.
Once you have a Travis configuration, you just need to actually start the thing:
- Go to https://travis-ci.org/
- Click “Sign in with GitHub” at the top-right
- Allow Travis CI to access your GitHub account
- Go to https://travis-ci.org/profile
- Click “Sync now”, if necessary, to list all your GitHub projects
- Click the “Profile” tab
- Copy the “Token” value to your clipboard
- Click the “Repositories” tab
- Click the on/off switch next to the repository you want to test
- Click the wrench icon next to the repository you want to test
- Find Travis in the list of services and click it
- Paste the token from your clipboard to the Token field
- Click “Save changes”
- Click “Test Hook”
If the test hook was successful (it may take several minutes for the test hook to trigger a build), you will be able to watch Test Stack happily execute all your tests directly from the Travis CI Web site. Any time you make a new commit, or a new pull request is issued, Travis will automatically re-run your test suite. Simple!