From 1ba210e93f91f78a104b8a7e6c0981603ae93b25 Mon Sep 17 00:00:00 2001 From: napoly Date: Sun, 9 Apr 2023 18:13:47 +0200 Subject: [PATCH] Aggregate and send coverage report to Codacy --- .github/workflows/build.yml | 11 +++ build.gradle | 23 +++-- gradle/verification-metadata.xml | 153 ++++++------------------------- 3 files changed, 54 insertions(+), 133 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bf12e778f8..91a2d27fd3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,3 +36,14 @@ jobs: name: gradlew-report path: 'desktop/build/reports/tests/test/index.html' retention-days: 30 + + publish_coverage: + runs-on: ubuntu-latest + needs: build + steps: + - uses: actions/checkout@v3 + - name: Run codacy-coverage-reporter + uses: codacy/codacy-coverage-reporter-action@v1.3.0 + with: + project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} + coverage-reports: /build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml diff --git a/build.gradle b/build.gradle index 1771e8fa42..f345cf9c37 100644 --- a/build.gradle +++ b/build.gradle @@ -28,6 +28,7 @@ configure(subprojects) { apply plugin: 'com.google.osdetector' // Apply the jacoco plugin to add support for test coverage apply plugin: 'jacoco' + apply plugin: 'jacoco-report-aggregation' apply plugin: 'checkstyle' sourceCompatibility = JavaVersion.VERSION_11 @@ -47,7 +48,7 @@ configure(subprojects) { grpcVersion = '1.42.1' gsonVersion = '2.8.5' guavaVersion = '30.1.1-jre' - guiceVersion = '4.2.2' + guiceVersion = '5.1.0' moneroJavaVersion = '0.7.15' httpclient5Version = '5.0' hamcrestVersion = '1.3' @@ -100,7 +101,7 @@ configure(subprojects) { checkstyle { toolVersion = '10.8.1' // https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-10.8.1/src/main/resources/google_checks.xml - configFile = rootProject.file("${rootDir}/config/checkstyle/checkstyle.xml") + configFile = rootProject.file("$rootDir/config/checkstyle/checkstyle.xml") } tasks.withType(Checkstyle) { @@ -108,14 +109,20 @@ configure(subprojects) { maxHeapSize.set('1g') } - jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) + jacoco { + toolVersion = "0.8.9" + reportsDirectory = file("$rootDir/build/reports/jacoco") + } + + test.finalizedBy { + testCodeCoverageReport { + // tests are required to run before generating the report + reports { + xml.required.set(true) + html.required.set(false) + } } } - // Codacy report generated with every build at assets/build/reports/jacoco/test/jacocoTestReport.xml - test.finalizedBy jacocoTestReport } configure([project(':cli'), diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index 7aa08be4b0..5ce63f2e73 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -831,17 +831,9 @@ - - - - - - - - - - - + + + @@ -2376,43 +2368,19 @@ - - - - - - + + + - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - + + + @@ -2420,6 +2388,11 @@ + + + + + @@ -3120,76 +3093,14 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + @@ -3197,22 +3108,9 @@ - - - - - - - - - - - - - - - - + + + @@ -3220,6 +3118,11 @@ + + + + +