This is an automated email from the ASF dual-hosted git repository. zabetak pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/calcite.git
The following commit(s) were added to refs/heads/main by this push: new fe821caaa5 [CALCITE-5475] Improve test coverage accuracy by aggregating modules fe821caaa5 is described below commit fe821caaa5db0050bfa6f01a8c0397a20973138f Author: Stamatis Zampetakis <zabe...@gmail.com> AuthorDate: Fri Jan 13 17:02:53 2023 +0100 [CALCITE-5475] Improve test coverage accuracy by aggregating modules Considering the modules in isolation leads to some modules (e.g., testkit) reporting low coverage. The use of jacoco-report-aggregation plugin alleviates the problem by aggregating the coverage analysis from the individual modules into one unified report. While testing the changes there was one Jenkins job that got stuck and kept running for almost ~24h. To prevent similar situation in the future a 1h timeout is set in the code quality stage. Close apache/calcite#3027 --- Jenkinsfile | 14 ++++++++------ build.gradle.kts | 17 +++++++++++++++++ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2f2aee558f..53cc1e6f31 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -40,12 +40,14 @@ node('ubuntu') { } } stage('Code Quality') { - withEnv(["Path+JDK=$JAVA_JDK_17/bin","JAVA_HOME=$JAVA_JDK_17"]) { - withCredentials([string(credentialsId: 'SONARCLOUD_TOKEN', variable: 'SONAR_TOKEN')]) { - if ( env.BRANCH_NAME.startsWith("PR-") ) { - sh './gradlew --no-parallel --no-daemon build jacocoTestReport sonar -PenableJacoco -Dsonar.pullrequest.branch=${CHANGE_BRANCH} -Dsonar.pullrequest.base=${CHANGE_TARGET} -Dsonar.pullrequest.key=${CHANGE_ID} -Dsonar.login=${SONAR_TOKEN}' - } else { - sh './gradlew --no-parallel --no-daemon build jacocoTestReport sonar -PenableJacoco -Dsonar.branch.name=${BRANCH_NAME} -Dsonar.login=${SONAR_TOKEN}' + timeout(time: 1, unit: 'HOURS') { + withEnv(["Path+JDK=$JAVA_JDK_17/bin","JAVA_HOME=$JAVA_JDK_17"]) { + withCredentials([string(credentialsId: 'SONARCLOUD_TOKEN', variable: 'SONAR_TOKEN')]) { + if ( env.BRANCH_NAME.startsWith("PR-") ) { + sh './gradlew --no-parallel --no-daemon jacocoAggregateTestReport sonar -PenableJacoco -Dsonar.pullrequest.branch=${CHANGE_BRANCH} -Dsonar.pullrequest.base=${CHANGE_TARGET} -Dsonar.pullrequest.key=${CHANGE_ID} -Dsonar.login=${SONAR_TOKEN}' + } else { + sh './gradlew --no-parallel --no-daemon jacocoAggregateTestReport sonar -PenableJacoco -Dsonar.branch.name=${BRANCH_NAME} -Dsonar.login=${SONAR_TOKEN}' + } } } } diff --git a/build.gradle.kts b/build.gradle.kts index ec1e8f9468..bbde9d140f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -39,6 +39,7 @@ plugins { checkstyle calcite.buildext jacoco + id("jacoco-report-aggregation") id("org.checkerframework") apply false id("com.github.autostyle") id("org.nosphere.apache.rat") @@ -171,6 +172,16 @@ releaseParams { } } +reporting { + reports { + if (enableJacoco) { + val jacocoAggregateTestReport by creating(JacocoCoverageReport::class) { + testType.set(TestSuiteType.UNIT_TEST) + } + } + } +} + val javadocAggregate by tasks.registering(Javadoc::class) { group = JavaBasePlugin.DOCUMENTATION_GROUP description = "Generates aggregate javadoc for all the artifacts" @@ -229,6 +240,11 @@ dependencies { for (m in dataSetsForSqlline) { sqllineClasspath(module(m)) } + if (enableJacoco) { + for (p in subprojects) { + jacocoAggregation(p) + } + } } val buildSqllineClasspath by tasks.registering(Jar::class) { @@ -300,6 +316,7 @@ fun com.github.autostyle.gradle.BaseFormatExtension.license() { sonarqube { properties { property("sonar.test.inclusions", "**/*Test*/**") + property("sonar.coverage.jacoco.xmlReportPaths", "$buildDir/reports/jacoco/jacocoAggregateTestReport/jacocoAggregateTestReport.xml") } }