Kotlin / kotlinx-kover

Apache License 2.0
1.25k stars 46 forks source link

How to create a total coverage file? #596

Open abdullahq3102 opened 1 month ago

abdullahq3102 commented 1 month ago

Hi I am on version 1.0 of kover and want to aggregate all the coverage into a single html or txt file and not sure how to do that.

I see that they made this PR to create that implementation a couple years ago, but I am not sure about how it works since the readme has been changed a lot since then since the link in that PR's readme change no longer works. The coverage for my system is currently generated like this.

container('gradle') {
  withSonarQubeEnv('Name-Sonar-Cloud') {
    shWithRetryOnGradleException("gradle: Sonarqube analysis", """
    ./gradlew koverXmlReport
    ./gradlew koverHtmlReport
    ./gradlew koverCollectReports
    ./gradlew sonarqube --stacktrace \
      -Dsonar.log.level=TRACE \
      -Dsonar.verbose=true \
      -DenableJacoco=true \
      -Dsonar.branch.name="main" \
      -Dsonar.projectName="android" \
      -Dsonar.coverage.jacoco.htmlReportPaths="${env.WORKSPACE}/build/reports/kover/all/*.html"
      -Dsonar.coverage.jacoco.xmlReportPaths="${env.WORKSPACE}/build/reports/kover/all/*.xml"
      """)
      uploadCodeCoverageToS3()
  }
}

I have tried moving the koverCollectReports that to the beginning but that fails since it requires the html or xml files to exist initially. I think I should be able to use this command to modify the output? I found it the current readme but the workflow is completely different from mine so I am not sure how to add it

coverage-overall - [integer] The overall coverage of the project

shanshin commented 1 month ago

Hi, at the moment, there is no version of Kover 1.0 yet.

Could you clarify, have you looked through this documentation?

Without additional information about the project, it is hard to give recommendations, because we need to know the hierarchy of modules in the build, as well as which Kotlin plugin is used in each of them (JVM, multiplatform, Android)