GithubHelp home page GithubHelp logo

simacan / sbt-coveralls Goto Github PK

View Code? Open in Web Editor NEW

This project forked from scoverage/sbt-coveralls

0.0 7.0 0.0 191 KB

Sbt plugin for uploading Scala code coverage to coveralls

Home Page: https://coveralls.io

License: Other

Scala 100.00%
core

sbt-coveralls's Introduction

sbt-coveralls

Join the chat at https://gitter.im/scoverage/sbt-coveralls

SBT plugin that uploads scala code coverage to https://coveralls.io and integrates with Travis CI. This plugin uses scoverage to generate the code coverage metrics.

For an example project that uses this plugin click here. For example output click here

Installation

  1. Add the following to your project/build.sbt file
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.3.5")

addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.1.0")
  1. Setup coveralls configuration options (such as Specifying Your Repo Token)

  2. Register on https://coveralls.io/

  3. Follow the instructions for either Travis CI or Manual Usage

Travis CI Integration

sbt-coveralls can be run by Travis CI by following these instructions:

  1. Add the following to you travis.yml

    script: "sbt clean coverage test" after_success: "sbt coverageReport coveralls"

If you have a multi-module project, perform coverageAggregate as a separate command

script:
  - sbt clean coverage test coverageReport &&
    sbt coverageAggregate
after_success:
  - sbt coveralls
  1. Job done! Commit these changes to travis.yml to kick off your Travis build and you should see coverage reports appear on https://coveralls.io/

Manual Usage

  1. Get the repo token for your repo from http://coveralls.io

  2. Let sbt-coveralls know what your coveralls repo token is. See Specifying Your Repo Token

  3. In the SBT console, run coverage then your tests finishing with coveralls. After running the command, you should see output similar to the following:

    Uploading to coveralls.io succeeded: Job #17.1 https://coveralls.io/jobs/12207

For example output click here

Play Framework Integration

There is an issue with the latest version of sbt-coveralls and Play projects created using the default templates on 2.4.x. In order to work around this, we suggest you use the following versions of sbt-coverage/sbt-coveralls in your plugins.sbt

resolvers += Classpaths.sbtPluginReleases

addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.0.1")

addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.0.0")

Specifying Your Repo Token

There are several ways to tell sbt-coveralls your repo token to support different use cases:

Write your repo token into a file

Add the following to your build.sbt. The path can be absolute and point to somewhere outside the project or relative and point somewhere inside the project (such as src/main/resources/token.txt).

Just remember: Do not store repo tokens inside your project if it is in a public git repository!

import org.scoverage.coveralls.Imports.CoverallsKeys._

coverallsTokenFile := "/path/to/my/repo/token.txt"

Put your repo token directly in your build.sbt

Do not store repo tokens inside your project if it is in a public git repository!

import org.scoverage.coveralls.Imports.CoverallsKeys._

coverallsToken := Some("my-token")

Add an environment variable

Add an environment variable COVERALLS_REPO_TOKEN, for example:

export COVERALLS_REPO_TOKEN=my-token

Specifying Your Coveralls Endpoint

If you're using https://coveralls.io as your endpoint, then you don't need to set this option. If you're using a hosted (enterprise) instance of coveralls, you will need to specify your endpoint in one of two ways.

Put your endpoint directly in your build.sbt

import org.scoverage.coveralls.Imports.CoverallsKeys._

coverallsEndpoint := Some("http://my-instance.com")

Add an environment variable

Add an environment variable COVERALLS_ENDPOINT, for example:

export COVERALLS_ENDPOINT=http://my-instance.com

Custom Source File Encoding

By default sbt-coveralls assumes your source files are UTF-8 encoded. To use a different encoding, add the following to your build.sbt

import org.scoverage.coveralls.Imports.CoverallsKeys._

encoding := "ISO-8859-1"

Once the plugin has slurped your source code into memory using the specified encoding, it will be converted into UTF-8 to be sent to the coveralls API. This is because the coveralls API uses a JSON request body and RFC 4627 mandates that JSON must be UTF encoded.

Using Travis-Pro

It is important to set the correct service_name when using Travis-Pro. The default is to use travis-ci. To override this value, add the following to your build.sbt

import org.scoverage.coveralls.Imports.CoverallsKeys._

coverallsServiceName := Some("travis-pro")

License

sbt-coveralls is open source software released under the Apache 2 License.

sbt-coveralls's People

Contributors

sksamuel avatar theon avatar rorygraves avatar fommil avatar gslowikowski avatar le-doude avatar andrewwhitaker avatar pjan avatar levkhomich avatar nightkr avatar vil1 avatar migmruiz avatar earldouglas avatar nh13 avatar outsideris avatar salanki avatar philwills avatar radoburansky avatar readmecritic avatar 0xroch avatar ruippeixotog avatar gitter-badger avatar sadikovi avatar mkokho avatar kshakir avatar tkawachi avatar jsolmon avatar jprevost avatar jedesah avatar iref avatar

Watchers

Nick Bosland avatar James Cloos avatar Edwin de Jong avatar Adriaan avatar  avatar Jeroen Soesbergen avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.