From cd280dc471e861a3ad2eb8e75152eec24b3f6ae9 Mon Sep 17 00:00:00 2001 From: Andriy Plokhotnyuk Date: Mon, 13 Jan 2025 18:37:11 +0100 Subject: [PATCH] Add MiMa binary compatibility checks --- .github/workflows/ci.yml | 2 ++ build.sbt | 2 ++ project/BuildHelper.scala | 2 +- project/MimaSettings.scala | 22 ++++++++++++++++++++++ 4 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 project/MimaSettings.scala diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d57b98bd..f70930fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -105,6 +105,8 @@ jobs: run: sbt ++${{ matrix.scala }}! testScala2${{ matrix.platform }} - name: Run tests run: sbt ++${{ matrix.scala }}! test${{ matrix.platform }} + - name: Run MiMa checks + run: sbt ++${{ matrix.scala }}! mimaReportBinaryIssues ci: runs-on: ubuntu-20.04 diff --git a/build.sbt b/build.sbt index 5b5bb35c..60856c2d 100644 --- a/build.sbt +++ b/build.sbt @@ -61,6 +61,7 @@ lazy val zioJsonRoot = project .in(file(".")) .settings( publish / skip := true, + mimaPreviousArtifacts := Set(), unusedCompileDependenciesFilter -= moduleFilter("org.scala-js", "scalajs-library") ) .aggregate( @@ -400,6 +401,7 @@ lazy val docs = project zioJsonInteropScalaz7x.jvm, zioJsonGolden ), + mimaPreviousArtifacts := Set(), readmeAcknowledgement := """|- Uses [JsonTestSuite](https://github.com/nst/JSONTestSuite) to test parsing. (c) 2016 Nicolas Seriot) | diff --git a/project/BuildHelper.scala b/project/BuildHelper.scala index bd5f1b29..003cf45e 100644 --- a/project/BuildHelper.scala +++ b/project/BuildHelper.scala @@ -238,7 +238,7 @@ object BuildHelper { incOptions ~= (_.withLogRecompileOnMacro(false)), autoAPIMappings := true, unusedCompileDependenciesFilter -= moduleFilter("org.scala-js", "scalajs-library") - ) + ) ++ MimaSettings.mimaSettings(true) def macroExpansionSettings = Seq( scalacOptions ++= { diff --git a/project/MimaSettings.scala b/project/MimaSettings.scala new file mode 100644 index 00000000..7f2f68c0 --- /dev/null +++ b/project/MimaSettings.scala @@ -0,0 +1,22 @@ +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.JsonPackagePlatformSpecific.*"), + exclude[Problem]("zio.json.JsonDecoderPlatformSpecific.*"), + exclude[Problem]("zio.json.JsonEncoderPlatformSpecific.*"), + exclude[Problem]("zio.json.internal.*"), + exclude[Problem]("zio.json.package.*"), + exclude[Problem]("zio.json.yaml.internal.*"), + ), + mimaFailOnProblem := failOnProblem + ) +} \ No newline at end of file