# HG changeset patch # User domruf # Date 1503344548 -7200 # Node ID 0acb4676388614a9bc93918679092b5d4134b64e # Parent d2f20f3d21170d7d5615d8d5b6532ce9ab46c0b3 jenkinsfile: combine coverage files from different DB runs diff -r d2f20f3d2117 -r 0acb46763886 .coveragerc --- a/.coveragerc Sun Aug 13 15:43:03 2017 +0200 +++ b/.coveragerc Mon Aug 21 21:42:28 2017 +0200 @@ -12,3 +12,8 @@ # the scm hooks are not run in the kallithea process kallithea/config/post_receive_tmpl.py kallithea/config/pre_receive_tmpl.py + +[paths] +source = + kallithea/ + **/workspace/*/kallithea diff -r d2f20f3d2117 -r 0acb46763886 Jenkinsfile --- a/Jenkinsfile Sun Aug 13 15:43:03 2017 +0200 +++ b/Jenkinsfile Mon Aug 21 21:42:28 2017 +0200 @@ -72,23 +72,18 @@ unstash name: 'kallithea' if (isUnix()) { sh script: """$activatevirtualenv - py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_sqlite.xml --cov=kallithea --cov-report xml + py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_sqlite.xml --cov=kallithea """, returnStatus: true } else { bat script: """$activatevirtualenv - py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_sqlite.xml --cov=kallithea --cov-report xml + py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_sqlite.xml --cov=kallithea """, returnStatus: true } sh 'sed --in-place "s/\\(classname=[\'\\"]\\)/\\1SQLITE./g" pytest_sqlite.xml' archiveArtifacts 'pytest_sqlite.xml' junit 'pytest_sqlite.xml' - try { - step([$class: 'CoberturaPublisher', autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: 'coverage.xml', failNoReports: false, failUnhealthy: false, failUnstable: false, maxNumberOfBuilds: 0, onlyStable: false, zoomCoverageChart: false]) - } catch (java.lang.IllegalArgumentException exc) { - echo "You need to install the pipeline compatible 'CoberturaPublisher Plug-in' to display the coverage report." - currentBuild.result = 'UNSTABLE' - echo "Caught: ${exc}" - } + writeFile(file: '.coverage.sqlite', text: readFile('.coverage')) + stash name: 'coverage.sqlite', includes: '.coverage.sqlite' } } } @@ -112,12 +107,14 @@ 'LC_TIME=de_DE.UTF-8', ]) { sh script: """$activatevirtualenv - py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_de.xml --cov=kallithea --cov-report xml + py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_de.xml --cov=kallithea """, returnStatus: true } sh 'sed --in-place "s/\\(classname=[\'\\"]\\)/\\1DE./g" pytest_de.xml' archiveArtifacts 'pytest_de.xml' junit 'pytest_de.xml' + writeFile(file: '.coverage.de', text: readFile('.coverage')) + stash name: 'coverage.de', includes: '.coverage.de' } } } @@ -134,17 +131,19 @@ withEnv(['TEST_DB=mysql://kallithea:kallithea@jenkins_mysql/kallithea_test?charset=utf8']) { if (isUnix()) { sh script: """$activatevirtualenv - py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_mysql.xml --cov=kallithea --cov-report xml + py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_mysql.xml --cov=kallithea """, returnStatus: true } else { bat script: """$activatevirtualenv - py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_mysql.xml --cov=kallithea --cov-report xml + py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_mysql.xml --cov=kallithea """, returnStatus: true } } sh 'sed --in-place "s/\\(classname=[\'\\"]\\)/\\1MYSQL./g" pytest_mysql.xml' archiveArtifacts 'pytest_mysql.xml' junit 'pytest_mysql.xml' + writeFile(file: '.coverage.mysql', text: readFile('.coverage')) + stash name: 'coverage.mysql', includes: '.coverage.mysql' } } } @@ -161,21 +160,47 @@ withEnv(['TEST_DB=postgresql://kallithea:kallithea@jenkins_postgresql/kallithea_test']) { if (isUnix()) { sh script: """$activatevirtualenv - py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_postgresql.xml --cov=kallithea --cov-report xml + py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_postgresql.xml --cov=kallithea """, returnStatus: true } else { bat script: """$activatevirtualenv - py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_postgresql.xml --cov=kallithea --cov-report xml + py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_postgresql.xml --cov=kallithea """, returnStatus: true } } sh 'sed --in-place "s/\\(classname=[\'\\"]\\)/\\1POSTGRES./g" pytest_postgresql.xml' archiveArtifacts 'pytest_postgresql.xml' junit 'pytest_postgresql.xml' + writeFile(file: '.coverage.postgresql', text: readFile('.coverage')) + stash name: 'coverage.postgresql', includes: '.coverage.postgresql' } } } } stage('Tests') { parallel pytests + node { + unstash 'coverage.sqlite' + unstash 'coverage.de' + unstash 'coverage.mysql' + unstash 'coverage.postgresql' + if (isUnix()) { + sh script: """$activatevirtualenv + coverage combine .coverage.sqlite .coverage.de .coverage.mysql .coverage.postgresql + coverage xml + """, returnStatus: true + } else { + bat script: """$activatevirtualenv + coverage combine .coverage.sqlite .coverage.de .coverage.mysql .coverage.postgresql + coverage xml + """, returnStatus: true + } + try { + step([$class: 'CoberturaPublisher', autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: 'coverage.xml', failNoReports: false, failUnhealthy: false, failUnstable: false, maxNumberOfBuilds: 0, onlyStable: false, zoomCoverageChart: false]) + } catch (java.lang.IllegalArgumentException exc) { + echo "You need to install the pipeline compatible 'CoberturaPublisher Plug-in' to display the coverage report." + currentBuild.result = 'UNSTABLE' + echo "Caught: ${exc}" + } + } }