Skip to content

Commit

Permalink
Add support for CircleCI (#272)
Browse files Browse the repository at this point in the history
* Add support for CircleCI

* Update README.md
  • Loading branch information
notxcain authored Aug 10, 2023
1 parent 5a6db39 commit 8222f4b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,26 @@ Travis build and you should see coverage reports appear on [coveralls][].
2) Job done! Commit these changes to kick off your GitHub Actions
build and you should see coverage reports appear on [coveralls][].

## CircleCI Integration

Enable CircleCI support in your `build.sbt`:

```scala
import org.scoverage.coveralls.Imports.CoverallsKeys._
import org.scoverage.coveralls.CircleCI
coverallsService := Some(CircleCI)
```

Add the following step to your `config.yml` right after your test step:

```yaml
- run:
name: Generate and upload coverage report
when: always
command: sbt ";coverageReport ;coverageAggregate ;coveralls"
```

## Manual Usage

1) Get the repo token for your repo from [coveralls][].
Expand Down
7 changes: 7 additions & 0 deletions src/main/scala/org/scoverage/coveralls/CIService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,10 @@ case object GitHubActions extends CIService {
}
}
}

object CircleCI extends CIService {
def name: String = "circleci"
def jobId: Option[String] = sys.env.get("CIRCLE_BUILD_NUM")
def pullRequest: Option[String] = sys.env.get("CIRCLE_PULL_REQUEST").map(_.split("/").last)
def currentBranch: Option[String] = sys.env.get("CIRCLE_BRANCH")
}

0 comments on commit 8222f4b

Please sign in to comment.