send coverage results to codacy after every successful ci build

This commit is contained in:
erciccione 2022-01-18 19:34:27 +00:00 committed by woodser
parent 295e20bf04
commit 6ea642555e
2 changed files with 21 additions and 0 deletions

View File

@ -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

View File

@ -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
}