Skip to content

Automatic Build Testing

mucaho edited this page Apr 14, 2017 · 3 revisions

GitHub repositories support automatic build testing with the help of the continuous integration (CI) servers Travis and AppVeyor.

What are those CI servers?

Both CI servers are hooked into a repository as a service. Every time a new commit is made to the repository, they can automatically build the project and run any tests that are specified. Travis & AppVeyor also have a central database where the service logs if the latest build of the repository passes the tests or not.

What is the difference between those two? Why do we need both?

They test on different platforms. Travis builds the project and runs tests on linux and MacOSX. AppVeyor does the same on Windows. Having both enabled means that everybody can run and contribute to Crafty, no matter which platform (s)he codes on.
Note that Crafty currently isn't tested on OSX, because the appropriate environment takes a long time to boot.

How does this happen exactly?

The CI server runs the command npm test from the root of the repository. The npm test script is defined in the package.json file, which in turn runs grunt check. See Building for more info on what grunt check does.

How can I, as a contributor, benefit from automatic build testing?

You can enable Travis & Appveyor for your fork of Crafty's repository. Each time you make a commit to your fork, the servers will test if your code passes all tests.
Additionally, when you submit a pull request to the original Crafty repository, each CI server will append a status message to your pull request. This status message will indicate whether your commits passed the tests or not. The developers can then go ahead and merge your pull request, without fearing that your contribution may break the code.

How do I enable Travis CI for my fork?

Follow Step 1 and Step 2. You can skip the rest of the steps, as the required .travis.yml file is already included in Crafty's repository.

How do I enable AppVeyor for my fork?

Follow Step 1 and Step 2. You can skip the rest of the steps, as the required appveyor.yml file is already included in Crafty's repository. However, make sure to add your project in the CI interface, by going to https://ci.appveyor.com, logging in and adding Crafty via the "Add repository" button.

Do I need to test every commit on those CI servers?

If you just make little changes to your code (e.g. you update the readme) and you do not want the CI servers to automatically test your commit, you can skip a CI build by including a [ci skip] or [skip ci] line in your commit message.
See skipping a Travis build.
See skipping an AppVeyor build.