##// END OF EJS Templates
jenkinsfile: combine coverage files from different DB runs
domruf -
r6849:0acb4676 default
parent child Browse files
Show More
@@ -12,3 +12,8 b' omit ='
12 # the scm hooks are not run in the kallithea process
12 # the scm hooks are not run in the kallithea process
13 kallithea/config/post_receive_tmpl.py
13 kallithea/config/post_receive_tmpl.py
14 kallithea/config/pre_receive_tmpl.py
14 kallithea/config/pre_receive_tmpl.py
15
16 [paths]
17 source =
18 kallithea/
19 **/workspace/*/kallithea
@@ -72,23 +72,18 b" pytests['sqlite'] = {"
72 unstash name: 'kallithea'
72 unstash name: 'kallithea'
73 if (isUnix()) {
73 if (isUnix()) {
74 sh script: """$activatevirtualenv
74 sh script: """$activatevirtualenv
75 py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_sqlite.xml --cov=kallithea --cov-report xml
75 py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_sqlite.xml --cov=kallithea
76 """, returnStatus: true
76 """, returnStatus: true
77 } else {
77 } else {
78 bat script: """$activatevirtualenv
78 bat script: """$activatevirtualenv
79 py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_sqlite.xml --cov=kallithea --cov-report xml
79 py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_sqlite.xml --cov=kallithea
80 """, returnStatus: true
80 """, returnStatus: true
81 }
81 }
82 sh 'sed --in-place "s/\\(classname=[\'\\"]\\)/\\1SQLITE./g" pytest_sqlite.xml'
82 sh 'sed --in-place "s/\\(classname=[\'\\"]\\)/\\1SQLITE./g" pytest_sqlite.xml'
83 archiveArtifacts 'pytest_sqlite.xml'
83 archiveArtifacts 'pytest_sqlite.xml'
84 junit 'pytest_sqlite.xml'
84 junit 'pytest_sqlite.xml'
85 try {
85 writeFile(file: '.coverage.sqlite', text: readFile('.coverage'))
86 step([$class: 'CoberturaPublisher', autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: 'coverage.xml', failNoReports: false, failUnhealthy: false, failUnstable: false, maxNumberOfBuilds: 0, onlyStable: false, zoomCoverageChart: false])
86 stash name: 'coverage.sqlite', includes: '.coverage.sqlite'
87 } catch (java.lang.IllegalArgumentException exc) {
88 echo "You need to install the pipeline compatible 'CoberturaPublisher Plug-in' to display the coverage report."
89 currentBuild.result = 'UNSTABLE'
90 echo "Caught: ${exc}"
91 }
92 }
87 }
93 }
88 }
94 }
89 }
@@ -112,12 +107,14 b" pytests['de'] = {"
112 'LC_TIME=de_DE.UTF-8',
107 'LC_TIME=de_DE.UTF-8',
113 ]) {
108 ]) {
114 sh script: """$activatevirtualenv
109 sh script: """$activatevirtualenv
115 py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_de.xml --cov=kallithea --cov-report xml
110 py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_de.xml --cov=kallithea
116 """, returnStatus: true
111 """, returnStatus: true
117 }
112 }
118 sh 'sed --in-place "s/\\(classname=[\'\\"]\\)/\\1DE./g" pytest_de.xml'
113 sh 'sed --in-place "s/\\(classname=[\'\\"]\\)/\\1DE./g" pytest_de.xml'
119 archiveArtifacts 'pytest_de.xml'
114 archiveArtifacts 'pytest_de.xml'
120 junit 'pytest_de.xml'
115 junit 'pytest_de.xml'
116 writeFile(file: '.coverage.de', text: readFile('.coverage'))
117 stash name: 'coverage.de', includes: '.coverage.de'
121 }
118 }
122 }
119 }
123 }
120 }
@@ -134,17 +131,19 b" pytests['mysql'] = {"
134 withEnv(['TEST_DB=mysql://kallithea:kallithea@jenkins_mysql/kallithea_test?charset=utf8']) {
131 withEnv(['TEST_DB=mysql://kallithea:kallithea@jenkins_mysql/kallithea_test?charset=utf8']) {
135 if (isUnix()) {
132 if (isUnix()) {
136 sh script: """$activatevirtualenv
133 sh script: """$activatevirtualenv
137 py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_mysql.xml --cov=kallithea --cov-report xml
134 py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_mysql.xml --cov=kallithea
138 """, returnStatus: true
135 """, returnStatus: true
139 } else {
136 } else {
140 bat script: """$activatevirtualenv
137 bat script: """$activatevirtualenv
141 py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_mysql.xml --cov=kallithea --cov-report xml
138 py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_mysql.xml --cov=kallithea
142 """, returnStatus: true
139 """, returnStatus: true
143 }
140 }
144 }
141 }
145 sh 'sed --in-place "s/\\(classname=[\'\\"]\\)/\\1MYSQL./g" pytest_mysql.xml'
142 sh 'sed --in-place "s/\\(classname=[\'\\"]\\)/\\1MYSQL./g" pytest_mysql.xml'
146 archiveArtifacts 'pytest_mysql.xml'
143 archiveArtifacts 'pytest_mysql.xml'
147 junit 'pytest_mysql.xml'
144 junit 'pytest_mysql.xml'
145 writeFile(file: '.coverage.mysql', text: readFile('.coverage'))
146 stash name: 'coverage.mysql', includes: '.coverage.mysql'
148 }
147 }
149 }
148 }
150 }
149 }
@@ -161,21 +160,47 b" pytests['postgresql'] = {"
161 withEnv(['TEST_DB=postgresql://kallithea:kallithea@jenkins_postgresql/kallithea_test']) {
160 withEnv(['TEST_DB=postgresql://kallithea:kallithea@jenkins_postgresql/kallithea_test']) {
162 if (isUnix()) {
161 if (isUnix()) {
163 sh script: """$activatevirtualenv
162 sh script: """$activatevirtualenv
164 py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_postgresql.xml --cov=kallithea --cov-report xml
163 py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_postgresql.xml --cov=kallithea
165 """, returnStatus: true
164 """, returnStatus: true
166 } else {
165 } else {
167 bat script: """$activatevirtualenv
166 bat script: """$activatevirtualenv
168 py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_postgresql.xml --cov=kallithea --cov-report xml
167 py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_postgresql.xml --cov=kallithea
169 """, returnStatus: true
168 """, returnStatus: true
170 }
169 }
171 }
170 }
172 sh 'sed --in-place "s/\\(classname=[\'\\"]\\)/\\1POSTGRES./g" pytest_postgresql.xml'
171 sh 'sed --in-place "s/\\(classname=[\'\\"]\\)/\\1POSTGRES./g" pytest_postgresql.xml'
173 archiveArtifacts 'pytest_postgresql.xml'
172 archiveArtifacts 'pytest_postgresql.xml'
174 junit 'pytest_postgresql.xml'
173 junit 'pytest_postgresql.xml'
174 writeFile(file: '.coverage.postgresql', text: readFile('.coverage'))
175 stash name: 'coverage.postgresql', includes: '.coverage.postgresql'
175 }
176 }
176 }
177 }
177 }
178 }
178 }
179 }
179 stage('Tests') {
180 stage('Tests') {
180 parallel pytests
181 parallel pytests
182 node {
183 unstash 'coverage.sqlite'
184 unstash 'coverage.de'
185 unstash 'coverage.mysql'
186 unstash 'coverage.postgresql'
187 if (isUnix()) {
188 sh script: """$activatevirtualenv
189 coverage combine .coverage.sqlite .coverage.de .coverage.mysql .coverage.postgresql
190 coverage xml
191 """, returnStatus: true
192 } else {
193 bat script: """$activatevirtualenv
194 coverage combine .coverage.sqlite .coverage.de .coverage.mysql .coverage.postgresql
195 coverage xml
196 """, returnStatus: true
197 }
198 try {
199 step([$class: 'CoberturaPublisher', autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: 'coverage.xml', failNoReports: false, failUnhealthy: false, failUnstable: false, maxNumberOfBuilds: 0, onlyStable: false, zoomCoverageChart: false])
200 } catch (java.lang.IllegalArgumentException exc) {
201 echo "You need to install the pipeline compatible 'CoberturaPublisher Plug-in' to display the coverage report."
202 currentBuild.result = 'UNSTABLE'
203 echo "Caught: ${exc}"
204 }
205 }
181 }
206 }
General Comments 0
You need to be logged in to leave comments. Login now