Skip to content

Commit

Permalink
CommunityTests: split into separate projects
Browse files Browse the repository at this point in the history
The tests run too long, so let's split them apart so we can run them in
parallel.
  • Loading branch information
kitbellew committed Sep 26, 2024
1 parent 6c8bc5b commit eb17315
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 22 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
matrix:
java: [ '11' ]
os: [windows-latest, ubuntu-latest]
group: [scala2, scala3, other]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand All @@ -54,7 +55,7 @@ jobs:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: 'sbt'
- run: sbt communityTests/test
- run: sbt communityTests/${{ matrix.group }}/test
formatting:
runs-on: ubuntu-latest
steps:
Expand Down
41 changes: 29 additions & 12 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -218,18 +218,28 @@ lazy val tests = crossProject(JVMPlatform).withoutSuffixFor(JVMPlatform)
}),
).enablePlugins(BuildInfoPlugin).dependsOn(core, dynamic, cli)

lazy val communityTests = project.in(file("scalafmt-tests-community")).settings(
publish / skip := true,
libraryDependencies ++= Seq(
// Test dependencies
"com.lihaoyi" %% "scalatags" % "0.13.1",
scalametaTestkit,
munit.value,
),
scalacOptions ++= scalacJvmOptions.value,
javaOptions += "-Dfile.encoding=UTF8",
buildInfoPackage := "org.scalafmt.tests",
).enablePlugins(BuildInfoPlugin).dependsOn(coreJVM)
lazy val communityTestsCommon = project
.in(file("scalafmt-tests-community/common")).settings(
communityTestsSettings,
libraryDependencies ++= Seq(
// Test dependencies
"com.lihaoyi" %% "scalatags" % "0.13.1",
scalametaTestkit,
munit.value,
),
).enablePlugins(BuildInfoPlugin).dependsOn(coreJVM)

lazy val communityTestsScala2 = project
.in(file("scalafmt-tests-community/scala2")).settings(communityTestsSettings)
.enablePlugins(BuildInfoPlugin).dependsOn(communityTestsCommon)

lazy val communityTestsScala3 = project
.in(file("scalafmt-tests-community/scala3")).settings(communityTestsSettings)
.enablePlugins(BuildInfoPlugin).dependsOn(communityTestsCommon)

lazy val communityTestsOther = project
.in(file("scalafmt-tests-community/other")).settings(communityTestsSettings)
.enablePlugins(BuildInfoPlugin).dependsOn(communityTestsCommon)

lazy val benchmarks = project.in(file("scalafmt-benchmarks")).settings(
publish / skip := true,
Expand Down Expand Up @@ -286,3 +296,10 @@ lazy val buildInfoSettings: Seq[Def.Setting[_]] = Seq(
buildInfoPackage := "org.scalafmt",
buildInfoObject := "Versions",
)

lazy val communityTestsSettings: Seq[Def.Setting[_]] = Seq(
publish / skip := true,
scalacOptions ++= scalacJvmOptions.value,
javaOptions += "-Dfile.encoding=UTF8",
buildInfoPackage := "org.scalafmt.tests",
)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.scalafmt.community
package org.scalafmt.community.common

import scala.meta._

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.scalafmt.community
package org.scalafmt.community.common

import scala.meta._

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.scalafmt.community
package org.scalafmt.community.common

import org.scalafmt.config._

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.scalafmt.community
package org.scalafmt.community.common

import org.scalafmt.CompatCollections.JavaConverters._
import org.scalafmt.CompatCollections.ParConverters._
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.scalafmt.community
package org.scalafmt.community.common

case class TestStats(
checkedFiles: Int,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.scalafmt.community
package org.scalafmt.community.common

import org.scalafmt.config._
import org.scalafmt.rewrite._
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
package org.scalafmt.community
package org.scalafmt.community.other

import org.scalafmt.community.common.CommunityRepoSuite

import scala.meta._

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
package org.scalafmt.community
package org.scalafmt.community.scala2

import org.scalafmt.community.common.CommunityRepoSuite

import scala.meta._

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
package org.scalafmt.community
package org.scalafmt.community.scala3

import org.scalafmt.community.common.CommunityRepoSuite

import scala.meta._

Expand Down

0 comments on commit eb17315

Please sign in to comment.