Mercurial > kallithea
comparison Jenkinsfile @ 6583:8a60eb2b7603
Jenkinsfile: run each py.test on a separate executor
Running all py.test processes in parallel on the same executor is not a good idea.
If a node has not much RAM, it could run out of memory when all py.test processes
run at the same time. And If there are only 2 CPU cores, it doesn't make sense
to run more then 2 processes either.
Therefore use a separate executor for each one. The py.test processes will thus
only run in parallel if there are multiple Jenkins executors available.
author | domruf <dominikruf@gmail.com> |
---|---|
date | Sun, 09 Apr 2017 00:13:17 +0200 |
parents | 15a12f2a47b4 |
children | 0acb46763886 |
comparison
equal
deleted
inserted
replaced
6582:1ae319cb41b1 | 6583:8a60eb2b7603 |
---|---|
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%' |
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 |
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', |
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 |
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 |
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 } |