Here I outline the steps to take to enable continuous integration for Scala projects, including GitHub push-triggered building and testing, code test coverage, stats tracking, reporting, and badging.
First, enable basic continuous integration through Travis CI.
Under your travis-ci.org profile, find your project and enable it:
Create a .travis.yml file in the root of your project:
language: scala scala: - 2.11.2
This gives you GitHub push-triggered builds (which run via
sbt test) of your project, plus a sweet status badge.
Next, add code coverage support to your project with sbt-scoverage.
Import the sbt-scoverage plugin in your project configuration:
addSbtPlugin("org.scoverage" %% "sbt-scoverage" % "0.99.7.1")
Enable the sbt-scoverage plugin in your build configuration:
You can now run
sbt scoverage:test from to get nice code coverage reports.
Now that you have triggered builds and code coverage, you can integrate with Coveralls to get integrated code coverage history and stats.
Head to the add repo section of Coveralls, find your project, and enable it:
script: "sbt coveralls" to your Travis CI configuration file:
language: scala scala: - 2.10.3 script: "sbt coveralls"
Import the sbt-coveralls plugin in your project configuration:
addSbtPlugin("com.sksamuel.scoverage" %% "sbt-coveralls" % "0.0.5")
Enable the sbt-coveralls plugin in your build configuration:
This gives you coverage integration, plus a second status badge.