From bfc71f89848119e301fd4c3ca6f8382618be40e8 Mon Sep 17 00:00:00 2001 From: Domantas Petrauskas <5850190+ptrdom@users.noreply.github.com> Date: Mon, 28 Oct 2024 22:50:18 +0200 Subject: [PATCH] Setup MiMa checks (#166) * Setup MiMa checks * Address PR comments * Address PR comments --- .../workflows/binary-compatibility-checks.yml | 47 +++++++++++++++++++ build.sbt | 12 ++++- project/plugins.sbt | 1 + .../r2dbcsession.excludes | 20 ++++++++ 4 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/binary-compatibility-checks.yml create mode 100644 projection/src/main/mima-filters/1.0.x.backwards.excludes/r2dbcsession.excludes diff --git a/.github/workflows/binary-compatibility-checks.yml b/.github/workflows/binary-compatibility-checks.yml new file mode 100644 index 00000000..ee9024ef --- /dev/null +++ b/.github/workflows/binary-compatibility-checks.yml @@ -0,0 +1,47 @@ +name: Binary Compatibility + +on: + pull_request: + push: + branches: + - main + +permissions: {} + +jobs: + check-binary-compatibility: + name: Check / Binary Compatibility + runs-on: ubuntu-22.04 + if: github.repository == 'apache/pekko-persistence-r2dbc' + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: 0 + + - name: Setup Java 11 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 11 + + - name: Install sbt + uses: sbt/setup-sbt@v1 + + - name: Cache Coursier cache + uses: coursier/cache-action@v6 + + - name: Enable jvm-opts + run: cp .jvmopts-ci .jvmopts + + - name: Compile code + run: sbt +compile + + - name: Report MiMa Binary Issues + run: |- + sbt +mimaReportBinaryIssues + + - name: Check correct MiMa filter directories + run: | + sbt checkMimaFilterDirectories diff --git a/build.sbt b/build.sbt index a5951f4a..c8c9d058 100644 --- a/build.sbt +++ b/build.sbt @@ -41,6 +41,7 @@ inThisBuild( lazy val dontPublish = Seq(publish / skip := true, Compile / publishArtifact := false) lazy val root = (project in file(".")) + .disablePlugins(MimaPlugin) .settings(dontPublish) .settings( name := "pekko-persistence-r2dbc-root") @@ -70,12 +71,21 @@ lazy val migration = (project in file("migration")) dependencyOverrides ++= Dependencies.pekkoTestDependencyOverrides, Test / mainClass := Some("org.apache.pekko.persistence.r2dbc.migration.MigrationTool"), Test / run / fork := true, - Test / run / javaOptions += "-Dlogback.configurationFile=logback-main.xml") + Test / run / javaOptions += "-Dlogback.configurationFile=logback-main.xml", + mimaPreviousArtifacts := { + CrossVersion.partialVersion(scalaVersion.value) match { + case Some((3, _)) => + Set.empty + case _ => + mimaPreviousArtifacts.value + } + }) .dependsOn(core % "compile->compile;test->test") lazy val docs = project .in(file("docs")) .enablePlugins(PekkoParadoxPlugin, ParadoxSitePlugin, ScalaUnidocPlugin) + .disablePlugins(MimaPlugin) .dependsOn(core, projection, migration) .settings(dontPublish) .settings( diff --git a/project/plugins.sbt b/project/plugins.sbt index e1b5b638..c7d7e0b3 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -11,6 +11,7 @@ addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0") // for maintenance o addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2") addSbtPlugin("com.lightbend.sbt" % "sbt-java-formatter" % "0.8.0") addSbtPlugin("com.github.sbt" % "sbt-unidoc" % "0.5.0") +addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.4") // for releasing addSbtPlugin("com.github.sbt" % "sbt-dynver" % "5.1.0") diff --git a/projection/src/main/mima-filters/1.0.x.backwards.excludes/r2dbcsession.excludes b/projection/src/main/mima-filters/1.0.x.backwards.excludes/r2dbcsession.excludes new file mode 100644 index 00000000..de0fbe3b --- /dev/null +++ b/projection/src/main/mima-filters/1.0.x.backwards.excludes/r2dbcsession.excludes @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Caused by https://github.com/apache/pekko-persistence-r2dbc/pull/101 +ProblemFilters.exclude[IncompatibleSignatureProblem]("org.apache.pekko.projection.r2dbc.javadsl.R2dbcSession.updateOne") +ProblemFilters.exclude[IncompatibleSignatureProblem]("org.apache.pekko.projection.r2dbc.javadsl.R2dbcSession.update")