Skip to content

Commit

Permalink
Add mima checks
Browse files Browse the repository at this point in the history
  • Loading branch information
geirolz committed Jan 8, 2024
1 parent 188d068 commit 18ab433
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 11 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ jobs:
include:
- scala: 2.13.12
name: Scala2_13
test-tasks: coverage test coverageReport gen-doc
- scala: 3.3.0
test-tasks: coverage test coverageReport gen-doc mimaCheck
- scala: 3.3.1
name: Scala3_3
test-tasks: coverage test coverageReport
test-tasks: coverage test coverageReport mimaCheck

steps:
- uses: actions/checkout@v4
Expand Down
36 changes: 28 additions & 8 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ lazy val scala33 = "3.3.1"
lazy val supportedScalaVersions = List(scala213, scala33)

//## global project to no publish ##
lazy val fly4s: Project = project
lazy val root: Project = project
.in(file("."))
.settings(
inThisBuild(
Expand All @@ -25,8 +25,7 @@ lazy val fly4s: Project = project
"[email protected]",
url("https://github.com/geirolz")
)
),
mimaPreviousArtifacts := Set(prjOrg %% prjName % "1.0.0")
)
)
)
)
Expand All @@ -39,8 +38,9 @@ lazy val fly4s: Project = project

lazy val core: Project =
module("core")(
folder = "./core",
publishAs = Some(prjName)
folder = "./core",
publishAs = Some(prjName),
mimaCompatibleWith = Set("1.0.0")
).settings(
libraryDependencies ++= {
CrossVersion.partialVersion(Keys.scalaVersion.value) match {
Expand All @@ -51,7 +51,11 @@ lazy val core: Project =
)

//=============================== MODULES UTILS ===============================
def module(modName: String)(folder: String, publishAs: Option[String] = None): Project = {
def module(modName: String)(
folder: String,
publishAs: Option[String] = None,
mimaCompatibleWith: Set[String] = Set.empty
): Project = {
val keys = modName.split("-")
val modDocName = keys.mkString(" ")
val docNameStr = s"$prjName $modDocName"
Expand All @@ -64,6 +68,13 @@ def module(modName: String)(folder: String, publishAs: Option[String] = None): P
)
case None => noPublishSettings
}

val mimaSettings = Seq(
mimaPreviousArtifacts := mimaCompatibleWith.map { version =>
organization.value % s"${moduleName.value}_${scalaBinaryVersion.value}" % version
}
)

Project(modName, file(folder))
.settings(
name := s"$prjName $modDocName",
Expand All @@ -77,9 +88,11 @@ def module(modName: String)(folder: String, publishAs: Option[String] = None): P
"MODULE_NAME" -> moduleName.value,
"VERSION" -> previousStableVersion.value.getOrElse("<version>")
),
mimaSettings,
publishSettings,
baseSettings
).enablePlugins(ModuleMdocPlugin)
)
.enablePlugins(ModuleMdocPlugin)
}

def subProjectName(modPublishName: String): String = s"$prjName-$modPublishName"
Expand Down Expand Up @@ -182,5 +195,12 @@ addCommandAlias(
"gen-doc",
List(
core
).map(prj => s"project ${prj.id}-docs; mdoc").mkString(";") + s";project $prjName;"
).map(prj => s"project ${prj.id}-docs; mdoc").mkString(";") + s";project root;"
)
addCommandAlias(
"mimaCheck",
List(
core
).map(prj => s"project ${prj.id}; mimaReportBinaryIssues")
.mkString(";") + s";project root;"
)

0 comments on commit 18ab433

Please sign in to comment.