Skip to content

Commit 377a052

Browse files
committed
Add mima and sbt coveralls
1 parent 7979690 commit 377a052

File tree

4 files changed

+39
-5
lines changed

4 files changed

+39
-5
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,14 @@ jobs:
5151
- name: Check that workflows are up to date
5252
run: sbt ++${{ matrix.scala }} githubWorkflowCheck
5353

54+
- name: Report binary compatibility issues
55+
run: sbt ++${{ matrix.scala }} mimaReportBinaryIssues
56+
5457
- name: Build project
55-
run: sbt ++${{ matrix.scala }} test
58+
run: sbt ++${{ matrix.scala }} clean coverage test
59+
60+
- name: Upload coverage data to Coveralls
61+
env:
62+
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
COVERALLS_FLAG_NAME: Scala ${{ matrix.scala }}
64+
run: sbt ++${{ matrix.scala }} coverageReport coverageAggregate coveralls

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[![Coverage Status](https://coveralls.io/repos/github/mdedetrich/webmodels/badge.svg?branch=master)](https://coveralls.io/github/mdedetrich/webmodels?branch=master)
2+
13
## Webmodels
24

35
Webmodels is a scala library with a collection of Scala models/constants that are relevant to modern HTTP programming.

build.sbt

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ val flagsFor13 = Seq(
2222
"-opt:l:method"
2323
)
2424

25-
ThisBuild / crossScalaVersions := Seq(currentScalaVersion, scala213Version)
26-
ThisBuild / scalaVersion := (ThisBuild / crossScalaVersions).value.last
25+
ThisBuild / crossScalaVersions := Seq(currentScalaVersion, scala213Version)
26+
ThisBuild / scalaVersion := (ThisBuild / crossScalaVersions).value.last
27+
ThisBuild / mimaFailOnNoPrevious := false // Set this to true when we start caring about binary compatibility
2728

2829
ThisBuild / Test / scalacOptions += "-Yrangepos"
2930

@@ -86,6 +87,25 @@ lazy val webmodels = crossProject(JSPlatform, JVMPlatform)
8687
lazy val webmodelsJVM = webmodels.jvm
8788
lazy val webmodelsJS = webmodels.js
8889

89-
ThisBuild / githubWorkflowPublishTargetBranches := Seq()
90-
// This is set to false due to https://github.com/sbt/sbt/issues/6468
90+
ThisBuild / githubWorkflowBuild := Seq(
91+
WorkflowStep.Sbt(List("mimaReportBinaryIssues"), name = Some("Report binary compatibility issues")),
92+
WorkflowStep.Sbt(List("clean", "coverage", "test"), name = Some("Build project"))
93+
)
94+
95+
ThisBuild / githubWorkflowBuildPostamble ++= Seq(
96+
// See https://github.com/scoverage/sbt-coveralls#github-actions-integration
97+
WorkflowStep.Sbt(
98+
List("coverageReport", "coverageAggregate", "coveralls"),
99+
name = Some("Upload coverage data to Coveralls"),
100+
env = Map(
101+
"COVERALLS_REPO_TOKEN" -> "${{ secrets.GITHUB_TOKEN }}",
102+
"COVERALLS_FLAG_NAME" -> "Scala ${{ matrix.scala }}"
103+
)
104+
)
105+
)
106+
107+
// This is causing problems with env variables being passed in, see
108+
// https://github.com/sbt/sbt/issues/6468
91109
ThisBuild / githubWorkflowUseSbtThinClient := false
110+
111+
ThisBuild / githubWorkflowPublishTargetBranches := Seq()

project/plugins.sbt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.6.0")
22
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0")
33
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2")
4+
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.8.2")
5+
addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.3.1")
6+
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.9.2")
47
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2")
58
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.7")
69
addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.12.0")

0 commit comments

Comments
 (0)