Skip to content

Commit 7821e79

Browse files
authored
Enable MiMa in the new build (#23910)
[skip ci]
2 parents afbb66b + e274d0c commit 7821e79

File tree

5 files changed

+595
-272
lines changed

5 files changed

+595
-272
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -236,53 +236,6 @@ jobs:
236236
run: sbt ";sjsJUnitTests/test ;set sjsJUnitTests/scalaJSLinkerConfig ~= switchToESModules ;sjsJUnitTests/test ;sjsCompilerTests/test"
237237
shell: cmd
238238

239-
mima:
240-
name: MiMa
241-
runs-on: [self-hosted, Linux]
242-
container:
243-
image: lampepfl/dotty:2024-10-18
244-
options: --cpu-shares 4096
245-
volumes:
246-
- ${{ github.workspace }}/../../cache/sbt:/root/.sbt
247-
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
248-
- ${{ github.workspace }}/../../cache/general:/root/.cache
249-
if: "github.event_name == 'schedule' && github.repository == 'scala/scala3'
250-
|| github.event_name == 'push'
251-
|| github.event_name == 'merge_group'
252-
|| (
253-
github.event_name == 'pull_request'
254-
&& !contains(github.event.pull_request.body, '[skip ci]')
255-
&& !contains(github.event.pull_request.body, '[skip mima]')
256-
)
257-
|| (
258-
github.event_name == 'workflow_dispatch'
259-
&& github.repository == 'scala/scala3'
260-
)"
261-
steps:
262-
- name: Set JDK 17 as default
263-
run: echo "/usr/lib/jvm/java-17-openjdk-amd64/bin" >> $GITHUB_PATH
264-
265-
- name: Reset existing repo
266-
run: |
267-
git config --global --add safe.directory $GITHUB_WORKSPACE
268-
git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/scala/scala3" && git reset --hard FETCH_HEAD || true
269-
270-
- name: Checkout cleanup script
271-
uses: actions/checkout@v5
272-
273-
- name: Cleanup
274-
run: .github/workflows/cleanup.sh
275-
276-
- name: Git Checkout
277-
uses: actions/checkout@v5
278-
279-
- name: Add SBT proxy repositories
280-
run: cp -vf .github/workflows/repositories /root/.sbt/ ; true
281-
282-
- name: MiMa
283-
run: |
284-
./project/scripts/sbt ";scala3-interfaces/mimaReportBinaryIssues ;scala3-library-bootstrapped/mimaReportBinaryIssues ;scala3-library-bootstrappedJS/mimaReportBinaryIssues; tasty-core-bootstrapped/mimaReportBinaryIssues;"
285-
286239
community_build_a:
287240
runs-on: [self-hosted, Linux]
288241
container:
@@ -510,7 +463,7 @@ jobs:
510463
- ${{ github.workspace }}/../../cache/sbt:/root/.sbt
511464
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
512465
- ${{ github.workspace }}/../../cache/general:/root/.cache
513-
needs: [test_non_bootstrapped, test, mima, community_build_a, community_build_b, community_build_c, test_sbt, build-sdk-package, build-msi-package]
466+
needs: [test_non_bootstrapped, test, community_build_a, community_build_b, community_build_c, test_sbt, build-sdk-package, build-msi-package]
514467
if: "github.event_name == 'push'
515468
&& startsWith(github.event.ref, 'refs/tags/')"
516469

.github/workflows/stdlib.yaml

Lines changed: 113 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,23 @@ jobs:
4848
- name: Compile `scala3-library-nonbootstrapped`
4949
run: ./project/scripts/sbt scala3-library-nonbootstrapped/compile
5050

51+
scala3-interfaces:
52+
runs-on: ubuntu-latest
53+
steps:
54+
- name: Git Checkout
55+
uses: actions/checkout@v5
56+
57+
- name: Set up JDK 17
58+
uses: actions/setup-java@v5
59+
with:
60+
distribution: 'temurin'
61+
java-version: 17
62+
cache: 'sbt'
63+
64+
- uses: sbt/setup-sbt@v1
65+
- name: Compile `scala3-interfaces`
66+
run: ./project/scripts/sbt scala3-interfaces/compile
67+
5168
tasty-core-nonbootstrapped:
5269
runs-on: ubuntu-latest
5370
needs: [scala3-library-nonbootstrapped]
@@ -67,7 +84,7 @@ jobs:
6784

6885
scala3-compiler-nonbootstrapped:
6986
runs-on: ubuntu-latest
70-
needs: [tasty-core-nonbootstrapped, scala3-library-nonbootstrapped]
87+
needs: [tasty-core-nonbootstrapped, scala3-library-nonbootstrapped, scala3-interfaces]
7188
steps:
7289
- name: Git Checkout
7390
uses: actions/checkout@v5
@@ -155,7 +172,7 @@ jobs:
155172

156173
scala3-compiler-bootstrapped:
157174
runs-on: ubuntu-latest
158-
needs: [tasty-core-bootstrapped, scala3-library-bootstrapped]
175+
needs: [tasty-core-bootstrapped, scala3-library-bootstrapped, scala3-interfaces]
159176
steps:
160177
- name: Git Checkout
161178
uses: actions/checkout@v5
@@ -280,6 +297,100 @@ jobs:
280297
- name: Compile `scaladoc`
281298
run: ./project/scripts/sbt scaladoc-new/compile
282299

300+
#################################################################################################
301+
########################################### MiMa JOBS ###########################################
302+
#################################################################################################
303+
304+
mima-scala-library-nonbootstrapped:
305+
runs-on: ubuntu-latest
306+
needs: scala-library-nonbootstrapped
307+
steps:
308+
- name: Git Checkout
309+
uses: actions/checkout@v5
310+
311+
- name: Set up JDK 17
312+
uses: actions/setup-java@v5
313+
with:
314+
distribution: 'temurin'
315+
java-version: 17
316+
cache: 'sbt'
317+
318+
- uses: sbt/setup-sbt@v1
319+
- name: Report MiMa issues in `scala-library-nonbootstrapped`
320+
run: ./project/scripts/sbt scala-library-nonbootstrapped/mimaReportBinaryIssues
321+
322+
mima-scala3-interfaces:
323+
runs-on: ubuntu-latest
324+
needs: scala3-interfaces
325+
steps:
326+
- name: Git Checkout
327+
uses: actions/checkout@v5
328+
329+
- name: Set up JDK 17
330+
uses: actions/setup-java@v5
331+
with:
332+
distribution: 'temurin'
333+
java-version: 17
334+
cache: 'sbt'
335+
336+
- uses: sbt/setup-sbt@v1
337+
- name: Report MiMa issues in `scala3-interfaces`
338+
run: ./project/scripts/sbt scala3-interfaces/mimaReportBinaryIssues
339+
340+
mima-tasty-core-nonbootstrapped:
341+
runs-on: ubuntu-latest
342+
needs: tasty-core-nonbootstrapped
343+
steps:
344+
- name: Git Checkout
345+
uses: actions/checkout@v5
346+
347+
- name: Set up JDK 17
348+
uses: actions/setup-java@v5
349+
with:
350+
distribution: 'temurin'
351+
java-version: 17
352+
cache: 'sbt'
353+
354+
- uses: sbt/setup-sbt@v1
355+
- name: Report MiMa issues in `tasty-core-nonbootstrapped`
356+
run: ./project/scripts/sbt tasty-core-nonbootstrapped/mimaReportBinaryIssues
357+
358+
mima-scala-library-bootstrapped:
359+
runs-on: ubuntu-latest
360+
needs: scala-library-bootstrapped
361+
steps:
362+
- name: Git Checkout
363+
uses: actions/checkout@v5
364+
365+
- name: Set up JDK 17
366+
uses: actions/setup-java@v5
367+
with:
368+
distribution: 'temurin'
369+
java-version: 17
370+
cache: 'sbt'
371+
372+
- uses: sbt/setup-sbt@v1
373+
- name: Report MiMa issues in `scala-library-bootstrapped`
374+
run: ./project/scripts/sbt scala-library-bootstrapped/mimaReportBinaryIssues
375+
376+
mima-tasty-core-bootstrapped:
377+
runs-on: ubuntu-latest
378+
needs: tasty-core-bootstrapped
379+
steps:
380+
- name: Git Checkout
381+
uses: actions/checkout@v5
382+
383+
- name: Set up JDK 17
384+
uses: actions/setup-java@v5
385+
with:
386+
distribution: 'temurin'
387+
java-version: 17
388+
cache: 'sbt'
389+
390+
- uses: sbt/setup-sbt@v1
391+
- name: Report MiMa issues in `tasty-core-bootstrapped`
392+
run: ./project/scripts/sbt tasty-core-bootstrapped-new/mimaReportBinaryIssues
393+
283394
#################################################################################################
284395
########################################### TEST JOBS ###########################################
285396
#################################################################################################

project/Build.scala

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ object Build {
134134
* - `3.M.0` if `P > 0`
135135
* - `3.(M-1).0` if `P = 0`
136136
*/
137-
val mimaPreviousDottyVersion = "3.7.0"
137+
val mimaPreviousDottyVersion = "3.7.3" // for 3.8.0, we compare against 3.7.3
138138

139139
/** LTS version against which we check binary compatibility.
140140
*
@@ -304,6 +304,7 @@ object Build {
304304
Test / develocityBuildCacheClient := None,
305305
extraDevelocityCacheInputFiles := Seq.empty,
306306
extraDevelocityCacheInputFiles / outputFileStamper := FileStamper.Hash,
307+
resolvers += ("Artifactory" at "https://repo.scala-lang.org/artifactory/fat-jar/"),
307308
)
308309

309310
// Settings shared globally (scoped in Global). Used in build.sbt
@@ -1636,6 +1637,16 @@ object Build {
16361637
publish / skip := false,
16371638
// Project specific target folder. sbt doesn't like having two projects using the same target folder
16381639
target := target.value / "scala-library-nonbootstrapped",
1640+
// Add configuration for MiMa
1641+
mimaCheckDirection := (compatMode match {
1642+
case CompatMode.BinaryCompatible => "backward"
1643+
case CompatMode.SourceAndBinaryCompatible => "both"
1644+
}),
1645+
mimaExcludeAnnotations += "scala.annotation.experimental",
1646+
mimaPreviousArtifacts += ("org.scala-lang" % "fat-stdlib" % "3.7.3"),
1647+
mimaForwardIssueFilters := MiMaFilters.Scala3Library.ForwardsBreakingChanges,
1648+
mimaBackwardIssueFilters := MiMaFilters.Scala3Library.BackwardsBreakingChanges,
1649+
customMimaReportBinaryIssues("MiMaFilters.Scala3Library"),
16391650
)
16401651

16411652
/* Configuration of the org.scala-lang:scala3-library_3:*.**.**-nonbootstrapped project */
@@ -1748,6 +1759,16 @@ object Build {
17481759
scalaCompilerBridgeBinaryJar := {
17491760
Some((`scala3-sbt-bridge-nonbootstrapped` / Compile / packageBin).value)
17501761
},
1762+
// Add configuration for MiMa
1763+
mimaCheckDirection := (compatMode match {
1764+
case CompatMode.BinaryCompatible => "backward"
1765+
case CompatMode.SourceAndBinaryCompatible => "both"
1766+
}),
1767+
mimaExcludeAnnotations += "scala.annotation.experimental",
1768+
mimaPreviousArtifacts += ("org.scala-lang" % "fat-stdlib" % "3.7.3"),
1769+
mimaForwardIssueFilters := MiMaFilters.Scala3Library.ForwardsBreakingChanges,
1770+
mimaBackwardIssueFilters := MiMaFilters.Scala3Library.BackwardsBreakingChanges,
1771+
customMimaReportBinaryIssues("MiMaFilters.Scala3Library"),
17511772
)
17521773

17531774
/* Configuration of the org.scala-lang:scala3-library_3:*.**.**-bootstrapped project */
@@ -1952,6 +1973,7 @@ object Build {
19521973
/* Configuration of the org.scala-lang:tasty-core_3:*.**.**-nonbootstrapped project */
19531974
lazy val `tasty-core-nonbootstrapped` = project.in(file("tasty"))
19541975
.dependsOn(`scala3-library-nonbootstrapped`)
1976+
.settings(commonMiMaSettings)
19551977
.settings(
19561978
name := "tasty-core-nonbootstrapped",
19571979
moduleName := "tasty-core",
@@ -2005,13 +2027,16 @@ object Build {
20052027
Test / envVars ++= Map(
20062028
"EXPECTED_TASTY_VERSION" -> expectedTastyVersion,
20072029
),
2008-
2030+
mimaForwardIssueFilters := MiMaFilters.TastyCore.ForwardsBreakingChanges,
2031+
mimaBackwardIssueFilters := MiMaFilters.TastyCore.BackwardsBreakingChanges,
2032+
customMimaReportBinaryIssues("MiMaFilters.TastyCore"),
20092033
)
20102034

20112035
/* Configuration of the org.scala-lang:tasty-core_3:*.**.**-bootstrapped project */
20122036
lazy val `tasty-core-bootstrapped-new` = project.in(file("tasty"))
20132037
.dependsOn(`scala3-library-bootstrapped-new`)
20142038
.settings(publishSettings)
2039+
.settings(commonMiMaSettings)
20152040
.settings(
20162041
name := "tasty-core-bootstrapped",
20172042
moduleName := "tasty-core",
@@ -2074,6 +2099,9 @@ object Build {
20742099
Test / envVars ++= Map(
20752100
"EXPECTED_TASTY_VERSION" -> expectedTastyVersion,
20762101
),
2102+
mimaForwardIssueFilters := MiMaFilters.TastyCore.ForwardsBreakingChanges,
2103+
mimaBackwardIssueFilters := MiMaFilters.TastyCore.BackwardsBreakingChanges,
2104+
customMimaReportBinaryIssues("MiMaFilters.TastyCore"),
20772105
)
20782106

20792107
// ==============================================================================================
@@ -3467,18 +3495,6 @@ object Build {
34673495
val doWork = (Compile/doc).result.value
34683496
(Compile/doc/target).value
34693497
},
3470-
commonMiMaSettings,
3471-
mimaPreviousArtifacts += {
3472-
val thisProjectID = projectID.value
3473-
val crossedName = thisProjectID.crossVersion match {
3474-
case cv: Disabled => thisProjectID.name
3475-
case cv: Binary => s"${thisProjectID.name}_${cv.prefix}3${cv.suffix}"
3476-
}
3477-
(thisProjectID.organization % crossedName % mimaPreviousLTSDottyVersion)
3478-
},
3479-
mimaForwardIssueFilters := MiMaFilters.Scala3Library.ForwardsBreakingChanges,
3480-
mimaBackwardIssueFilters := MiMaFilters.Scala3Library.BackwardsBreakingChanges,
3481-
customMimaReportBinaryIssues("MiMaFilters.Scala3Library"),
34823498
)
34833499
} else base
34843500
}
@@ -3493,14 +3509,6 @@ object Build {
34933509
Test / envVars ++= Map(
34943510
"EXPECTED_TASTY_VERSION" -> expectedTastyVersion,
34953511
),
3496-
if (mode == Bootstrapped) Def.settings(
3497-
commonMiMaSettings,
3498-
mimaForwardIssueFilters := MiMaFilters.TastyCore.ForwardsBreakingChanges,
3499-
mimaBackwardIssueFilters := MiMaFilters.TastyCore.BackwardsBreakingChanges,
3500-
customMimaReportBinaryIssues("MiMaFilters.TastyCore"),
3501-
) else {
3502-
Nil
3503-
}
35043512
)
35053513

35063514
def asTastyCoreScala2: Project = project

0 commit comments

Comments
 (0)