Skip to content
Merged
49 changes: 1 addition & 48 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -236,53 +236,6 @@ jobs:
run: sbt ";sjsJUnitTests/test ;set sjsJUnitTests/scalaJSLinkerConfig ~= switchToESModules ;sjsJUnitTests/test ;sjsCompilerTests/test"
shell: cmd

mima:
name: MiMa
runs-on: [self-hosted, Linux]
container:
image: lampepfl/dotty:2024-10-18
options: --cpu-shares 4096
volumes:
- ${{ github.workspace }}/../../cache/sbt:/root/.sbt
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
- ${{ github.workspace }}/../../cache/general:/root/.cache
if: "github.event_name == 'schedule' && github.repository == 'scala/scala3'
|| github.event_name == 'push'
|| github.event_name == 'merge_group'
|| (
github.event_name == 'pull_request'
&& !contains(github.event.pull_request.body, '[skip ci]')
&& !contains(github.event.pull_request.body, '[skip mima]')
)
|| (
github.event_name == 'workflow_dispatch'
&& github.repository == 'scala/scala3'
)"
steps:
- name: Set JDK 17 as default
run: echo "/usr/lib/jvm/java-17-openjdk-amd64/bin" >> $GITHUB_PATH

- name: Reset existing repo
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/scala/scala3" && git reset --hard FETCH_HEAD || true

- name: Checkout cleanup script
uses: actions/checkout@v5

- name: Cleanup
run: .github/workflows/cleanup.sh

- name: Git Checkout
uses: actions/checkout@v5

- name: Add SBT proxy repositories
run: cp -vf .github/workflows/repositories /root/.sbt/ ; true

- name: MiMa
run: |
./project/scripts/sbt ";scala3-interfaces/mimaReportBinaryIssues ;scala3-library-bootstrapped/mimaReportBinaryIssues ;scala3-library-bootstrappedJS/mimaReportBinaryIssues; tasty-core-bootstrapped/mimaReportBinaryIssues;"

community_build_a:
runs-on: [self-hosted, Linux]
container:
Expand Down Expand Up @@ -510,7 +463,7 @@ jobs:
- ${{ github.workspace }}/../../cache/sbt:/root/.sbt
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
- ${{ github.workspace }}/../../cache/general:/root/.cache
needs: [test_non_bootstrapped, test, mima, community_build_a, community_build_b, community_build_c, test_sbt, build-sdk-package, build-msi-package]
needs: [test_non_bootstrapped, test, community_build_a, community_build_b, community_build_c, test_sbt, build-sdk-package, build-msi-package]
if: "github.event_name == 'push'
&& startsWith(github.event.ref, 'refs/tags/')"

Expand Down
115 changes: 113 additions & 2 deletions .github/workflows/stdlib.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,23 @@ jobs:
- name: Compile `scala3-library-nonbootstrapped`
run: ./project/scripts/sbt scala3-library-nonbootstrapped/compile

scala3-interfaces:
runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout@v5

- name: Set up JDK 17
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 17
cache: 'sbt'

- uses: sbt/setup-sbt@v1
- name: Compile `scala3-interfaces`
run: ./project/scripts/sbt scala3-interfaces/compile

tasty-core-nonbootstrapped:
runs-on: ubuntu-latest
needs: [scala3-library-nonbootstrapped]
Expand All @@ -67,7 +84,7 @@ jobs:

scala3-compiler-nonbootstrapped:
runs-on: ubuntu-latest
needs: [tasty-core-nonbootstrapped, scala3-library-nonbootstrapped]
needs: [tasty-core-nonbootstrapped, scala3-library-nonbootstrapped, scala3-interfaces]
steps:
- name: Git Checkout
uses: actions/checkout@v5
Expand Down Expand Up @@ -155,7 +172,7 @@ jobs:

scala3-compiler-bootstrapped:
runs-on: ubuntu-latest
needs: [tasty-core-bootstrapped, scala3-library-bootstrapped]
needs: [tasty-core-bootstrapped, scala3-library-bootstrapped, scala3-interfaces]
steps:
- name: Git Checkout
uses: actions/checkout@v5
Expand Down Expand Up @@ -280,6 +297,100 @@ jobs:
- name: Compile `scaladoc`
run: ./project/scripts/sbt scaladoc-new/compile

#################################################################################################
########################################### MiMa JOBS ###########################################
#################################################################################################

mima-scala-library-nonbootstrapped:
runs-on: ubuntu-latest
needs: scala-library-nonbootstrapped
steps:
- name: Git Checkout
uses: actions/checkout@v5

- name: Set up JDK 17
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 17
cache: 'sbt'

- uses: sbt/setup-sbt@v1
- name: Report MiMa issues in `scala-library-nonbootstrapped`
run: ./project/scripts/sbt scala-library-nonbootstrapped/mimaReportBinaryIssues
Comment on lines +304 to +320
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we either don't use build cache of it's misconfigured becouse in the last run scala-library is built at least twice: once in scala-library-nonbootstrapped, again in mima-scala-library-nonbootstrapped and once in every project that depends on it.
Even though splitting it might be easier to manage with the current build setup it's wasting resources.
Ideally we'd like to build everything once, but it's hard to achieve. If so, let's at least minimise the overhead by making the mima checks the next step in scala-library-nonbootstrapped and other jobs.
The MiMa check itself takes only a few seconds, building artifact takes minutes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we either don't use build cache
I disabled it earlier today. It is misconfigured and very unpredictable. The intention is to use the cache, but this is independent of this PR and the cache will be enabled back soon. Just need the time to investigate why it doesn't sometime invalidated some builds.


mima-scala3-interfaces:
runs-on: ubuntu-latest
needs: scala3-interfaces
steps:
- name: Git Checkout
uses: actions/checkout@v5

- name: Set up JDK 17
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 17
cache: 'sbt'

- uses: sbt/setup-sbt@v1
- name: Report MiMa issues in `scala3-interfaces`
run: ./project/scripts/sbt scala3-interfaces/mimaReportBinaryIssues

mima-tasty-core-nonbootstrapped:
runs-on: ubuntu-latest
needs: tasty-core-nonbootstrapped
steps:
- name: Git Checkout
uses: actions/checkout@v5

- name: Set up JDK 17
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 17
cache: 'sbt'

- uses: sbt/setup-sbt@v1
- name: Report MiMa issues in `tasty-core-nonbootstrapped`
run: ./project/scripts/sbt tasty-core-nonbootstrapped/mimaReportBinaryIssues

mima-scala-library-bootstrapped:
runs-on: ubuntu-latest
needs: scala-library-bootstrapped
steps:
- name: Git Checkout
uses: actions/checkout@v5

- name: Set up JDK 17
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 17
cache: 'sbt'

- uses: sbt/setup-sbt@v1
- name: Report MiMa issues in `scala-library-bootstrapped`
run: ./project/scripts/sbt scala-library-bootstrapped/mimaReportBinaryIssues

mima-tasty-core-bootstrapped:
runs-on: ubuntu-latest
needs: tasty-core-bootstrapped
steps:
- name: Git Checkout
uses: actions/checkout@v5

- name: Set up JDK 17
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 17
cache: 'sbt'

- uses: sbt/setup-sbt@v1
- name: Report MiMa issues in `tasty-core-bootstrapped`
run: ./project/scripts/sbt tasty-core-bootstrapped-new/mimaReportBinaryIssues

#################################################################################################
########################################### TEST JOBS ###########################################
#################################################################################################
Expand Down
52 changes: 30 additions & 22 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ object Build {
* - `3.M.0` if `P > 0`
* - `3.(M-1).0` if `P = 0`
*/
val mimaPreviousDottyVersion = "3.7.0"
val mimaPreviousDottyVersion = "3.7.3" // for 3.8.0, we compare against 3.7.3
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine since we only compare backward compatibility, not forward.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this change needed? Is it because of merging Scala 2.13 stdlib into this repo?
We should be really careful about this one. Let's at least store the forward compatibility issues in the gist for review. All of these should be documented here currently

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could call the fat jar 3.7.0 if that helps. I don't think it really matters if it's 3.7.3 or 3.7.0 for 3.8.0.


/** LTS version against which we check binary compatibility.
*
Expand Down Expand Up @@ -304,6 +304,7 @@ object Build {
Test / develocityBuildCacheClient := None,
extraDevelocityCacheInputFiles := Seq.empty,
extraDevelocityCacheInputFiles / outputFileStamper := FileStamper.Hash,
resolvers += ("Artifactory" at "https://repo.scala-lang.org/artifactory/fat-jar/"),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be able to use MiMa, I created a fat jar that contains both Scala 3.7.3 and Scala 2.13.16 manually and pushed it to this resolver. Once we publish 3.8.0, we can tear down this system and compare against the artifacts from Maven Central.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add TODO notes to related changes that would need to be adjusted (resolvers, mimaPreviousArtifacts, etc)

)

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

/* Configuration of the org.scala-lang:scala3-library_3:*.**.**-nonbootstrapped project */
Expand Down Expand Up @@ -1748,6 +1759,16 @@ object Build {
scalaCompilerBridgeBinaryJar := {
Some((`scala3-sbt-bridge-nonbootstrapped` / Compile / packageBin).value)
},
// Add configuration for MiMa
mimaCheckDirection := (compatMode match {
case CompatMode.BinaryCompatible => "backward"
case CompatMode.SourceAndBinaryCompatible => "both"
}),
mimaExcludeAnnotations += "scala.annotation.experimental",
mimaPreviousArtifacts += ("org.scala-lang" % "fat-stdlib" % "3.7.3"),
mimaForwardIssueFilters := MiMaFilters.Scala3Library.ForwardsBreakingChanges,
mimaBackwardIssueFilters := MiMaFilters.Scala3Library.BackwardsBreakingChanges,
customMimaReportBinaryIssues("MiMaFilters.Scala3Library"),
)

/* Configuration of the org.scala-lang:scala3-library_3:*.**.**-bootstrapped project */
Expand Down Expand Up @@ -1952,6 +1973,7 @@ object Build {
/* Configuration of the org.scala-lang:tasty-core_3:*.**.**-nonbootstrapped project */
lazy val `tasty-core-nonbootstrapped` = project.in(file("tasty"))
.dependsOn(`scala3-library-nonbootstrapped`)
.settings(commonMiMaSettings)
.settings(
name := "tasty-core-nonbootstrapped",
moduleName := "tasty-core",
Expand Down Expand Up @@ -2005,13 +2027,16 @@ object Build {
Test / envVars ++= Map(
"EXPECTED_TASTY_VERSION" -> expectedTastyVersion,
),

mimaForwardIssueFilters := MiMaFilters.TastyCore.ForwardsBreakingChanges,
mimaBackwardIssueFilters := MiMaFilters.TastyCore.BackwardsBreakingChanges,
customMimaReportBinaryIssues("MiMaFilters.TastyCore"),
)

/* Configuration of the org.scala-lang:tasty-core_3:*.**.**-bootstrapped project */
lazy val `tasty-core-bootstrapped-new` = project.in(file("tasty"))
.dependsOn(`scala3-library-bootstrapped-new`)
.settings(publishSettings)
.settings(commonMiMaSettings)
.settings(
name := "tasty-core-bootstrapped",
moduleName := "tasty-core",
Expand Down Expand Up @@ -2074,6 +2099,9 @@ object Build {
Test / envVars ++= Map(
"EXPECTED_TASTY_VERSION" -> expectedTastyVersion,
),
mimaForwardIssueFilters := MiMaFilters.TastyCore.ForwardsBreakingChanges,
mimaBackwardIssueFilters := MiMaFilters.TastyCore.BackwardsBreakingChanges,
customMimaReportBinaryIssues("MiMaFilters.TastyCore"),
)

// ==============================================================================================
Expand Down Expand Up @@ -3467,18 +3495,6 @@ object Build {
val doWork = (Compile/doc).result.value
(Compile/doc/target).value
},
commonMiMaSettings,
mimaPreviousArtifacts += {
val thisProjectID = projectID.value
val crossedName = thisProjectID.crossVersion match {
case cv: Disabled => thisProjectID.name
case cv: Binary => s"${thisProjectID.name}_${cv.prefix}3${cv.suffix}"
}
(thisProjectID.organization % crossedName % mimaPreviousLTSDottyVersion)
},
mimaForwardIssueFilters := MiMaFilters.Scala3Library.ForwardsBreakingChanges,
mimaBackwardIssueFilters := MiMaFilters.Scala3Library.BackwardsBreakingChanges,
customMimaReportBinaryIssues("MiMaFilters.Scala3Library"),
)
} else base
}
Expand All @@ -3493,14 +3509,6 @@ object Build {
Test / envVars ++= Map(
"EXPECTED_TASTY_VERSION" -> expectedTastyVersion,
),
if (mode == Bootstrapped) Def.settings(
commonMiMaSettings,
mimaForwardIssueFilters := MiMaFilters.TastyCore.ForwardsBreakingChanges,
mimaBackwardIssueFilters := MiMaFilters.TastyCore.BackwardsBreakingChanges,
customMimaReportBinaryIssues("MiMaFilters.TastyCore"),
) else {
Nil
}
)

def asTastyCoreScala2: Project = project
Expand Down
Loading