Skip to content

Commit

Permalink
Setup Mima (#3129)
Browse files Browse the repository at this point in the history
  • Loading branch information
987Nabil authored Sep 12, 2024
1 parent 8c70090 commit fb97316
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 1 deletion.
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,31 @@ jobs:
steps:
- uses: release-drafter/release-drafter@v5

mima_check:
name: Mima Check
if: ${{ github.event_name == 'pull_request' }}
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.10]
java: [temurin@21]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Java (temurin@21)
if: matrix.java == 'temurin@21'
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: sbt

- run: sbt mimaChecks

unsafeRunScoverage:
name: Unsafe Scoverage
strategy:
Expand Down
4 changes: 3 additions & 1 deletion aliases.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ addCommandAlias("fmtCheck", "scalafmtCheck; Test / scalafmtCheck; sFixCheck")
addCommandAlias("sFix", "scalafix OrganizeImports; Test / scalafix OrganizeImports")
addCommandAlias("sFixCheck", "scalafix --check OrganizeImports; Test / scalafix --check OrganizeImports")
addCommandAlias("generateMediaTypes", "zioHttpTools/runMain zio.http.tools.GenerateMediaTypes")
addCommandAlias("mimaChecks", "zioHttpJVM/mimaReportBinaryIssues; zioHttpHtmx/mimaReportBinaryIssues"
)

onLoadMessage := {
import scala.Console._
import scala.Console.*

def header(text: String): String = s"${RED}$text${RESET}"
def item(text: String): String = s"${GREEN}> ${CYAN}$text${RESET}"
Expand Down
9 changes: 9 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ ThisBuild / githubWorkflowAddedJobs :=
steps = List(WorkflowStep.Use(UseRef.Public("release-drafter", "release-drafter", s"v${releaseDrafterVersion}"))),
cond = Option("${{ github.base_ref == 'main' }}"),
),
WorkflowJob(
id = "mima_check",
name = "Mima Check",
steps = WorkflowStep.CheckoutFull +: WorkflowStep.SetupJava(List(JavaSpec.temurin("21"))) :+ WorkflowStep.Sbt(List("mimaChecks")),
cond = Option("${{ github.event_name == 'pull_request' }}"),
javas = List(JavaSpec.temurin("21")),
),
) ++ ScoverageWorkFlow(50, 60) ++ JmhBenchmarkWorkflow(1) ++ BenchmarkWorkFlow()

ThisBuild / githubWorkflowTargetTags ++= Seq("v*")
Expand Down Expand Up @@ -176,6 +183,7 @@ lazy val zioHttp = crossProject(JSPlatform, JVMPlatform)
},
libraryDependencies ++= netty ++ Seq(`netty-incubator`),
)
.jvmSettings(MimaSettings.mimaSettings(failOnProblem = true))
.jsSettings(
ThisProject / fork := false,
testFrameworks := Seq(new TestFramework("zio.test.sbt.ZTestFramework")),
Expand Down Expand Up @@ -274,6 +282,7 @@ lazy val zioHttpHtmx = (project in file("zio-http-htmx"))
),
)
.dependsOn(zioHttpJVM)
.settings(MimaSettings.mimaSettings(failOnProblem = true))

lazy val zioHttpExample = (project in file("zio-http-example"))
.settings(stdSettings("zio-http-example"))
Expand Down
18 changes: 18 additions & 0 deletions project/MimaSettings.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import com.typesafe.tools.mima.core.*
import com.typesafe.tools.mima.core.ProblemFilters.*
import com.typesafe.tools.mima.plugin.MimaKeys.*
import sbt.{Def, *}
import sbt.Keys.{name, organization}
import sbtdynver.DynVerPlugin.autoImport.*

object MimaSettings {
def mimaSettings(failOnProblem: Boolean): Seq[Def.Setting[?]] =
Seq(
mimaPreviousArtifacts ++= previousStableVersion.value.map(organization.value %% name.value % _).toSet,
mimaBinaryIssueFilters ++= Seq(
exclude[Problem]("zio.http.internal.*"),
exclude[Problem]("zio.http.codec.internal.*"),
),
mimaFailOnProblem := failOnProblem
)
}
1 change: 1 addition & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2")
addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.7")
addSbtPlugin("com.thesamet" % "sbt-protoc-gen-project" % "0.1.8")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.4")

addSbtPlugin("org.jetbrains.scala" % "sbt-ide-settings" % "1.1.2")

Expand Down

0 comments on commit fb97316

Please sign in to comment.