-
Notifications
You must be signed in to change notification settings - Fork 7
239 lines (208 loc) · 9.97 KB
/
test.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
name: Test webapps
on:
push:
branches:
- 2023.9.x
schedule:
- cron: "30 9 * * *"
jobs:
cypress-run:
name: Cypress run
runs-on: ubuntu-latest
env:
CORTEZA_VERSION: 2023.9.1
CYPRESS_VERSION: 13.5.0
CYPRESS_HOST: http://corteza
CYPRESS_BASE_URL: http://corteza
CYPRESS_ADMIN_URL: http://corteza/admin
CYPRESS_COMPOSE_URL: http://corteza/compose
CYPRESS_WORKFLOW_URL: http://corteza/workflow
CYPRESS_REPORTER_URL: http://corteza/reporter
CYPRESS_ONE_URL: http://corteza/one
CYPRESS_PRIVACY_URL: http://corteza/privacy
CYPRESS_USER_EMAIL: [email protected]
CYPRESS_USER_EMAIL_NEW: [email protected]
CYPRESS_USER_PASSWORD: cypress123
CYPRESS_USER_PASSWORD_NEW: newcypress123
CYPRESS_USER_DPO: [email protected]
CYPRESS_USER_DPO_PASSWORD: [email protected]
AUTH_REQUEST_RATE_LIMIT: 0
FEDERATION_ENABLED: 'true'
FEDERATION_HOST: http://corteza
FEDERATION_LABEL: 'Corteza e2e federation host'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Pull docker images
run: docker-compose -f .github/docker-compose.yaml pull
- name: Run mailhog
run: docker-compose -f .github/docker-compose.yaml --project-directory cypress up -d mailhog
- name: Prepare npm packages
run: yarn
- name: Setup environment
env:
RELEASE_CRUST_SFTP_KEY: ${{ secrets.RELEASE_CRUST_SFTP_KEY }}
RELEASE_CRUST_SFTP_URI: ${{ secrets.RELEASE_CRUST_SFTP_URI }}
run: |
echo "SCREENSHOTS_GEN_FOLDER=$(date +"%Y%m%d%H%M%S")" >> $GITHUB_ENV && \
echo "TMP_KEY=$(mktemp)" >> $GITHUB_ENV
- name: Create crust key
env:
RELEASE_CRUST_SFTP_KEY: ${{ secrets.RELEASE_CRUST_SFTP_KEY }}
RELEASE_CRUST_KEY_FILE: ${{ env.TMP_KEY }}
run: |
echo ${RELEASE_CRUST_SFTP_KEY} | base64 -d > ${RELEASE_CRUST_KEY_FILE}
- name: Make folder for uploaded screenshots
env:
RELEASE_CRUST_SFTP_URI: ${{ secrets.RELEASE_CRUST_SFTP_URI }}
RELEASE_CRUST_KEY_FILE: ${{ env.TMP_KEY }}
SCREENSHOTS_GEN_FOLDER: ${{ env.SCREENSHOTS_GEN_FOLDER }}
run: |
printf '%s\n' 'cd screenshots' "mkdir ${SCREENSHOTS_GEN_FOLDER}" | sftp -q -o "StrictHostKeyChecking no" -i ${RELEASE_CRUST_KEY_FILE} ${RELEASE_CRUST_SFTP_URI}
- name: Run Admin tests
# specs cannot be inserted as --spec=file1.js,file2.js because cypress randomizes the list
run: |
docker-compose -f .github/docker-compose.yaml up -d corteza && \
docker-compose -f .github/docker-compose.yaml --project-directory . run \
--entrypoint='cypress run
--spec cypress/e2e/basic-functionalities/server/Create_user.cy.js
--reporter mochawesome
--browser chrome' \
cypress && \
docker-compose -f .github/docker-compose.yaml --project-directory . run \
--entrypoint='cypress run
--spec cypress/e2e/basic-functionalities/admin/index.cy.js
--reporter mochawesome
--browser chrome' \
cypress
# Cypress overwrites the screenshots folder, we need to do this after
# each failed run
- name: Upload screenshots
if: failure()
env:
RELEASE_CRUST_SFTP_URI: ${{ secrets.RELEASE_CRUST_SFTP_URI }}
RELEASE_CRUST_KEY_FILE: ${{ env.TMP_KEY }}
SCREENSHOTS_GEN_FOLDER: ${{ env.SCREENSHOTS_GEN_FOLDER }}
run: |
printf '%s\n' "cd screenshots/${SCREENSHOTS_GEN_FOLDER}" 'put -r cypress/screenshots/*' | sftp -q -o "StrictHostKeyChecking no" -i ${RELEASE_CRUST_KEY_FILE} ${RELEASE_CRUST_SFTP_URI}
- name: Run Compose tests
if: success() || failure()
run: |
docker-compose -f .github/docker-compose.yaml restart corteza && \
docker-compose -f .github/docker-compose.yaml --project-directory . run \
--entrypoint='cypress run
--spec cypress/e2e/basic-functionalities/server/Create_user.cy.js
--reporter mochawesome
--browser chrome' \
cypress
docker-compose -f .github/docker-compose.yaml --project-directory . run \
--entrypoint='cypress run
--spec cypress/e2e/basic-functionalities/compose/index.cy.js
--reporter mochawesome
--browser chrome' \
cypress
- name: Upload screenshots
if: failure()
env:
RELEASE_CRUST_SFTP_URI: ${{ secrets.RELEASE_CRUST_SFTP_URI }}
RELEASE_CRUST_KEY_FILE: ${{ env.TMP_KEY }}
SCREENSHOTS_GEN_FOLDER: ${{ env.SCREENSHOTS_GEN_FOLDER }}
run: |
printf '%s\n' "cd screenshots/${SCREENSHOTS_GEN_FOLDER}" 'put -r cypress/screenshots/*' | sftp -q -o "StrictHostKeyChecking no" -i ${RELEASE_CRUST_KEY_FILE} ${RELEASE_CRUST_SFTP_URI}
- name: Run Server tests
if: success() || failure()
run: |
docker-compose -f .github/docker-compose.yaml restart corteza && \
docker-compose -f .github/docker-compose.yaml --project-directory . run \
--entrypoint='cypress run
--spec cypress/e2e/basic-functionalities/server/Create_user.cy.js
--reporter mochawesome
--browser chrome' \
cypress
docker-compose -f .github/docker-compose.yaml --project-directory . run \
--entrypoint='cypress run
--spec cypress/e2e/basic-functionalities/one/index.cy.js
--reporter mochawesome
--browser chrome'\
cypress
- name: Upload screenshots
if: failure()
env:
RELEASE_CRUST_SFTP_URI: ${{ secrets.RELEASE_CRUST_SFTP_URI }}
RELEASE_CRUST_KEY_FILE: ${{ env.TMP_KEY }}
SCREENSHOTS_GEN_FOLDER: ${{ env.SCREENSHOTS_GEN_FOLDER }}
run: |
printf '%s\n' "cd screenshots/${SCREENSHOTS_GEN_FOLDER}" 'put -r cypress/screenshots/*' | sftp -q -o "StrictHostKeyChecking no" -i ${RELEASE_CRUST_KEY_FILE} ${RELEASE_CRUST_SFTP_URI}
- name: Run Reporter, topbar, Workflows tests
if: success() || failure()
run: |
docker-compose -f .github/docker-compose.yaml restart corteza && \
docker-compose -f .github/docker-compose.yaml --project-directory . run \
--entrypoint='cypress run
--spec cypress/e2e/basic-functionalities/reporter/index.cy.js,cypress/e2e/basic-functionalities/topbar/index.cy.js,cypress/e2e/basic-functionalities/workflow/index.cy.js
--reporter mochawesome
--browser chrome' \
cypress
- name: Upload screenshots
if: failure()
env:
RELEASE_CRUST_SFTP_URI: ${{ secrets.RELEASE_CRUST_SFTP_URI }}
RELEASE_CRUST_KEY_FILE: ${{ env.TMP_KEY }}
SCREENSHOTS_GEN_FOLDER: ${{ env.SCREENSHOTS_GEN_FOLDER }}
run: |
printf '%s\n' "cd screenshots/${SCREENSHOTS_GEN_FOLDER}" 'put -r cypress/screenshots/*' | sftp -q -o "StrictHostKeyChecking no" -i ${RELEASE_CRUST_KEY_FILE} ${RELEASE_CRUST_SFTP_URI}
- name: Run Server tests
if: success() || failure()
run: |
docker-compose -f .github/docker-compose.yaml restart corteza && \
docker-compose -f .github/docker-compose.yaml --project-directory . run \
--entrypoint='cypress run
--spec cypress/e2e/basic-functionalities/server/index.cy.js
--reporter mochawesome
--browser chrome' \
cypress
- name: Upload screenshots
if: failure()
env:
RELEASE_CRUST_SFTP_URI: ${{ secrets.RELEASE_CRUST_SFTP_URI }}
RELEASE_CRUST_KEY_FILE: ${{ env.TMP_KEY }}
SCREENSHOTS_GEN_FOLDER: ${{ env.SCREENSHOTS_GEN_FOLDER }}
run: |
printf '%s\n' "cd screenshots/${SCREENSHOTS_GEN_FOLDER}" 'put -r cypress/screenshots/*' | sftp -q -o "StrictHostKeyChecking no" -i ${RELEASE_CRUST_KEY_FILE} ${RELEASE_CRUST_SFTP_URI}
- name: Publish results
# always() runs the step even when canceled manually
if: success() || failure()
env:
RELEASE_CRUST_SFTP_URI: ${{ secrets.RELEASE_CRUST_SFTP_URI }}
RELEASE_CRUST_KEY_FILE: ${{ env.TMP_KEY }}
run: |
npx mochawesome-merge "cypress/reports/*.json" > cypress/report.json && \
npx marge -o cypress/reports-build -f index.html -i cypress/report.json && \
echo "put cypress/reports-build/index.html" | sftp -q -o "StrictHostKeyChecking no" -i ${RELEASE_CRUST_KEY_FILE} ${RELEASE_CRUST_SFTP_URI}
- name: Send message on successful testing results
if: success()
uses: fadenb/[email protected]
env:
E2E_REPORTS_USER: ${{ secrets.E2E_REPORTS_USER }}
E2E_REPORTS_PASS: ${{ secrets.E2E_REPORTS_PASS }}
with:
homeserver: ${{ secrets.MATRIX_HOME_SERVER }}
token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
channel: ${{ secrets.MATRIX_ROOM_ID }}
message: |
✅ E2e tests passed 🙌 🎉
🔗 https://${{ secrets.E2E_REPORTS_USER }}:${{ secrets.E2E_REPORTS_PASS }}@releases.cortezaproject.org/e2e-reports/
- name: Send message on failed testing results
if: failure()
uses: fadenb/[email protected]
env:
E2E_REPORTS_USER: ${{ secrets.E2E_REPORTS_USER }}
E2E_REPORTS_PASS: ${{ secrets.E2E_REPORTS_PASS }}
with:
homeserver: ${{ secrets.MATRIX_HOME_SERVER }}
token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
channel: ${{ secrets.MATRIX_ROOM_ID }}
message: |
❌ E2e tests did not pass, screenshots provided
🔗 https://${{ secrets.E2E_REPORTS_USER }}:${{ secrets.E2E_REPORTS_PASS }}@releases.cortezaproject.org/e2e-reports/
📷 https://${{ secrets.E2E_REPORTS_USER }}:${{ secrets.E2E_REPORTS_PASS }}@releases.cortezaproject.org/e2e-reports/screenshots/${{ env.SCREENSHOTS_GEN_FOLDER }}/