diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 2a7eee72..318afbf5 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -83,7 +83,7 @@ jobs: - uses: actions/setup-java@v3 with: distribution: 'temurin' - java-version: '11' + java-version: '17' # Setup node - uses: actions/setup-node@v3 @@ -163,7 +163,7 @@ jobs: RESTATE_CONTAINER_IMAGE: ${{ inputs.restateCommit != '' && 'localhost:5000/restatedev/restate:latest' || '' }} JAVA_SDK_LOCAL_BUILD: ${{ inputs.sdkJavaCommit != '' && 'true' || '' }} with: - arguments: -Djib.console=plain check + arguments: --continue -Djib.console=plain check build-root-directory: e2e # Upload container logs diff --git a/build.gradle.kts b/build.gradle.kts index 63362345..b60ca057 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -13,10 +13,14 @@ import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.getCurr plugins { java - alias(libs.plugins.spotless) - kotlin("jvm") version "1.8.21" apply false - kotlin("plugin.serialization") version "1.8.21" apply false - alias(libs.plugins.jib) apply false + + // Declare plugins used by subprojects + id("com.diffplug.spotless") version "6.22.0" apply false + kotlin("jvm") version "1.9.22" apply false + kotlin("plugin.serialization") version "1.9.22" apply false + id("com.google.cloud.tools.jib") version "3.2.1" apply false + id("net.ltgt.errorprone") version "3.1.0" apply false + id("com.google.protobuf") version "0.9.4" apply false } val restateVersion = libs.versions.restate.get() @@ -75,6 +79,7 @@ allprojects { } } + // Configure the java toolchain to use. If not found, it will be downloaded automatically java { toolchain { languageVersion = JavaLanguageVersion.of(11) } } } @@ -88,15 +93,8 @@ subprojects { apply(plugin = "kotlin") apply(plugin = "com.diffplug.spotless") - val testReport = - tasks.register("testReport") { - destinationDirectory.set(layout.buildDirectory.dir("reports/tests/test")) - testResults.setFrom(subprojects.mapNotNull { it.tasks.findByPath("test") }) - } - tasks.withType { useJUnitPlatform() - finalizedBy(testReport) testLogging { events( TestLogEvent.PASSED, diff --git a/contracts/build.gradle.kts b/contracts/build.gradle.kts index d27f1d59..91f518f8 100644 --- a/contracts/build.gradle.kts +++ b/contracts/build.gradle.kts @@ -13,7 +13,7 @@ import com.google.protobuf.gradle.protobuf plugins { java kotlin("jvm") - alias(libs.plugins.protobuf) + id("com.google.protobuf") } dependencies { diff --git a/services/http-server/build.gradle.kts b/services/http-server/build.gradle.kts index cecfd0b0..f583373b 100644 --- a/services/http-server/build.gradle.kts +++ b/services/http-server/build.gradle.kts @@ -9,10 +9,8 @@ plugins { java - idea - alias(libs.plugins.shadowJar) - alias(libs.plugins.errorprone) - alias(libs.plugins.jib) + id("net.ltgt.errorprone") + id("com.google.cloud.tools.jib") } dependencies { @@ -43,7 +41,6 @@ jib { } } -// Use gradle shadowJar to build the fat jar tasks.jar { manifest { attributes["Main-Class"] = "dev.restate.e2e.testing.externalhttpserver.Main" } } diff --git a/services/java-services/build.gradle.kts b/services/java-services/build.gradle.kts index 7179ee7f..e2a92b0c 100644 --- a/services/java-services/build.gradle.kts +++ b/services/java-services/build.gradle.kts @@ -13,9 +13,8 @@ import com.google.protobuf.gradle.protobuf plugins { java application - alias(libs.plugins.protobuf) - alias(libs.plugins.shadowJar) - alias(libs.plugins.jib) + id("com.google.protobuf") + id("com.google.cloud.tools.jib") } dependencies { @@ -65,7 +64,6 @@ jib { } } -// Use gradle shadowJar to build the fat jar tasks.jar { manifest { attributes["Main-Class"] = "dev.restate.e2e.services.Main" } } application { mainClass.set("dev.restate.e2e.services.Main") } diff --git a/settings.gradle.kts b/settings.gradle.kts index e5d2bbf7..0a598ec2 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -9,6 +9,8 @@ rootProject.name = "restate-e2e" +plugins { id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0" } + include( "contracts", "services:java-services", @@ -80,14 +82,6 @@ dependencyResolutionManagement { library("awaitility", "org.awaitility", "awaitility-kotlin").versionRef("awaitility") library("errorprone", "com.google.errorprone", "error_prone_core").versionRef("errorprone") - - // Plugins - plugin("spotless", "com.diffplug.spotless").version("6.22.0") - plugin("protobuf", "com.google.protobuf").version("0.9.4") - plugin("test-logger", "com.adarshr.test-logger").version("4.0.0") - plugin("errorprone", "net.ltgt.errorprone").version("3.1.0") - plugin("shadowJar", "com.github.johnrengelman.shadow").version("7.1.2") - plugin("jib", "com.google.cloud.tools.jib").version("3.2.1") } } } diff --git a/tests/build.gradle.kts b/tests/build.gradle.kts index d645d308..11d0442c 100644 --- a/tests/build.gradle.kts +++ b/tests/build.gradle.kts @@ -73,66 +73,71 @@ tasks { } } - register("testAlwaysSuspending") { - environment = - environment + - baseRestateEnvironment(name) + - mapOf("RESTATE_WORKER__INVOKER__INACTIVITY_TIMEOUT" to "0s") - - useJUnitPlatform { - // Run all the tests with always-suspending or only-always-suspending tag - includeTags("always-suspending | only-always-suspending") - } - // Increase a bit the default timeout - systemProperties["junit.jupiter.execution.timeout.testable.method.default"] = "30 s" - } - - register("testSingleThreadSinglePartition") { - environment = - environment + - baseRestateEnvironment(name) + - mapOf( - "RESTATE_WORKER__PARTITIONS" to "1", - "RESTATE_TOKIO_RUNTIME__WORKER_THREADS" to "1", - "RESTATE_TOKIO_RUNTIME__MAX_BLOCKING_THREADS" to "1", - ) - - useJUnitPlatform { - // Run all the tests with either no tags, or always-suspending tag - includeTags("none() | always-suspending") - } - // Increase a bit the default timeout - systemProperties["junit.jupiter.execution.timeout.testable.method.default"] = "30 s" - } - - register("testLazyState") { - environment = - environment + - baseRestateEnvironment(name) + - mapOf( - "RESTATE_WORKER__INVOKER__DISABLE_EAGER_STATE" to "true", - ) - - useJUnitPlatform { - // Run all the tests with either no tags, or always-suspending tag - includeTags("lazy-state") - } - } - - register("testPersistedTimers") { - environment = - environment + - baseRestateEnvironment(name) + - mapOf("RESTATE_WORKER__TIMERS__NUM_TIMERS_IN_MEMORY_LIMIT" to "1") - - useJUnitPlatform { - // Run all the tests with always-suspending or only-always-suspending tag - includeTags("timers") - } - // Increase a bit the default timeout - systemProperties["junit.jupiter.execution.timeout.testable.method.default"] = "20 s" - } - + val testAlwaysSuspending by + registering(Test::class) { + environment = + environment + + baseRestateEnvironment(name) + + mapOf("RESTATE_WORKER__INVOKER__INACTIVITY_TIMEOUT" to "0s") + + useJUnitPlatform { + // Run all the tests with always-suspending or only-always-suspending tag + includeTags("always-suspending | only-always-suspending") + } + // Increase a bit the default timeout + systemProperties["junit.jupiter.execution.timeout.testable.method.default"] = "30 s" + } + + val testSingleThreadSinglePartition by + registering(Test::class) { + environment = + environment + + baseRestateEnvironment(name) + + mapOf( + "RESTATE_WORKER__PARTITIONS" to "1", + "RESTATE_TOKIO_RUNTIME__WORKER_THREADS" to "1", + "RESTATE_TOKIO_RUNTIME__MAX_BLOCKING_THREADS" to "1", + ) + + useJUnitPlatform { + // Run all the tests with either no tags, or always-suspending tag + includeTags("none() | always-suspending") + } + // Increase a bit the default timeout + systemProperties["junit.jupiter.execution.timeout.testable.method.default"] = "30 s" + } + + val testLazyState by + registering(Test::class) { + environment = + environment + + baseRestateEnvironment(name) + + mapOf( + "RESTATE_WORKER__INVOKER__DISABLE_EAGER_STATE" to "true", + ) + + useJUnitPlatform { + // Run all the tests with either no tags, or always-suspending tag + includeTags("lazy-state") + } + } + + val testPersistedTimers by + registering(Test::class) { + environment = + environment + + baseRestateEnvironment(name) + + mapOf("RESTATE_WORKER__TIMERS__NUM_TIMERS_IN_MEMORY_LIMIT" to "1") + + useJUnitPlatform { + // Run all the tests with always-suspending or only-always-suspending tag + includeTags("timers") + } + // Increase a bit the default timeout + systemProperties["junit.jupiter.execution.timeout.testable.method.default"] = "20 s" + } + + // Common configuration for all test tasks withType().configureEach { dependsOn(":services:http-server:jibDockerBuild") dependsOn(":services:java-services:jibDockerBuild") @@ -140,11 +145,11 @@ tasks { maxParallelForks = 3 } -} -tasks.named("check") { - dependsOn("testAlwaysSuspending") - dependsOn("testSingleThreadSinglePartition") - dependsOn("testPersistedTimers") - dependsOn("testLazyState") + check { + dependsOn(testAlwaysSuspending) + dependsOn(testSingleThreadSinglePartition) + dependsOn(testPersistedTimers) + dependsOn(testLazyState) + } }