Do not abort on failing test, if we run on ci server

This commit is contained in:
Sebastian Sdorra
2021-01-13 14:32:07 +01:00
committed by René Pfeuffer
parent 9e597bb9e0
commit 22375c8096
7 changed files with 35 additions and 13 deletions

View File

@@ -57,6 +57,25 @@ class JavaModulePlugin implements Plugin<Project> {
failOnError false
}
project.afterEvaluate {
if (project.isCI) {
project.plugins.apply("jacoco")
project.jacocoTestReport {
reports {
xml.enabled true
}
}
}
project.test {
useJUnitPlatform()
if (project.isCI){
ignoreFailures = true
finalizedBy project.jacocoTestReport
}
}
}
project.publishing {
publications {
mavenJava(MavenPublication) {

View File

@@ -144,6 +144,8 @@ project.ext {
VersionNumber v = VersionNumber.parse(project.version)
nextSnapshotVersion = "${v.major}.${v.minor}.${v.micro + 1}-SNAPSHOT"
isCI = isRunningOnCiServer()
}
publishing {
@@ -168,6 +170,17 @@ publishing {
}
}
// determine if we run on ci
def isRunningOnCiServer() {
return isEnvAvailable("JENKINS_URL") && isEnvAvailable("BUILD_ID")
}
def isEnvAvailable(String key) {
String value = System.getenv(key)
return value != null && !value.trim().isEmpty()
}
// release related tasks
task setVersion {

View File

@@ -122,6 +122,3 @@ jar {
dependsOn 'build-info'
}
test {
useJUnitPlatform()
}

View File

@@ -37,7 +37,3 @@ dependencies {
compileOnly libraries.lombok
annotationProcessor libraries.lombok
}
test {
useJUnitPlatform()
}

View File

@@ -76,6 +76,7 @@ test {
task javaIntegrationTests(type: Test) {
include '**/*ITCase.class'
exclude '**/*Test.class'
ignoreFailures = project.isCI
dependsOn 'test', 'startScmServer'
mustRunAfter 'startScmServer'
@@ -90,6 +91,7 @@ node {
task e2eTests(type: YarnTask) {
args = ['run', 'e2e-tests']
ignoreExitValue = project.isCI
mustRunAfter 'startScmServer'
dependsOn 'yarn_install', 'startScmServer'
}

View File

@@ -66,6 +66,7 @@ task test(type: YarnTask) {
})
.withPathSensitivity(PathSensitivity.RELATIVE)
outputs.dir('build/jest-reports')
ignoreExitValue = project.isCI
dependsOn('yarn_install')
}

View File

@@ -201,9 +201,3 @@ fix java.lang.NoClassDefFoundError org/w3c/dom/ElementTraversal
<version>1.4.01</version>
</dependency>
**/
test {
useJUnitPlatform()
// TODO integration tests
exclude '**/*ITCase.class'
}