Skip to content

Commit

Permalink
Refactor the way CI launches tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pomadchin committed Nov 10, 2021
1 parent a916401 commit 0779fcc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ jobs:
- name: Test & Compute Coverage
run: sbt ++${{ matrix.scala }} coverage frameless-test

- name: Test & Compute Coverage Spark 3.1.x
run: sbt ++${{ matrix.scala }} coverage frameless-test-spark31

- name: Test & Compute Coverage Spark 3.0.x
run: sbt ++${{ matrix.scala }} coverage frameless-test-spark30

- name: Upload Codecov Results
run: codecov -F ${{ matrix.scala }}

Expand Down
11 changes: 9 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ val Scala213 = "2.13.7"
val previousVersion = "0.10.1"

/** A list of projects that can be safely compiled across Scala versions. */
val projectsCrossVersion = "core" :: "dataset" :: "refined" :: "ml" :: Nil
val projectsCrossVersion = "core" :: "cats" :: "dataset" :: "refined" :: "ml" :: Nil
val projectsSpark31 = projectsCrossVersion.head :: projectsCrossVersion.tail.map(_ + "-spark31")
val projectsSpark30 = projectsCrossVersion.head :: projectsCrossVersion.tail.map(_ + "-spark30")

ThisBuild / versionScheme := Some("semver-spec")

Expand Down Expand Up @@ -48,13 +50,18 @@ lazy val root = Project("frameless", file("." + "frameless")).in(file("."))
.settings(
/** Not all Spark versions support Scala 2.13. These commands are launched for the supported subset of projects only. */
commands ++= Seq(
commandCrossVersion("frameless-test")(projectsCrossVersion.map(_ + "/test") ::: projectsCrossVersion.map(_ + "/test/coverageReport"), "test" :: "coverageReport" :: Nil).value,
// run tests separately for different Spark versions to reduce pressure on CI
command("frameless-test")(projectsCrossVersion.map(_ + "/test") ::: projectsCrossVersion.map(_ + "/test/coverageReport")).value,
command212("frameless-test-spark31")(projectsSpark31.map(_ + "/test") ::: projectsSpark31.map(_ + "/test/coverageReport")).value,
command212("frameless-test-spark30")(projectsSpark30.map(_ + "/test") ::: projectsSpark30.map(_ + "/test/coverageReport")).value,
commandCrossVersion("frameless-mimaReportBinaryIssues")(projectsCrossVersion.map(_ + "/mimaReportBinaryIssues"), "mimaReportBinaryIssues" :: Nil).value,
commandCrossVersion("frameless-publish")(projectsCrossVersion.map(_ + "/publish"), "publish" :: Nil).value,
commandCrossVersion("frameless-publishSigned")(projectsCrossVersion.map(_ + "/publishSigned"), "publishSigned" :: Nil).value,
)
)

def command(name: String)(commands: List[String]) = commandCrossVersion(name)(commands, commands)
def command212(name: String)(commands212: List[String]) = commandCrossVersion(name)(Nil, commands212)
def commandCrossVersion(name: String)(commands213: List[String], commands212: List[String]) = Def.setting { Command.command(name) { currentState =>
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 13)) => commands213 ::: currentState
Expand Down

0 comments on commit 0779fcc

Please sign in to comment.