diff --git a/build.gradle.kts b/build.gradle.kts index 8f23cc429b..6ac826dbc8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,5 @@ import org.gradle.api.tasks.testing.logging.TestExceptionFormat +import org.gradle.testretry.TestRetryPlugin /* * Copyright [2021-present] [ahoo wang (https://github.com/Ahoo-Wang)]. @@ -14,6 +15,7 @@ import org.gradle.api.tasks.testing.logging.TestExceptionFormat */ plugins { + alias(libs.plugins.testRetry) alias(libs.plugins.publishPlugin) alias(libs.plugins.jmhPlugin) alias(libs.plugins.spotbugsPlugin) @@ -42,7 +44,7 @@ val testProject = project(":cosid-test") val codeCoverageReportProject = project(":code-coverage-report") val publishProjects = subprojects - serverProjects - codeCoverageReportProject val libraryProjects = publishProjects - bomProjects - +val isInCI = null != System.getenv("CI") ext.set("libraryProjects", libraryProjects) allprojects { @@ -114,7 +116,7 @@ configure(libraryProjects) { fork.set(1) jvmArgs.set(listOf("-Dlogback.configurationFile=${rootProject.rootDir}/config/logback-jmh.xml")) } - + apply() tasks.withType { useJUnitPlatform() testLogging { @@ -127,6 +129,13 @@ configure(libraryProjects) { "--add-opens=java.base/java.util=ALL-UNNAMED", "--add-opens=java.base/java.lang=ALL-UNNAMED" ) + retry { + if (isInCI) { + maxRetries = 2 + maxFailures = 20 + } + failOnPassedAfterRetry = true + } } dependencies { @@ -169,14 +178,6 @@ configure(publishProjects) { password = System.getenv("GITHUB_TOKEN") } } - maven { - name = "LinYiPackages" - url = uri(project.properties["linyiPackageReleaseUrl"].toString()) - credentials { - username = project.properties["linyiPackageUsername"]?.toString() - password = project.properties["linyiPackagePwd"]?.toString() - } - } } publications { val publishName = if (isBom) "mavenBom" else "mavenLibrary" @@ -217,7 +218,6 @@ configure(publishProjects) { } configure { - val isInCI = null != System.getenv("CI"); if (isInCI) { val signingKeyId = System.getenv("SIGNING_KEYID") val signingKey = System.getenv("SIGNING_SECRETKEY") diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 8633802a58..d9b77b46b4 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -15,6 +15,7 @@ springDoc = "2.2.0" hamcrest = "2.2" jmh = "1.37" # plugins +testRetry= "1.5.6" publishPlugin = "1.3.0" jmhPlugin = "0.7.2" spotbugs = "5.2.3" @@ -39,7 +40,7 @@ hamcrest = { module = "org.hamcrest:hamcrest", version.ref = "hamcrest" } jmhCore = { module = "org.openjdk.jmh:jmh-core", version.ref = "jmh" } jmhGeneratorAnnprocess = { module = "org.openjdk.jmh:jmh-generator-annprocess", version.ref = "jmh" } [plugins] - +testRetry = { id = "org.gradle.test-retry", version.ref = "testRetry" } publishPlugin = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "publishPlugin" } jmhPlugin = { id = "me.champeau.jmh", version.ref = "jmhPlugin" } spotbugsPlugin = { id = "com.github.spotbugs", version.ref = "spotbugs" }