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