Skip to content

Commit

Permalink
Merge pull request #303 from Checkmarx/other/benalvo/add-coverage-report
Browse files Browse the repository at this point in the history
Jetbrains | Add coverage report (AST-80472)
  • Loading branch information
AlvoBen authored Jan 19, 2025
2 parents f301a76 + d36e046 commit 8036b79
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 18 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,13 @@ jobs:
- name: Run Tests with coverage report
id: test_results
run: |
./gradlew test --tests "com.checkmarx.intellij.standard*" jacocoTestReport
./gradlew test --tests "com.checkmarx.intellij.standard*" JacocoTestReport
- name: Generate JaCoCo Badge
uses: cicirello/jacoco-badge-generator@f33476a5a3fd5a4f77cb5eef2ebe728c1dd5b921 #v2.11.0
with:
jacoco-csv-file: build/reports/jacoco/test/jacocoTestReport.csv

# Save coverage report as an artifact
- name: Upload Coverage Report
uses: actions/upload-artifact@v4
Expand Down
33 changes: 16 additions & 17 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,7 @@ repositories {
}

jacoco {
toolVersion = "0.8.7"
}

tasks.jacocoTestReport {
dependsOn test // Ensure tests run before generating the report
reports {
xml.required.set(true)
html.required.set(true)
}
toolVersion = "0.8.12"
}

dependencies {
Expand All @@ -40,7 +32,7 @@ dependencies {
}
testImplementation 'com.squareup.okio:okio:3.8.0'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.1'
testImplementation 'com.squareup.okhttp3:okhttp:4.9.2'
testImplementation 'com.squareup.okhttp3:okhttp:4.12.0'
testImplementation 'junit:junit:4.11-redhat-1'
testImplementation 'junit:junit:4.13.1'

Expand Down Expand Up @@ -89,8 +81,16 @@ test {
useJUnitPlatform()
systemProperty 'uiWaitDuration', project.findProperty('uiWaitDuration') ?: 300
testLogging {
events "passed", "skipped", "failed", "standardOut", "standardError"
showExceptions true
showCauses true
showStackTraces true
showStandardStreams = true
}
jacoco {
includeNoLocationClasses = true
excludes = ["jdk.internal.*"]
}
}

runIdeForUiTests {
Expand All @@ -99,22 +99,21 @@ runIdeForUiTests {
}

jacocoTestReport {
additionalSourceDirs.setFrom(files(sourceSets.main.allSource.srcDirs))
classDirectories.setFrom(
fileTree(dir: "$buildDir/classes/java/main", excludes: [])
)
executionData.setFrom(fileTree(dir: "$buildDir", includes: ["jacoco/test.exec"]))
dependsOn test
classDirectories.setFrom(instrumentCode)
reports {
csv.required = true
html.required = true
}
}


publishPlugin {
token.set System.getenv("PUBLISH_TOKEN")
if (project.hasProperty("rchannels")) {
channels = [rchannels.toString()]
}
}


java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
Expand Down

0 comments on commit 8036b79

Please sign in to comment.