Skip to content

Commit 8222f4b

Browse files
authored
Add support for CircleCI (#272)
* Add support for CircleCI * Update README.md
1 parent 5a6db39 commit 8222f4b

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,26 @@ Travis build and you should see coverage reports appear on [coveralls][].
107107
2) Job done! Commit these changes to kick off your GitHub Actions
108108
build and you should see coverage reports appear on [coveralls][].
109109

110+
## CircleCI Integration
111+
112+
Enable CircleCI support in your `build.sbt`:
113+
114+
```scala
115+
import org.scoverage.coveralls.Imports.CoverallsKeys._
116+
import org.scoverage.coveralls.CircleCI
117+
118+
coverallsService := Some(CircleCI)
119+
```
120+
121+
Add the following step to your `config.yml` right after your test step:
122+
123+
```yaml
124+
- run:
125+
name: Generate and upload coverage report
126+
when: always
127+
command: sbt ";coverageReport ;coverageAggregate ;coveralls"
128+
```
129+
110130
## Manual Usage
111131

112132
1) Get the repo token for your repo from [coveralls][].

src/main/scala/org/scoverage/coveralls/CIService.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,10 @@ case object GitHubActions extends CIService {
9494
}
9595
}
9696
}
97+
98+
object CircleCI extends CIService {
99+
def name: String = "circleci"
100+
def jobId: Option[String] = sys.env.get("CIRCLE_BUILD_NUM")
101+
def pullRequest: Option[String] = sys.env.get("CIRCLE_PULL_REQUEST").map(_.split("/").last)
102+
def currentBranch: Option[String] = sys.env.get("CIRCLE_BRANCH")
103+
}

0 commit comments

Comments
 (0)