File tree Expand file tree Collapse file tree 5 files changed +55
-7
lines changed
main/scala/com/github/sbt/jacoco/coveralls Expand file tree Collapse file tree 5 files changed +55
-7
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ object CoverallsClient {
2222 private val jobsUrl = " https://coveralls.io/api/v1/jobs"
2323
2424 def sendReport (reportFile : File , streams : TaskStreams ): Unit = {
25+ streams.log.info(" Uploading coverage to coveralls.io..." )
2526 val response = Http (jobsUrl)
2627 .postMulti(
2728 MultiPart (
Original file line number Diff line number Diff line change @@ -33,16 +33,14 @@ object JacocoCoverallsPlugin extends BaseJacocoPlugin {
3333 val jacocoCoverallsBuildNumber : SettingKey [Option [String ]] = settingKey(" Build number to send to Coveralls" )
3434 val jacocoCoverallsJobId : SettingKey [String ] = settingKey(" Build job ID to send to Coveralls" )
3535 val jacocoCoverallsPullRequest : SettingKey [Option [String ]] = settingKey(" Pull request number to send to Coveralls" )
36- val jacocoCoverallsOutput : SettingKey [File ] = settingKey(" File to store Coveralls coverage" )
3736 val jacocoCoverallsRepoToken : SettingKey [Option [String ]] = settingKey(" Coveralls repo secret key" )
3837 }
3938
4039 import autoImport ._ // scalastyle:ignore import.grouping
4140
4241 override def projectSettings : Seq [Setting [_]] = Seq (
43- jacocoCoverallsOutput := jacocoReportDirectory.value,
4442 jacocoCoveralls := Def .task {
45- CoverallsClient .sendReport(jacocoCoverallsOutput .value / " coveralls.json" , streams.value)
43+ CoverallsClient .sendReport(jacocoReportDirectory .value / " coveralls.json" , streams.value)
4644 }.value,
4745 jacocoCoverallsGenerateReport := Def .taskDyn {
4846 if (jacocoCoverallsJobId.value.isEmpty) {
@@ -61,7 +59,7 @@ object JacocoCoverallsPlugin extends BaseJacocoPlugin {
6159 )
6260
6361 ReportUtils .generateReport(
64- jacocoCoverallsOutput .value,
62+ jacocoReportDirectory .value,
6563 jacocoDataFile.value,
6664 jacocoReportSettings.value.withFormats(coverallsFormat),
6765 coveredSources.value,
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ example project: [stringbean/sbt-jacoco-example](https://github.com/stringbean/s
55
66## Coveralls
77
8- Enable the Coveralls plugin:
8+ If you have a public project built with Travis-CI you will just need to enable the Coveralls plugin:
99
1010``` scala
1111enablePlugins(JacocoCoverallsPlugin )
@@ -14,10 +14,19 @@ enablePlugins(JacocoCoverallsPlugin)
1414Then run ` sbt jacocoCoveralls ` to upload the results to Coveralls:
1515
1616```
17+ [info] Uploading coverage to coveralls.io...
1718[info] Upload complete
1819```
1920
20- <!-- TODO extra config -->
21+ For private projects you will need to set a few more settings:
22+
23+ ``` scala
24+ jacocoCoverallsServiceName := " jenkins"
25+ jacocoCoverallsJobId := sys.env(" BUILD_ID" )
26+ jacocoCoverallsRepoToken := " <repo token on coveralls.io>"
27+ ```
28+
29+ More settings can found at @ref :[ Coveralls Plugin] ( settings.md#coveralls ) settings.
2130
2231## Codecov
2332
@@ -32,8 +41,9 @@ jacocoReportSettings := JacocoReportSettings(
3241 " utf-8" )
3342```
3443
35- With this enabled run the Codecov script:
44+ With this enabled run the Codecov script after JaCoCo :
3645
3746``` shell
47+ sbt jacoco
3848bash <( curl -s https://codecov.io/bash)
3949```
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ Key features of _sbt-jacoco_ include:
88* Coverage of Scala and Java code.
99* Aggregation of multi-project builds.
1010* Support for unit and @ref :[ integration] ( integration-tests.md ) tests.
11+ * @ref :[ Integrates] ( coverage-services.md ) with Coveralls and Codecov.
1112
1213@@@ index
1314
Original file line number Diff line number Diff line change @@ -138,6 +138,44 @@ JacocoReportSettings(
138138* ** Accepts:** ` Boolean `
139139* ** Default:** ` true `
140140
141+ ### Coveralls
142+
143+ These are only defined if the ` JacocoCoverallsPlugin ` is enabled.
144+
145+ #### jacocoCoverallsServiceName
146+
147+ * ** Description:** Name of the CI service running this build.
148+ * ** Accepts:** ` String `
149+ * ** Default:** ` travis-ci `
150+
151+ @@@ note
152+ If running on Travis Pro this should be set to ` travis-pro ` .
153+ @@@
154+
155+ #### jacocoCoverallsJobId
156+
157+ * ** Description:** Unique build identifier for this build
158+ * ** Accepts:** ` String `
159+ * ** Default:** ` TRAVIS_JOB_ID ` environment variable
160+
161+ #### jacocoCoverallsBuildNumber
162+
163+ * ** Description:** Human readable build number
164+ * ** Accepts:** ` Option[String] `
165+ * ** Default:** none (defaults to auto-incremented number)
166+
167+ #### jacocoCoverallsPullRequest
168+
169+ * ** Description:** ID of the current pull request that triggered the build.
170+ * ** Accepts:** ` Option[String] `
171+ * ** Default:** none
172+
173+ #### jacocoCoverallsRepoToken
174+
175+ * ** Description:** Coveralls repo secret key.
176+ * ** Accepts:** ` Option[String] `
177+ * ** Default:** none (auto detected for public repos)
178+
141179## Types
142180
143181All types are automatically imported in an ` .sbt ` based build file and can be imported into ` .scala ` based builds using:
You can’t perform that action at this time.
0 commit comments