Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for CircleCI #272

Merged
merged 2 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -70,3 +70,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")
}