Skip to content

Commit 80fadee

Browse files
committed
Enable scoverage in github actions and add coveralls plus badge
1 parent 45cf4ee commit 80fadee

File tree

4 files changed

+25
-1
lines changed

4 files changed

+25
-1
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,10 @@ jobs:
5252
run: sbt ++${{ matrix.scala }} githubWorkflowCheck
5353

5454
- name: Build project
55-
run: sbt ++${{ matrix.scala }} test
55+
run: sbt ++${{ matrix.scala }} clean coverage test
56+
57+
- name: Upload coverage data to Coveralls
58+
env:
59+
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
COVERALLS_FLAG_NAME: Scala ${{ matrix.scala }}
61+
run: sbt ++${{ matrix.scala }} coverageReport coverageAggregate coveralls

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# decline
22

33
[![Build Status](https://travis-ci.org/bkirwi/decline.svg?branch=master)](https://travis-ci.org/bkirwi/decline)
4+
[![Coverage Status](https://coveralls.io/repos/github/bkirwi/decline/badge.svg?branch=master)](https://coveralls.io/github/bkirwi/decline?branch=master)
45

56
A composable command-line parser, inspired by [`optparse-applicative`][optparse]
67
and built on [`cats`][cats].

build.sbt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,24 @@ lazy val Scala3 = "3.0.1"
1212

1313
ThisBuild / scalaVersion := Scala212
1414
ThisBuild / crossScalaVersions := List(Scala212, Scala213, Scala3)
15+
ThisBuild / githubWorkflowBuild := Seq(
16+
WorkflowStep.Sbt(List("clean", "coverage", "test"), name = Some("Build project"))
17+
)
18+
ThisBuild / githubWorkflowBuildPostamble ++= Seq(
19+
// See https://github.com/scoverage/sbt-coveralls#github-actions-integration
20+
WorkflowStep.Sbt(
21+
List("coverageReport", "coverageAggregate", "coveralls"),
22+
name = Some("Upload coverage data to Coveralls"),
23+
env = Map(
24+
"COVERALLS_REPO_TOKEN" -> "${{ secrets.GITHUB_TOKEN }}",
25+
"COVERALLS_FLAG_NAME" -> "Scala ${{ matrix.scala }}"
26+
)
27+
)
28+
)
1529
ThisBuild / githubWorkflowArtifactUpload := false
1630
ThisBuild / githubWorkflowPublishTargetBranches := Seq()
31+
// This is causing problems with env variables being passed in, see
32+
// https://github.com/sbt/sbt/issues/6468
1733
ThisBuild / githubWorkflowUseSbtThinClient := false
1834

1935
val defaultSettings = Seq(

project/plugins.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.1")
88
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.2.21")
99
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.3")
1010
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.8.2")
11+
addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.3.1")
1112
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.7")
1213
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.0")

0 commit comments

Comments
 (0)