From 0779fccd06eff09fedd2362c710e08d3aa51e6ac Mon Sep 17 00:00:00 2001 From: Grigory Pomadchin Date: Tue, 9 Nov 2021 20:30:36 -0500 Subject: [PATCH] Refactor the way CI launches tests --- .github/workflows/ci.yml | 6 ++++++ build.sbt | 11 +++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9199c8fe..fd949184 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 }} diff --git a/build.sbt b/build.sbt index 5407752f..2d2fc8bd 100644 --- a/build.sbt +++ b/build.sbt @@ -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") @@ -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