/coveralls-gradle-plugin

:hatched_chick: gradle plugin for coveralls

Primary LanguageGroovyMIT LicenseMIT

coveralls-gradle-plugin v2.7.1

Build Status Coverage Status

Send coverage data to coveralls.io.

Usage

Use with cobertura reporter

Add the following lines to build.gradle:

plugins {
    id 'net.saliman.cobertura' version '2.3.1'
    id 'com.github.kt3k.coveralls' version '2.7.1'
}

cobertura.coverageFormats = ['html', 'xml'] // coveralls plugin depends on xml format report

And run coveralls task after cobertura task.

An example .travis.yml looks like following:

language: java

jdk:
- oraclejdk8

after_success:
- ./gradlew cobertura coveralls

For groovy projects, add the following line to build.gradle:

cobertura.coverageSourceDirs = sourceSets.main.groovy.srcDirs

Use with JaCoCo plugin

Add the following lines to build.gradle:

plugins {
    id 'jacoco'
    id 'com.github.kt3k.coveralls' version '2.6.3'
}

jacocoTestReport {
    reports {
        xml.enabled = true // coveralls plugin depends on xml format report
        html.enabled = true
    }
}

An example .travis.yml looks like following:

language: java

jdk:
- oraclejdk8

after_success:
- ./gradlew jacocoTestReport coveralls

Use with Travis-CI Pro & Coveralls Pro

When using Travis-CI Pro, you must provide your Coveralls Pro repo token in the COVERALLS_REPO_TOKEN environment variable in .travis.yml.

env:
  global:
    - COVERALLS_REPO_TOKEN=mySecRetRepoToken

You may also use a secure environment variable to hold COVERALLS_REPO_TOKEN by following the instructions on docs.travis-ci.com.

env:
  global:
    - secure: <encrypted string here>

Use with mutli-project build

This plugin only handles one project per build. You need to merge coverage report before coveralls plugin take it.

See example: https://github.com/ben-manes/caffeine/blob/master/build.gradle

Configuring coveralls "task"

If you configure coveralls "task" (not the extension object), you need to write as the following:

tasks.coveralls {
  dependsOn 'check'
}

CI Services

The following CI services should automatically work:

If you need to customize something or support a different CI service, you can configure environment variables:

  • CI_NAME
  • CI_BUILD_NUMBER
  • CI_BUILD_URL
  • CI_BRANCH
  • CI_PULL_REQUEST
  • COVERALLS_REPO_TOKEN

Supported CI names

  • Travis-CI: travis-ci
  • Travis-Pro: travis-pro
  • CircleCI: circleci
  • Jenkins: jenkins
  • Snap CI: snapci
  • Bitrise CI: bitrise

If you have COVERALLS_REPO_TOKEN set and you're using Travis-CI not Travis-Pro, you need to set CI_NAME=travis-ci.

HTTPS proxy settings

You can set https proxy if needed. Environment variables to configure:

  • https.proxyHost
  • https.proxyPort (default value is 443)

Examples

License

MIT License ( Yoshiya Hinosawa )

Note

  • The ID of the plugin has been changed from coveralls to com.github.kt3k.coveralls according to the guidelines of gradle plugin. Please see the examples below for details. (2014/07/21)

See also

  • https://codecov.io/
    • An alternative web service to coveralls.
      • Better API design, which accepts any of major formats.
      • Nice browser extensions - You can see coverage information in GitHub UI.

Release History

  • 2016-11-14 v2.7.1 Recover Java 7 support. (v2.7.0 doesn't work with Java 8)
  • 2016-11-11 v2.7.0 Added HTTPS proxy settings. (#67)
  • 2016-01-29 v2.6.3 Recover Java 7 support. (v2.6.0 and v2.6.1 don't work with Java 8)
  • 2016-01-29 v2.6.3 Recover Java 7 support. (v2.6.0 and v2.6.1 don't work with Java 8)
  • 2016-01-29 v2.6.1 Improved CircleCI support. (#52)
  • 2016-01-22 v2.6.0 Improved CircleCI support. (#51)
  • 2016-01-18 v2.5.0 Added Bitrise CI support. (#50)
  • 2015-05-10 v2.4.0 Improved Travis CI support. (#40)
  • 2015-02-10 v2.3.1 Improved Snap CI support. (#36)
  • 2015-02-10 v2.3.0 Snap CI support. (#35)
  • 2015-02-08 v2.2.0 JenkinsCI support. (#33)
  • 2015-01-05 v2.1.0 CircleCI support. (#31)
  • 2014-10-05 v2.0.1 Compatibility with gradle-android-plugin 0.13.x. ([#25](https://github.com/kt3k/coveralls-gra dle-plugin/pull/25))
  • 2014-08-01 v2.0.0 More CI services support. Improvements. (#21)
  • 2014-07-21 v1.0.2 Plugin ID changed. coveralls -> com.github.kt3k.coveralls (#19)
  • 2014-07-06 v0.6.1 XML parser behaviours fixed. (#18)
  • 2014-07-02 v0.6.0 Multiple project support for JaCoCo. (#13)
  • 2014-06-26 v0.5.0 Android plugin support. (#17)
  • 2014-06-21 v0.4.1 XML parser settings fixed. (#16)
  • 2014-03-15 v0.3.1 HttpBuilder upgraded to v0.7.1. (#8)
  • 2014-03-11 v0.3.0 Coverage report path became configurable. (#7)
  • 2014-02-19 v0.2.5 Travis Pro support. (#4)
  • 2014-01-21 v0.2.4 Ignore absent source files. (#3)
  • 2013-12-09 v0.2.1 JaCoCo support. (#2)
  • 2013-11-02 v0.1.6 Available at Maven Central.
  • 2013-10-27 v0.1.5 Multiple <source> tag support. (#1)
  • 2013-10-08 v0.1.3 First usable version.