Skip to content

Commit

Permalink
Clean up the shard-splitting code
Browse files Browse the repository at this point in the history
Instead of having hacky "hibernate1" and "hibernate2" groups inside
misk, unify them back into a single group. We can use gradle task
exclusion to run certain tasks in separate shards as needed.

GitOrigin-RevId: 8ad2c94fcf2c6529ff3f87f5daa8fdf153c96a73
  • Loading branch information
staktrace authored and svc-squareup-copybara committed Jul 18, 2024
1 parent 4ab474b commit f3aa257
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 24 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ jobs:
strategy:
matrix:
cmd:
- gradle testShardHibernate1 -i --scan --no-parallel
- gradle testShardHibernate2 -i --scan --no-parallel
- gradle testShardHibernate -i --scan --no-parallel
- gradle testShardRedis -i --scan --no-parallel
- gradle testShardNonHibernate -i --scan --parallel

Expand Down
27 changes: 5 additions & 22 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -131,30 +131,15 @@ val testShardRedis = tasks.register("testShardRedis") {
description = "These tests use redis and thus can't run in parallel"
}

val testShardHibernate1 = tasks.register("testShardHibernate1") {
val testShardHibernate = tasks.register("testShardHibernate") {
group = "Continuous integration"
description = "These tests use a DB and thus can't run in parallel"
}

val testShardHibernate2 = tasks.register("testShardHibernate2") {
group = "Continuous integration"
description = "These tests use a DB and thus can't run in parallel"
}

// I've split the hibernate-requiring projects into two groups
// that should take roughly the same amount of time, based on
// a recent build scan:
// https://scans.gradle.com/s/lchid7o4myy7m/tests/overview?toggled=WyI6bWlzay1qZGJjOnRlc3QtMCIsIjptaXNrLWhpYmVybmF0ZTp0ZXN0LTEiLCI6bWlzay1hd3M6dGVzdC0yIiwiOm1pc2stc3FsZGVsaWdodDp0ZXN0LTMiLCI6bWlzay1ldmVudHM6dGVzdC00IiwiOm1pc2stam9icXVldWU6dGVzdC01IiwiOm1pc2stcmF0ZS1saW1pdGluZy1idWNrZXQ0ai1teXNxbDp0ZXN0LTYiXQ
// If we ever need to fiddle with this again we should do this in
// a more dynamic way.

val hibernateProjects1 = listOf(
val hibernateProjects = listOf(
"misk-aws",
"misk-hibernate",
)

val hibernateProjects2 = listOf(
"misk-events",
"misk-hibernate",
"misk-jobqueue",
"misk-jobqueue-testing",
"misk-jdbc",
Expand Down Expand Up @@ -275,10 +260,8 @@ subprojects {

plugins.withType<BasePlugin> {
val subproj = project
if (hibernateProjects1.contains(project.name)) {
testShardHibernate1.configure { dependsOn("${subproj.path}:check") }
} else if (hibernateProjects2.contains(project.name)) {
testShardHibernate2.configure { dependsOn("${subproj.path}:check") }
if (hibernateProjects.contains(project.name)) {
testShardHibernate.configure { dependsOn("${subproj.path}:check") }
} else if (redisProjects.contains(project.name)) {
testShardRedis.configure { dependsOn("${subproj.path}:check") }
} else {
Expand Down
4 changes: 4 additions & 0 deletions misk-rate-limiting-bucket4j-redis/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ dependencies {
testImplementation(libs.junitApi)
}

tasks.withType<Test> {
dependsOn(":startRedis")
}

mavenPublishing {
configure(
KotlinJvm(javadocJar = JavadocJar.Dokka("dokkaGfm"))
Expand Down

0 comments on commit f3aa257

Please sign in to comment.