diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af5e8d4b..d9c207ec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/build.gradle b/build.gradle index 1abef41f..ee5f4c88 100644 --- a/build.gradle +++ b/build.gradle @@ -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 { @@ -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' @@ -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 { @@ -99,14 +99,14 @@ 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")) { @@ -114,7 +114,6 @@ publishPlugin { } } - java { toolchain { languageVersion.set(JavaLanguageVersion.of(11))