build: change coverage scheme
Instead of overwriting coverages have branch specific targets.
This allows for comparision of coverage in PRs and the master branch.
@@ -410,7 +410,7 @@ kill `pidof dbus-daemon`
*/
archive(artifacts)
if(test_coverage) {
- publishCoverage(test_name)
+ publishCoverage()
}
if(test_mem || test_nokdb || test_all) {
xunitUpload()
@@ -507,19 +507,29 @@ def cmake(String directory, Map args_map) {
}
/* Publishes coverage reports
- * @param test_name Name of the test for identification
*/
-def publishCoverage(String test_name) {
+def publishCoverage() {
echo "Start publication of coverage data"
- sh "mkdir -p ssh/coverage/ || true"
- sh "mv build/coverage ssh/coverage/${test_name} || true"
+ def uniquePrefix = 'publishCoverage'
+ def branchDir = 'unknownBranch'
+ if(isMaster()) {
+ branchDir = 'master'
+ } else {
+ branchDir = "PR_${env.ghprbPullId}"
+ }
+ def uploadDir = "${uniquePrefix}/${branchDir}/${env.STAGE_NAME}"
+
+ sh "mkdir -p ${uploadDir}"
+ sh "mv build/coverage ${uploadDir}"
+
sshPublisher(publishers: [
sshPublisherDesc(
configName: 'doc.libelektra.org',
transfers: [
sshTransfer(
- sourceFiles: 'ssh/**',
- removePrefix: 'ssh'
+ sourceFiles: '${uploadDir}/**',
+ removePrefix: uniquePrefix,
+ remoteDir: 'coverage'
)
])
])
