Coveralls is a hosted analysis tool, providing statistics about your code coverage.
Configuring your Travis CI build to send results to Coveralls always follows the same pattern:
- Add your repository to Coveralls.
- Configure your build to install the Coveralls library for the programming language you’re using.
- Add Coveralls to your test suite.
- If you’re using Travis CI for private repos, add
service_name: travis-proto your
We’ll show you how to do this for Ruby in the following example.
Using Coveralls with Ruby #
Using Coveralls with Ruby on Travis CI is one of the configurations Coveralls support out of the box have documentation for.
1. Add your repository to Coveralls #
- Sign in to Coveralls with your GitHub account.
- Click ADD REPOS in the menu.
- Click the button next to your repository.
2. Install the Coveralls Gem #
Add the Coveralls Gem to your
# ./Gemfile gem 'coveralls', require: false
You might need to update your
Gemfile.lock as well.
3. Add Coveralls to your test suite #
Add Coveralls to the top your test suite, before you
require any application code:
# ./spec/spec_helper.rb # ./test/test_helper.rb # ..etc.. require 'coveralls' Coveralls.wear!
After those three steps, the next time you push a commit, you’ll be able to look up your code coverage statistics!
Coveralls and private repositories #
If you’re using Coveralls with Travis CI for private repositories, edit
Using Coveralls with other languages #
Coveralls have documentation for many other programming languages:
- C / C++
- Objective C
- Ruby / Rails
Using Coveralls with Docker builds #
If you’re using Docker in builds, ensure that the necessary environment variables are exposed to the container:
docker exec -e TRAVIS_JOB_ID="$TRAVIS_JOB_ID" -e TRAVIS_BRANCH="$TRAVIS_BRANCH" ...