forked from qentinelqi/qweb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
178 lines (173 loc) · 12.2 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
#!groovy
pipeline {
options {
timeout(time: 1, unit: 'HOURS')
}
agent none
stages {
stage('Static analysis & Unit tests') {
parallel {
stage('Linux analysis & unit tests') {
agent {label 'robot-worker'}
steps {
withCredentials([usernameColonPassword(credentialsId: 'JFROG_API_KEY_UPLOAD', variable: 'JFROG_API_KEY')]) {
sh 'pip install tox'
sh 'pip install flake8'
sh 'pip install coverage'
sh 'tox -- pipdeptree --warn suppress'
sh 'xvfb-run --auto-servernum tox -- pylint QWeb'
sh 'xvfb-run --auto-servernum tox -- pylint test'
sh 'xvfb-run --auto-servernum tox -- pylint *.py'
sh 'xvfb-run --auto-servernum tox -- flake8 --verbose --max-line-length=100 QWeb'
sh 'xvfb-run --auto-servernum tox -- flake8 --verbose --max-line-length=100 test/unit'
sh 'xvfb-run --auto-servernum tox -e py36 -- pydocstyle QWeb/keywords'
sh 'xvfb-run tox -- pytest -v --junit-xml=unittests.xml --cov=QWeb'
junit 'unittests.xml'
archiveArtifacts 'unittests.xml'
}
}
}
stage('Windows analysis & unit tests') {
agent {label 'windows-at-aws'}
steps {
withCredentials([usernameColonPassword(credentialsId: 'JFROG_API_KEY_UPLOAD', variable: 'JFROG_API_KEY')]) {
bat 'tox -- python -m pipdeptree'
bat 'tox -- python -m pylint QWeb --disable=C0328'
bat 'tox -- python -m pylint test --disable=C0328'
bat 'tox -- python -m pytest -v --junit-xml=win_unittests.xml --cov=QWeb'
//bat 'tox -- python -m pip install --upgrade robotframework-lint'
//bat 'tox -- python -m rflint --ignore FileTooLong test/acceptance'
junit 'win_unittests.xml'
archiveArtifacts 'win_unittests.xml'
}
}
}
}
}
stage('Acceptance & system tests'){
parallel {
stage('Linux') {
stages {
stage('Chrome Linux') {
environment {
BROWSER = "chrome"
}
agent {label 'robot-worker'}
steps {
withCredentials([usernameColonPassword(credentialsId: 'JFROG_API_KEY_UPLOAD', variable: 'JFROG_API_KEY')]) {
sh 'pip install tox'
sh 'pip install coverage'
sh 'export DISPLAY=:88'
sh 'Xvfb $DISPLAY -screen 0 1920x1080x24 & sleep 1'
sh 'matchbox-window-manager -use_titlebar no &'
sh label: 'Chrome version', returnStdout: false, script: 'google-chrome --version'
sh label: 'Chrome driver version', returnStdout: false, script: 'chromedriver --version'
retry(2) {
sh 'tox -e py36 -- coverage run --append -m robot --exitonfailure -e jailed -e WITH_DEBUGFILE -v BROWSER:$BROWSER -d output/$BROWSER/py36 --name QWeb -L TRACE --xunit xunit_report.xml test/acceptance'
sh 'tox -e py36 -- coverage run --append -m robot --exitonfailure -e jailed -i WITH_DEBUGFILE -v BROWSER:$BROWSER -d output/$BROWSER/py36_debug --name QWeb -b debug.txt test/acceptance'
}
sh 'tox -e py36 -- coverage run --append -m robot.rebot --merge -d output/$BROWSER/py36 -o output.xml -l log.html -r report.html output/$BROWSER/py36/output.xml output/$BROWSER/py36_debug/output.xml'
sh 'tox -e py36 -- coverage html --directory=output/$BROWSER/py36/coverage'
sh 'tox -e py36 -- coverage xml -o coverage.xml'
sh 'tox -- python -m robot -e jailed -v BROWSER:$BROWSER -d system_output/$BROWSER/steam -L trace --pythonpath . --pythonpath test/system/steam/libraries test/system/steam/tests/steam.robot'
}
}
post {
always {
archiveArtifacts 'output/**/*'
junit 'output/**/py36/xunit_report.xml'
step([$class: 'CoberturaPublisher', coberturaReportFile: 'coverage.xml'])
}
}
}
stage('Firefox Linux') {
when {expression { return env.GIT_BRANCH == 'master' } }
environment {
BROWSER = "firefox"
}
agent {label 'robot-worker'}
steps {
withCredentials([usernameColonPassword(credentialsId: 'JFROG_API_KEY_UPLOAD', variable: 'JFROG_API_KEY')]) {
sh 'pip install tox'
sh 'pip install coverage'
sh label: 'Firefox version', returnStdout: false, script: 'firefox --version'
sh label: 'Gecko driver version', returnStdout: false, script: 'geckodriver --version'
sh 'export DISPLAY=:88'
sh 'Xvfb $DISPLAY -screen 0 1920x1080x24 & sleep 1'
sh 'matchbox-window-manager -use_titlebar no &'
retry(2) {
sh 'tox -e py36 -- coverage run --append -m robot --exitonfailure -e jailed -e WITH_DEBUGFILE -e PROBLEM_IN_FIREFOX -v BROWSER:$BROWSER -d output/$BROWSER/py36 --name QWeb -L TRACE --xunit xunit_report.xml test/acceptance'
sh 'tox -e py36 -- coverage run --append -m robot --exitonfailure -e jailed -i WITH_DEBUGFILE -e PROBLEM_IN_FIREFOX -v BROWSER:$BROWSER -d output/$BROWSER/py36_debug --name QWeb -b debug.txt test/acceptance'
}
sh 'tox -e py36 -- coverage run --append -m robot.rebot --merge -d output/$BROWSER/py36 -o output.xml -l log.html -r report.html output/$BROWSER/py36/output.xml output/$BROWSER/py36_debug/output.xml'
sh 'tox -e py36 -- coverage html --directory=output/$BROWSER/py36/coverage'
sh 'tox -e py36 -- coverage xml -o coverage.xml'
sh 'tox -- python -m robot -e jailed -v BROWSER:$BROWSER -d system_output/$BROWSER/steam -L trace --pythonpath . --pythonpath test/system/steam/libraries test/system/steam/tests/steam.robot'
}
}
post {
always {
archiveArtifacts 'output/**/*'
junit 'output/**/py36/xunit_report.xml'
step([$class: 'CoberturaPublisher', coberturaReportFile: 'coverage.xml'])
}
}
}
}
}
stage('Windows') {
stages {
stage('Chrome Windows') {
environment {
BROWSER = "chrome"
}
agent {label 'windows-at-aws'}
steps {
withCredentials([usernameColonPassword(credentialsId: 'JFROG_API_KEY_UPLOAD', variable: 'JFROG_API_KEY')]) {
bat label: 'Chrome version', returnStdout: false, script: 'echo Chrome version: & reg query "HKEY_CURRENT_USER\\Software\\Google\\Chrome\\BLBeacon" /v version'
bat label: 'Chrome driver version', returnStdout: false, script: 'chromedriver --version'
retry(2) {
// GPU needs to be disabled when running in headless mode in our AWS Windows (probably due to missing updates).
// See https://bugs.chromium.org/p/chromium/issues/detail?id=737678
bat 'tox -e py36 -- python -m robot --exitonfailure -e jailed -e PROBLEM_IN_WINDOWS -e WITH_DEBUGFILE -v browser:%BROWSER% -v browser_options:"--disable-gpu" -d win_output/%BROWSER%/py36 --name QWeb -L TRACE --xunit xunit_report.xml test/acceptance'
bat 'tox -e py36 -- python -m robot --exitonfailure -e jailed -i WITH_DEBUGFILE -v browser:%BROWSER% -v browser_options:"--disable-gpu" -d win_output/%BROWSER%/py36_debug --name QWeb -b debug.txt test/acceptance'
}
bat 'tox -e py36 -- python -m robot.rebot --merge -d win_output/%BROWSER%/py36 -o output.xml -l log.html -r report.html win_output/%BROWSER%/py36/output.xml win_output/%BROWSER%/py36_debug/output.xml'
}
}
post {
always {
archiveArtifacts 'win_output/**/*'
junit 'win_output/**/py36/xunit_report.xml'
}
}
}
stage('Firefox Windows') {
when {expression { return env.GIT_BRANCH == 'master' } }
environment {
BROWSER = "firefox"
}
agent {label 'windows-at-aws'}
steps {
withCredentials([usernameColonPassword(credentialsId: 'JFROG_API_KEY_UPLOAD', variable: 'JFROG_API_KEY')]) {
bat label: 'Gecko driver version', returnStdout: false, script: 'geckodriver --version'
retry(2) {
bat 'tox -e py36 -- python -m robot --exitonfailure -e jailed -e PROBLEM_IN_WINDOWS -e WITH_DEBUGFILE -e PROBLEM_IN_FIREFOX -v BROWSER:%BROWSER% -d win_output/%BROWSER%/py36 --name QWeb -L TRACE --xunit xunit_report.xml test/acceptance'
bat 'tox -e py36 -- python -m robot --exitonfailure -e jailed -e PROBLEM_IN_FIREFOX -i WITH_DEBUGFILE -v BROWSER:%BROWSER% -d win_output/%BROWSER%/py36_debug --name QWeb -b debug.txt test/acceptance'
}
bat 'tox -e py36 -- python -m robot.rebot --merge -d win_output/%BROWSER%/py36 -o output.xml -l log.html -r report.html win_output/%BROWSER%/py36/output.xml win_output/%BROWSER%/py36_debug/output.xml'
}
}
post {
always {
archiveArtifacts 'win_output/**/*'
junit 'win_output/**/py36/xunit_report.xml'
}
}
}
}
}
}
}
}
}