diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bc4d026c..600aef1a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,6 +28,11 @@ jobs: run: git lfs pull - name: Build with make run: make + - name: Send coverage report to Codacy + env: + CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} + if: success() + run: bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r assets/build/reports/jacoco/test/jacocoTestReport.xml - name: cache nodes dependencies uses: actions/upload-artifact@v2 with: @@ -61,3 +66,8 @@ jobs: run: git lfs pull - name: Build with Gradle run: ./gradlew build --stacktrace --scan + - name: Send coverage report to Codacy + env: + CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} + if: success() + run: bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r assets/build/reports/jacoco/test/jacocoTestReport.xml diff --git a/build.gradle b/build.gradle index dcffd5a6..afab45bd 100644 --- a/build.gradle +++ b/build.gradle @@ -23,6 +23,8 @@ configure(rootProject) { configure(subprojects) { apply plugin: 'java' apply plugin: 'com.google.osdetector' + // Apply the jacoco plugin to add support for test coverage + apply plugin: 'jacoco' sourceCompatibility = 1.10 @@ -91,6 +93,15 @@ configure(subprojects) { tasks.withType(JavaCompile) { options.encoding = 'UTF-8' } + + jacocoTestReport { + reports { + xml.enabled true + html.enabled false + } + } + // Codacy report generated with every build at assets/build/reports/jacoco/test/jacocoTestReport.xml + test.finalizedBy jacocoTestReport }