alejandrohdezma / sbt-codecov

SBT plugin for uploading Scala code coverage to Codecov

GitHub

SBT plugin for uploading Scala code coverage to Codecov

Companion plugin to sbt-scoverage to automatically upload coverage reports to Codecov after successfully running all test configurations.

The plugin adds the following tasks/commands/settings:

Key Type Description Scope
codecovProcess Setting This setting contains the process that should be executed in order to upload coverage data to Codecov. Defaults to bash <(curl -s https://codecov.io/bash) -Z. ThisBuild
codecovUpload Task This task uploads coverage data to Codecov using the process setting codecovProcess. ThisBuild
retrieveCoverage Task Task used to generate coverage report. Defaults to sbt-scoverage's coverageAggregate. Project
testCovered Command This command runs the test task with cross-building in all the configurations that enable it while recovering coverage data from them. After a successful execution, uploads the coverage data to Codecov using the codecovUpload task. Project

If for any reason you still want to use testCovered but avoid uploading coverage to Codecov, you can pass the system property skip.coverage set to true. Example:

sbt testCovered -Dskip.coverage=true

Example

Given an SBT build that enables the IntegrationTest configuration... running sbt testCovered command will execute the following:

set coverageEnabled in ThisBuild := true
+test
+it:test 
coverageAggregate
url("https://codecov.io/bash").cat #| "bash /dev/stdin -Z" !
set coverageEnabled in ThisBuild := false

Installation

Add the following line to your plugins.sbt file:

addSbtPlugin("com.alejandrohdezma" % "sbt-codecov" % "0.2.0")

Note: sbt-scoverage must be provided in the SBT build in order for this plugin to work.