100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Add JaCoCo integration to OpenRemote for tracking code coverage (#2349)
Panos Kalogeropoulosc37ee1c2bda2
diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.ymlindex 65b6d68ff..f7eac330a 100644--- a/.github/workflows/ci_cd.yml+++ b/.github/workflows/ci_cd.yml@@ -769,6 +769,12 @@ jobs:name: backend-test-resultspath: test/build/reports/tests+ - name: Archive coverage report+ uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4+ with:+ name: coverage-report+ path: test/build/reports/jacoco/test/html+- name: Cleanup backend testsif: ${{ steps.test-backend-command.outputs.value != '' }}run: ${{ steps.run-backend-tests.outputs.cleanup }}diff --git a/project.gradle b/project.gradleindex ef57b1d80..b3c58e812 100644--- a/project.gradle+++ b/project.gradle@@ -2,6 +2,19 @@import org.jetbrains.gradle.ext.JUnit+apply plugin: 'jacoco'++jacoco {+ toolVersion = "0.8.14"+}++tasks.withType(JacocoReport) {+ reports {+ xml.required = true+ html.required = true+ }+}+import java.nio.file.Filesimport java.nio.file.Pathsimport java.nio.file.attribute.PosixFileAttributesdiff --git a/test/build.gradle b/test/build.gradleindex 654c4b1f3..b99d869ff 100644--- a/test/build.gradle+++ b/test/build.gradle@@ -1,4 +1,5 @@plugins {+ id "jacoco"id 'com.adarshr.test-logger' version '4.0.0'}@@ -43,7 +44,36 @@ tasks.withType(Test) {environment("OR_LOGGING_CONFIG_FILE", "logging-dev.properties")}-test {}+test {+ finalizedBy jacocoTestReport+}++jacocoTestReport {+ dependsOn test++ sourceDirectories.from(+ project(':agent').sourceSets.main.allSource.srcDirs,+ project(':container').sourceSets.main.allSource.srcDirs,+ project(':manager').sourceSets.main.allSource.srcDirs,+ project(':model').sourceSets.main.allSource.srcDirs,+ project(':model-util').sourceSets.main.allSource.srcDirs,+ project(':setup').sourceSets.main.allSource.srcDirs+ )++ classDirectories.from(+ project(':agent').sourceSets.main.output,+ project(':container').sourceSets.main.output,+ project(':manager').sourceSets.main.output,+ project(':model').sourceSets.main.output,+ project(':model-util').sourceSets.main.output,+ project(':setup').sourceSets.main.output+ )++ reports {+ xml.required = true+ html.required = true+ }+}javadoc {failOnError = false