-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
242 lines (215 loc) · 6.03 KB
/
.gitlab-ci.yml
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "web"'
stages:
- test
- report
- commit
variables:
MAVEN: "3.9.8"
ALLURE: "2.30.0"
EXECUTOR_NAME: "Gitlab CI"
EXECUTOR_TYPE: "gitlab"
PLAYWRIGHT_JAVA: "1.44.0"
PLAYWRIGHT_NODE: "1.44.1"
PLAYWRIGHT_PYTHON: "1.44.0"
TOKEN: "glpat-64VubsDGWUwgPgYkgEjs"
DOCKER:
value: "harmin/qa-runner-debian"
options:
- "harmin/qa-runner-debian"
- "playwright/java"
- "playwright/python"
- "playwright/node.js"
- "selenium/java"
- "selenium/python"
- "cypress"
- "karate"
- "robotframework/playwright"
description: "The docker to run the tests."
BROWSER:
value: "firefox"
options:
- "chrome"
- "chromium"
- "firefox"
- "msedge"
description: "The browser to run the tests."
tests:
stage: test
image: $DOCKER
rules:
- if: $DOCKER == "harmin/qa-runner-debian"
- if: $DOCKER == "harmin/qa-runner-ubuntu"
script:
- export PATH=$PATH:$HOME/.local/bin
- python3 -m venv ~/venv
- . ~/venv/bin/activate
- ./runner.sh --browser $BROWSER
- ./serenity.sh --browser $BROWSER
- echo $CI_JOB_URL > reporting/allure-results/java/job.url
- echo $CI_JOB_URL > reporting/allure-results/nodejs/job.url
- echo $CI_JOB_URL > reporting/allure-results/python/job.url
artifacts:
paths:
- reporting/
expire_in: 10 mins
tests playwright java:
stage: test
image: mcr.microsoft.com/playwright/java:v${PLAYWRIGHT_JAVA}-jammy
rules:
- if: $DOCKER == "playwright/java"
script:
- ./docker.sh --browser $BROWSER --docker playwright/java
- echo $CI_JOB_URL > reporting/allure-results/java/job.url
artifacts:
paths:
- reporting/
expire_in: 10 mins
tests selenium java:
stage: test
image: maven
services:
- name: selenium/standalone-${BROWSER}
alias: selenium-hub
rules:
- if: $DOCKER == "selenium/java"
script:
- ./docker.sh --browser $BROWSER --docker selenium/java --hub selenium-hub
- echo $CI_JOB_URL > reporting/allure-results/java/job.url
artifacts:
paths:
- reporting/
expire_in: 10 mins
tests karate:
stage: test
image: selenium/standalone-${BROWSER}
rules:
- if: $BROWSER == "chromium"
when: never
- if: $BROWSER == "msedge"
when: never
- if: $DOCKER == "karate"
script:
- java --version
#- curl https://download.java.net/openjdk/jdk17/ri/openjdk-17+35_linux-x64_bin.tar.gz -o openjdk-bin.tar.gz
- curl https://download.java.net/openjdk/jdk21/ri/openjdk-21+35_linux-x64_bin.tar.gz -o openjdk-bin.tar.gz
- tar -xf openjdk-bin.tar.gz -C /tmp/
- JAVA_HOME='/tmp/jdk-21'
- PATH="$JAVA_HOME/bin:$PATH"
- curl https://dlcdn.apache.org/maven/maven-3/3.9.8/binaries/apache-maven-3.9.8-bin.tar.gz -o maven-bin.tar.gz
- tar -xf maven-bin.tar.gz -C /tmp/
- M2_HOME='/tmp/apache-maven-3.9.8'
- PATH="$M2_HOME/bin:$PATH"
- export PATH
- ./docker.sh --browser $BROWSER --docker karate
- echo $CI_JOB_URL > reporting/allure-results/java/job.url
- mv tests-java/target/karate-reports reporting/report-karate
artifacts:
paths:
- reporting
expire_in: 10 mins
tests playwright node.js:
stage: test
#image: mcr.microsoft.com/playwright:v${PLAYWRIGHT_NODE}-jammy
image: mcr.microsoft.com/playwright
rules:
- if: $DOCKER == "playwright/node.js"
script:
- ./docker.sh --browser $BROWSER --docker playwright/node.js
- echo $CI_JOB_URL > reporting/allure-results/nodejs/job.url
artifacts:
paths:
- reporting/
expire_in: 10 mins
tests cypress:
stage: test
image: cypress/browsers
# docker:
# user: 1001
rules:
- if: $DOCKER == "cypress"
script:
- ./docker.sh --browser $BROWSER --docker cypress
artifacts:
paths:
- reporting/
expire_in: 10 mins
tests playwright python:
stage: test
image: mcr.microsoft.com/playwright/python:v${PLAYWRIGHT_PYTHON}-jammy
rules:
- if: $DOCKER == "playwright/python"
script:
- ./docker.sh --browser $BROWSER --docker playwright/python
- echo $CI_JOB_URL > reporting/allure-results/python/job.url
artifacts:
paths:
- reporting/
expire_in: 10 mins
tests selenium python:
stage: test
image: python:3.11
services:
- name: selenium/standalone-${BROWSER}
alias: selenium-hub
rules:
- if: $DOCKER == "selenium/python"
script:
- ./docker.sh --browser $BROWSER --docker selenium/python --hub selenium-hub
- echo $CI_JOB_URL > reporting/allure-results/python/job.url
artifacts:
paths:
- reporting/
expire_in: 10 mins
tests robotframework playwright:
stage: test
image: marketsquare/robotframework-browser
rules:
- if: $BROWSER == "chrome"
when: never
- if: $BROWSER == "msedge"
when: never
- if: $DOCKER == "robotframework/playwright"
script:
- ./docker.sh --browser $BROWSER --docker robotframework/playwright
#- echo $CI_JOB_URL > reporting/allure-results/python/job.url
artifacts:
paths:
- reporting/
expire_in: 10 mins
allure report:
stage: report
image: openjdk:8-jre
script:
- curl https://github.com/allure-framework/allure2/releases/download/${ALLURE}/allure-${ALLURE}.zip -L -o /tmp/allure.zip
- unzip /tmp/allure.zip -d /usr/local/
- ln -s /usr/local/allure-${ALLURE}/bin/allure /usr/local/bin/allure
- ./allure.sh --browser $BROWSER
artifacts:
paths:
- reporting
expire_in: 10 mins
commit:
stage: commit
image: bitnami/git
script:
- git config --global user.name "Gitlab CI"
- git config --global user.email "[email protected]"
- git clone https://gitlab-ci-token:${TOKEN}@gitlab.com/harmin-demo/reports.git
- cd reports
- git rm -r report-*
- mv ../reporting/report-* ./
- mv ../reporting/allure-reports/report-* ./
- git add *
- git commit -m "Gitlab-CI commit"
- git push
#pages:
# stage: pages
# script:
# - mkdir public
# - mv reporting/allure-reports/* public/
# - mv reporting/report-* public/
# artifacts:
# paths:
# - public