Please improve the documentation on usage of this plugin
sheetalj2205 opened this issue · 1 comments
sheetalj2205 commented
Describe your use-case which is not covered by existing documentation.
I want to integrate code coverage reports of Jacoco into my GitHub PRs. I want to know do I need all the files of this repo also in my project for the integration or if I can simply use the code given in usage in Jenkinsfile in the example. Please check this question for complete desciption: Link
Reference any relevant documentation, other materials or issues/pull requests that can be used for inspiration.
No response
rsov commented
You will need 3 things:
-
Test runner that can output
coverage/cobertura-coverage.xml
file -
This in your jenkinsifle
stage('Record Coverage') {
when { branch 'main' }
steps {
script {
currentBuild.result = 'SUCCESS'
}
step([$class: 'MasterCoverageAction', scmVars: [GIT_URL: env.GIT_URL]])
}
}
stage('PR Coverage to Github') {
when { allOf { not { branch 'main' }; expression { return env.CHANGE_ID != null } } }
steps {
script { currentBuild.result = 'SUCCESS' }
// Don't fail whole pipeline if this step fails
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
step([$class: 'CompareCoverageAction', publishResultAs: 'statusCheck', scmVars: [GIT_URL: env.GIT_URL]])
}
}
}