Add code coverage to Jenkins
timw4mail/json-parser/pipeline/head This commit looks good Details

This commit is contained in:
Timothy Warren 2020-02-20 13:08:13 -05:00
parent cefaa86ded
commit 6fa2f100b4
2 changed files with 26 additions and 0 deletions

12
Jenkinsfile vendored
View File

@ -2,6 +2,7 @@ pipeline {
agent {
docker {
image 'rust:latest'
args '-u root --privileged'
}
}
stages {
@ -15,5 +16,16 @@ pipeline {
sh "cargo test"
}
}
stage('Coverage') {
steps {
sh "cargo install cargo-tarpaulin"
sh "make generate-coverage"
}
}
}
post {
always {
cobertura coberturaReportFile: 'cobertura.xml'
}
}
}

14
Makefile Normal file
View File

@ -0,0 +1,14 @@
coverage: coverage.html
coverage.html: coverage-report
generate-coverage:
cargo tarpaulin --out Xml
coverage-report: generate-coverage
pycobertura show --format html --output coverage.html cobertura.xml
clean:
cargo clean
rm cobertura.xml
rm coverage.html