Show More
@@ -1,166 +1,181 b'' | |||||
|
1 | def createvirtualenv = '' | |||
|
2 | def activatevirtualenv = '' | |||
|
3 | ||||
1 | node { |
|
4 | node { | |
2 | def createvirtualenv = '' |
|
|||
3 | def activatevirtualenv = '' |
|
|||
4 | if (isUnix()) { |
|
5 | if (isUnix()) { | |
5 | createvirtualenv = 'rm -r $JENKINS_HOME/venv/$JOB_NAME || true && virtualenv $JENKINS_HOME/venv/$JOB_NAME' |
|
6 | createvirtualenv = 'rm -r $JENKINS_HOME/venv/$JOB_NAME || true && virtualenv $JENKINS_HOME/venv/$JOB_NAME' | |
6 | activatevirtualenv = '. $JENKINS_HOME/venv/$JOB_NAME/bin/activate' |
|
7 | activatevirtualenv = '. $JENKINS_HOME/venv/$JOB_NAME/bin/activate' | |
7 | } else { |
|
8 | } else { | |
8 | createvirtualenv = 'rmdir /s /q %JENKINS_HOME%\\venv\\%JOB_NAME% || true && virtualenv %JENKINS_HOME%\\venv\\%JOB_NAME%' |
|
9 | createvirtualenv = 'rmdir /s /q %JENKINS_HOME%\\venv\\%JOB_NAME% || true && virtualenv %JENKINS_HOME%\\venv\\%JOB_NAME%' | |
9 | activatevirtualenv = 'call %JENKINS_HOME%\\venv\\%JOB_NAME%\\Scripts\\activate.bat' |
|
10 | activatevirtualenv = 'call %JENKINS_HOME%\\venv\\%JOB_NAME%\\Scripts\\activate.bat' | |
10 | } |
|
11 | } | |
11 |
|
12 | |||
12 | stage('checkout') { |
|
13 | stage('checkout') { | |
13 | checkout scm |
|
14 | checkout scm | |
14 | if (isUnix()) { |
|
15 | if (isUnix()) { | |
15 | sh 'hg --config extensions.purge= purge --all' |
|
16 | sh 'hg --config extensions.purge= purge --all' | |
16 | } else { |
|
17 | } else { | |
17 | bat 'hg --config extensions.purge= purge --all' |
|
18 | bat 'hg --config extensions.purge= purge --all' | |
18 | } |
|
19 | } | |
19 | } |
|
20 | } | |
20 | stage('virtual env') { |
|
21 | stage('virtual env') { | |
21 | def virtualenvscript = """$createvirtualenv |
|
22 | def virtualenvscript = """$createvirtualenv | |
22 | $activatevirtualenv |
|
23 | $activatevirtualenv | |
23 | python -m pip install --upgrade pip |
|
24 | python -m pip install --upgrade pip | |
24 | pip install --upgrade setuptools |
|
25 | pip install --upgrade setuptools | |
25 | pip install --upgrade pylint |
|
26 | pip install --upgrade pylint | |
26 | pip install --upgrade pytest-cov |
|
27 | pip install --upgrade pytest-cov | |
27 | """ |
|
28 | """ | |
28 | if (isUnix()) { |
|
29 | if (isUnix()) { | |
29 | virtualenvscript += """ |
|
30 | virtualenvscript += """ | |
30 | pip install --upgrade python-ldap |
|
31 | pip install --upgrade python-ldap | |
31 | pip install --upgrade python-pam |
|
32 | pip install --upgrade python-pam | |
32 | """ |
|
33 | """ | |
33 | sh virtualenvscript |
|
34 | sh virtualenvscript | |
34 | } else { |
|
35 | } else { | |
35 | bat virtualenvscript |
|
36 | bat virtualenvscript | |
36 | } |
|
37 | } | |
37 | } |
|
38 | } | |
38 | stage('setup') { |
|
39 | stage('setup') { | |
39 | def virtualenvscript = """$activatevirtualenv |
|
40 | def virtualenvscript = """$activatevirtualenv | |
40 | pip install --upgrade -e . |
|
41 | pip install --upgrade -e . | |
41 | pip install -r dev_requirements.txt |
|
42 | pip install -r dev_requirements.txt | |
42 | python setup.py compile_catalog |
|
43 | python setup.py compile_catalog | |
43 | """ |
|
44 | """ | |
44 | if (isUnix()) { |
|
45 | if (isUnix()) { | |
45 | sh virtualenvscript |
|
46 | sh virtualenvscript | |
46 | } else { |
|
47 | } else { | |
47 | bat virtualenvscript |
|
48 | bat virtualenvscript | |
48 | } |
|
49 | } | |
49 | stash name: 'kallithea', useDefaultExcludes: false |
|
50 | stash name: 'kallithea', useDefaultExcludes: false | |
50 | } |
|
51 | } | |
51 | stage('pylint') { |
|
52 | stage('pylint') { | |
52 | sh script: """$activatevirtualenv |
|
53 | sh script: """$activatevirtualenv | |
53 | pylint -j 0 --disable=C -f parseable kallithea > pylint.out |
|
54 | pylint -j 0 --disable=C -f parseable kallithea > pylint.out | |
54 | """, returnStatus: true |
|
55 | """, returnStatus: true | |
55 | archiveArtifacts 'pylint.out' |
|
56 | archiveArtifacts 'pylint.out' | |
56 | try { |
|
57 | try { | |
57 | step([$class: 'WarningsPublisher', canComputeNew: false, canResolveRelativePaths: false, defaultEncoding: '', excludePattern: '', healthy: '', includePattern: '', messagesPattern: '', parserConfigurations: [[parserName: 'PyLint', pattern: 'pylint.out']], unHealthy: '']) |
|
58 | step([$class: 'WarningsPublisher', canComputeNew: false, canResolveRelativePaths: false, defaultEncoding: '', excludePattern: '', healthy: '', includePattern: '', messagesPattern: '', parserConfigurations: [[parserName: 'PyLint', pattern: 'pylint.out']], unHealthy: '']) | |
58 | } catch (java.lang.IllegalArgumentException exc) { |
|
59 | } catch (java.lang.IllegalArgumentException exc) { | |
59 | echo "You need to install the 'Warnings Plug-in' to display the pylint report." |
|
60 | echo "You need to install the 'Warnings Plug-in' to display the pylint report." | |
60 | currentBuild.result = 'UNSTABLE' |
|
61 | currentBuild.result = 'UNSTABLE' | |
61 | echo "Caught: ${exc}" |
|
62 | echo "Caught: ${exc}" | |
62 | } |
|
63 | } | |
63 | } |
|
64 | } | |
64 | def pytests = [:] |
|
65 | } | |
65 | pytests['sqlite'] = { |
|
66 | ||
|
67 | def pytests = [:] | |||
|
68 | pytests['sqlite'] = { | |||
|
69 | node { | |||
66 | ws { |
|
70 | ws { | |
67 | deleteDir() |
|
71 | deleteDir() | |
68 | unstash name: 'kallithea' |
|
72 | unstash name: 'kallithea' | |
69 | if (isUnix()) { |
|
73 | if (isUnix()) { | |
70 | sh script: """$activatevirtualenv |
|
74 | sh script: """$activatevirtualenv | |
71 | 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 --cov-report xml | |
72 | """, returnStatus: true |
|
76 | """, returnStatus: true | |
73 | } else { |
|
77 | } else { | |
74 | bat script: """$activatevirtualenv |
|
78 | bat script: """$activatevirtualenv | |
75 | 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 --cov-report xml | |
76 | """, returnStatus: true |
|
80 | """, returnStatus: true | |
77 | } |
|
81 | } | |
78 | sh 'sed --in-place "s/\\(classname=[\'\\"]\\)/\\1SQLITE./g" pytest_sqlite.xml' |
|
82 | sh 'sed --in-place "s/\\(classname=[\'\\"]\\)/\\1SQLITE./g" pytest_sqlite.xml' | |
79 | archiveArtifacts 'pytest_sqlite.xml' |
|
83 | archiveArtifacts 'pytest_sqlite.xml' | |
80 | junit 'pytest_sqlite.xml' |
|
84 | junit 'pytest_sqlite.xml' | |
81 | try { |
|
85 | try { | |
82 | step([$class: 'CoberturaPublisher', autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: 'coverage.xml', failNoReports: false, failUnhealthy: false, failUnstable: false, maxNumberOfBuilds: 0, onlyStable: false, zoomCoverageChart: false]) |
|
86 | step([$class: 'CoberturaPublisher', autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: 'coverage.xml', failNoReports: false, failUnhealthy: false, failUnstable: false, maxNumberOfBuilds: 0, onlyStable: false, zoomCoverageChart: false]) | |
83 | } catch (java.lang.IllegalArgumentException exc) { |
|
87 | } catch (java.lang.IllegalArgumentException exc) { | |
84 | echo "You need to install the pipeline compatible 'CoberturaPublisher Plug-in' to display the coverage report." |
|
88 | echo "You need to install the pipeline compatible 'CoberturaPublisher Plug-in' to display the coverage report." | |
85 | currentBuild.result = 'UNSTABLE' |
|
89 | currentBuild.result = 'UNSTABLE' | |
86 | echo "Caught: ${exc}" |
|
90 | echo "Caught: ${exc}" | |
87 | } |
|
91 | } | |
88 | } |
|
92 | } | |
89 | } |
|
93 | } | |
90 | if (isUnix()) { |
|
94 | } | |
91 | pytests['de'] = { |
|
95 | ||
|
96 | pytests['de'] = { | |||
|
97 | node { | |||
|
98 | if (isUnix()) { | |||
92 | ws { |
|
99 | ws { | |
93 | deleteDir() |
|
100 | deleteDir() | |
94 | unstash name: 'kallithea' |
|
101 | unstash name: 'kallithea' | |
95 | withEnv(['LANG=de_DE.UTF-8', |
|
102 | withEnv(['LANG=de_DE.UTF-8', | |
96 | 'LANGUAGE=de', |
|
103 | 'LANGUAGE=de', | |
97 | 'LC_ADDRESS=de_DE.UTF-8', |
|
104 | 'LC_ADDRESS=de_DE.UTF-8', | |
98 | 'LC_IDENTIFICATION=de_DE.UTF-8', |
|
105 | 'LC_IDENTIFICATION=de_DE.UTF-8', | |
99 | 'LC_MEASUREMENT=de_DE.UTF-8', |
|
106 | 'LC_MEASUREMENT=de_DE.UTF-8', | |
100 | 'LC_MONETARY=de_DE.UTF-8', |
|
107 | 'LC_MONETARY=de_DE.UTF-8', | |
101 | 'LC_NAME=de_DE.UTF-8', |
|
108 | 'LC_NAME=de_DE.UTF-8', | |
102 | 'LC_NUMERIC=de_DE.UTF-8', |
|
109 | 'LC_NUMERIC=de_DE.UTF-8', | |
103 | 'LC_PAPER=de_DE.UTF-8', |
|
110 | 'LC_PAPER=de_DE.UTF-8', | |
104 | 'LC_TELEPHONE=de_DE.UTF-8', |
|
111 | 'LC_TELEPHONE=de_DE.UTF-8', | |
105 | 'LC_TIME=de_DE.UTF-8', |
|
112 | 'LC_TIME=de_DE.UTF-8', | |
106 | ]) { |
|
113 | ]) { | |
107 | sh script: """$activatevirtualenv |
|
114 | sh script: """$activatevirtualenv | |
108 | py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_de.xml --cov=kallithea --cov-report xml |
|
115 | py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_de.xml --cov=kallithea --cov-report xml | |
109 | """, returnStatus: true |
|
116 | """, returnStatus: true | |
110 | } |
|
117 | } | |
111 | sh 'sed --in-place "s/\\(classname=[\'\\"]\\)/\\1DE./g" pytest_de.xml' |
|
118 | sh 'sed --in-place "s/\\(classname=[\'\\"]\\)/\\1DE./g" pytest_de.xml' | |
112 | archiveArtifacts 'pytest_de.xml' |
|
119 | archiveArtifacts 'pytest_de.xml' | |
113 | junit 'pytest_de.xml' |
|
120 | junit 'pytest_de.xml' | |
114 | } |
|
121 | } | |
115 | } |
|
122 | } | |
116 | pytests['mysql'] = { |
|
123 | } | |
|
124 | } | |||
|
125 | pytests['mysql'] = { | |||
|
126 | node { | |||
|
127 | if (isUnix()) { | |||
117 | ws { |
|
128 | ws { | |
118 | deleteDir() |
|
129 | deleteDir() | |
119 | unstash name: 'kallithea' |
|
130 | unstash name: 'kallithea' | |
120 | sh """$activatevirtualenv |
|
131 | sh """$activatevirtualenv | |
121 | pip install --upgrade MySQL-python |
|
132 | pip install --upgrade MySQL-python | |
122 | """ |
|
133 | """ | |
123 | withEnv(['TEST_DB=mysql://kallithea:kallithea@jenkins_mysql/kallithea_test?charset=utf8']) { |
|
134 | withEnv(['TEST_DB=mysql://kallithea:kallithea@jenkins_mysql/kallithea_test?charset=utf8']) { | |
124 | if (isUnix()) { |
|
135 | if (isUnix()) { | |
125 | sh script: """$activatevirtualenv |
|
136 | sh script: """$activatevirtualenv | |
126 | py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_mysql.xml --cov=kallithea --cov-report xml |
|
137 | py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_mysql.xml --cov=kallithea --cov-report xml | |
127 | """, returnStatus: true |
|
138 | """, returnStatus: true | |
128 | } else { |
|
139 | } else { | |
129 | bat script: """$activatevirtualenv |
|
140 | bat script: """$activatevirtualenv | |
130 | py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_mysql.xml --cov=kallithea --cov-report xml |
|
141 | py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_mysql.xml --cov=kallithea --cov-report xml | |
131 | """, returnStatus: true |
|
142 | """, returnStatus: true | |
132 | } |
|
143 | } | |
133 | } |
|
144 | } | |
134 | sh 'sed --in-place "s/\\(classname=[\'\\"]\\)/\\1MYSQL./g" pytest_mysql.xml' |
|
145 | sh 'sed --in-place "s/\\(classname=[\'\\"]\\)/\\1MYSQL./g" pytest_mysql.xml' | |
135 | archiveArtifacts 'pytest_mysql.xml' |
|
146 | archiveArtifacts 'pytest_mysql.xml' | |
136 | junit 'pytest_mysql.xml' |
|
147 | junit 'pytest_mysql.xml' | |
137 | } |
|
148 | } | |
138 | } |
|
149 | } | |
139 | pytests['postgresql'] = { |
|
150 | } | |
|
151 | } | |||
|
152 | pytests['postgresql'] = { | |||
|
153 | node { | |||
|
154 | if (isUnix()) { | |||
140 | ws { |
|
155 | ws { | |
141 | deleteDir() |
|
156 | deleteDir() | |
142 | unstash name: 'kallithea' |
|
157 | unstash name: 'kallithea' | |
143 | sh """$activatevirtualenv |
|
158 | sh """$activatevirtualenv | |
144 | pip install --upgrade psycopg2 |
|
159 | pip install --upgrade psycopg2 | |
145 | """ |
|
160 | """ | |
146 | withEnv(['TEST_DB=postgresql://kallithea:kallithea@jenkins_postgresql/kallithea_test']) { |
|
161 | withEnv(['TEST_DB=postgresql://kallithea:kallithea@jenkins_postgresql/kallithea_test']) { | |
147 | if (isUnix()) { |
|
162 | if (isUnix()) { | |
148 | sh script: """$activatevirtualenv |
|
163 | sh script: """$activatevirtualenv | |
149 | py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_postgresql.xml --cov=kallithea --cov-report xml |
|
164 | py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_postgresql.xml --cov=kallithea --cov-report xml | |
150 | """, returnStatus: true |
|
165 | """, returnStatus: true | |
151 | } else { |
|
166 | } else { | |
152 | bat script: """$activatevirtualenv |
|
167 | bat script: """$activatevirtualenv | |
153 | py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_postgresql.xml --cov=kallithea --cov-report xml |
|
168 | py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_postgresql.xml --cov=kallithea --cov-report xml | |
154 | """, returnStatus: true |
|
169 | """, returnStatus: true | |
155 | } |
|
170 | } | |
156 | } |
|
171 | } | |
157 | sh 'sed --in-place "s/\\(classname=[\'\\"]\\)/\\1POSTGRES./g" pytest_postgresql.xml' |
|
172 | sh 'sed --in-place "s/\\(classname=[\'\\"]\\)/\\1POSTGRES./g" pytest_postgresql.xml' | |
158 | archiveArtifacts 'pytest_postgresql.xml' |
|
173 | archiveArtifacts 'pytest_postgresql.xml' | |
159 | junit 'pytest_postgresql.xml' |
|
174 | junit 'pytest_postgresql.xml' | |
160 | } |
|
175 | } | |
161 | } |
|
176 | } | |
162 | } |
|
177 | } | |
163 | stage('Tests') { |
|
|||
164 | parallel pytests |
|
|||
165 | } |
|
|||
166 | } |
|
178 | } | |
|
179 | stage('Tests') { | |||
|
180 | parallel pytests | |||
|
181 | } |
General Comments 0
You need to be logged in to leave comments.
Login now