Skip to content

Commit

Permalink
#317 Add JaCoCo reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
ascheman committed Feb 1, 2024
1 parent ef17d8d commit 14694d1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/gradle-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,12 @@ jobs:
if: always()
with:
files: |
**/build/test-results/**/*.xml
**/build/test-results/**/*.xml
- name: JaCoCo Test Coverage Report
uses: PavanMudigonda/jacoco-reporter@v4.9
with:
coverage_results_path: "htmlSanityCheck-gradle-plugin/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml"
coverage_report_name: Coverage
coverage_report_title: JaCoCo
github_token: ${{ secrets.GITHUB_TOKEN }}
11 changes: 10 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ configure(subprojects) {
apply plugin: 'groovy'
apply plugin: 'maven-publish'

apply plugin: 'jacoco'

description "${rootProject.description} - Module ${project.name}"

dependencies {
Expand All @@ -66,7 +68,7 @@ configure(subprojects) {
maven {
name = 'myLocalRepositoryForFullIntegrationTests'
//noinspection GrDeprecatedAPIUsage
url = new File (project.parent.buildDir, "maven-repo")
url = new File(project.parent.buildDir, "maven-repo")
}
mavenLocal()
}
Expand All @@ -76,6 +78,13 @@ configure(subprojects) {
useJUnitPlatform()
}

check {
finalizedBy jacocoTestReport // report is always generated after tests run
}
jacocoTestReport {
dependsOn check // tests are required to run before generating the report
}

// The CodeNarc plugin performs quality checks on your project’s
// Groovy source files using CodeNarc and generates reports from these checks.
// apply plugin: 'codenarc'
Expand Down
5 changes: 5 additions & 0 deletions htmlSanityCheck-gradle-plugin/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
plugins {
id 'java-gradle-plugin'
id 'jacoco-report-aggregation'
}

tasks.named('check') {
dependsOn tasks.named('testCodeCoverageReport', JacocoReport)
}

gradlePlugin {
Expand Down

0 comments on commit 14694d1

Please sign in to comment.