Skip to content

Instantly share code, notes, and snippets.

@sergiocasero
Created November 21, 2022 10:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sergiocasero/f6ad46a37718b2b3ba8908f792f7ccd0 to your computer and use it in GitHub Desktop.
Save sergiocasero/f6ad46a37718b2b3ba8908f792f7ccd0 to your computer and use it in GitHub Desktop.
test:
stage: test
script:
- ./gradlew test jacocoTestReport
tags:
- docker-L
artifacts:
paths:
- shared/build/reports/jacoco.xml
coverage:
stage: visualize
image: registry.gitlab.com/haynes/jacoco2cobertura:1.0.7
script:
# convert report from jacoco to cobertura, using relative project path
- python /opt/cover2cover.py shared/build/reports/jacoco.xml $CI_PROJECT_DIR/shared/commonMain/kotlin >build/cobertura.xml
needs: [ "test" ]
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: build/cobertura.xml
tasks.register<JacocoReport>("jacocoTestReport") {
group = "Reporting"
description = "Generate Jacoco coverage reports after running tests."
classDirectories.setFrom(fileTree("${buildDir}/tmp/kotlin-classes/debug") {
setIncludes(setOf("**/**/*.class", "**/**/*.class"))
})
sourceDirectories.setFrom(files(arrayOf("src/commonMain", "src/androidMain")))
executionData.setFrom(fileTree(project.projectDir) {
setIncludes(setOf("**/**/*.exec", "**/**/*.ec"))
})
reports {
xml.required.set(true)
html.required.set(true)
xml.outputLocation.set(file("${buildDir}/reports/jacoco.xml"))
html.outputLocation.set(file("${buildDir}/reports/jacoco"))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment