Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

+sbt Validate mima on pull request #320

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/binary-compatibility-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Binary Compatibility

on:
pull_request:
push:
branches: [ main ]
tags-ignore: [ v* ]

concurrency:
# Only run once for latest commit per ref and cancel other (previous) runs.
group: ci-${{ github.ref }}
cancel-in-progress: true

permissions: { }

jobs:
check-binary-compatibility:
name: Check / Binary Compatibility
runs-on: ubuntu-20.04
if: github.repository == 'apache/incubator-pekko-http'
strategy:
fail-fast: false
matrix:
SCALA_VERSION: [ 2.12, 2.13, 3.3 ]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: 0

- name: Setup Java 11
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
He-Pin marked this conversation as resolved.
Show resolved Hide resolved

- name: Cache Coursier cache
uses: coursier/cache-action@v6.4.0

- name: Enable jvm-opts
run: cp .jvmopts-ci .jvmopts

- name: Compile code
run: sbt ++${{ matrix.SCALA_VERSION }} Test/compile

- name: Report MiMa Binary Issues with Scala ${{ matrix.SCALA_VERSION }}
run: sbt -Dpekko.http.parallelExecution=false -Dpekko.test.timefactor=2 ++${{ matrix.SCALA_VERSION }} mimaReportBinaryIssues

- name: Check correct MiMa filter directories
run: |
sbt checkMimaFilterDirectories
16 changes: 15 additions & 1 deletion project/MiMa.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@ import com.typesafe.tools.mima.plugin.MimaPlugin.autoImport._
import scala.util.Try

object MiMa extends AutoPlugin {
private val latestPatchOf10 = 0

override def requires = MimaPlugin
override def trigger = allRequirements

val checkMimaFilterDirectories =
taskKey[Unit]("Check that the mima directories are correct compared to latest version")

override val projectSettings = Seq(
mimaPreviousArtifacts := {
val versions = Set("1.0.0")
Expand All @@ -48,7 +52,17 @@ object MiMa extends AutoPlugin {
}

Map.empty
})
},
checkMimaFilterDirectories := checkFilterDirectories(baseDirectory.value))

def checkFilterDirectories(moduleRoot: File): Unit = {
val nextVersionFilterDir =
moduleRoot / "src" / "main" / "mima-filters" / s"1.0.${latestPatchOf10 + 1}.backwards.excludes"
if (nextVersionFilterDir.exists()) {
throw new IllegalArgumentException(s"Incorrect mima filter directory exists: '$nextVersionFilterDir' " +
s"should be with number from current release '${moduleRoot / "src" / "main" / "mima-filters" / s"1.0.$latestPatchOf10.backwards.excludes"}")
}
}

def latestForkVersion(fork: String, allVersions: Seq[String]): String =
allVersions
Expand Down
Loading