-
Notifications
You must be signed in to change notification settings - Fork 4
262 lines (230 loc) · 9.33 KB
/
automated-tests.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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
name: Automated Tests
on:
pull_request:
types: [opened, synchronize, reopened, edited]
paths-ignore:
- ".github/workflows/**"
- "!.github/workflows/automated-tests.yml"
- ".gitignore"
- ".prettierrc.json"
- "PULL_REQUEST_TEMPLATE.md"
- "README.md"
workflow_dispatch:
jobs:
playwright-run:
timeout-minutes: 60
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.49.1-noble
options: --user 1001
strategy:
fail-fast: false
matrix:
project: ["desktop-chrome", "mobile-chrome"]
permissions:
checks: write
pull-requests: write
contents: write
issues: read
steps:
- name: Checkout Uplink Web directory 🔖
uses: actions/[email protected]
- name: Checkout Automated Tests directory 🔖
uses: actions/[email protected]
with:
repository: Satellite-im/automated-tests-web
path: automated-tests
- name: Configure Git safe directory
run: git config --global --add safe.directory '/__w/UplinkWeb/UplinkWeb'
- name: Setup Node.js for Uplink Web 🔨
uses: actions/[email protected]
with:
node-version: 20
- name: Install dependencies for Uplink Web 📦
run: npm install
- name: Install dependencies for Testing Repo 📦
working-directory: automated-tests
run: npm ci
- name: Run Playwright tests
working-directory: automated-tests
run: npx playwright test -c playwright.ci.config.ts --project=${{ matrix.project }}
- uses: actions/[email protected]
if: always()
with:
name: playwright-report-${{ matrix.project }}
path: automated-tests/blob-report/
retention-days: 5
- name: Upload Allure results as artifact
if: always()
uses: actions/[email protected]
with:
name: allure-results-${{ matrix.project }}
path: automated-tests/allure-results
retention-days: 5
- name: Add label if any of build jobs failed
if: failure()
uses: buildsville/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
labels: |
Failed Automated Test
type: add
merge-reports:
if: always()
needs: playwright-run
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.49.1-noble
options: --user 1001
steps:
- name: Download Blob Report from Desktop
uses: actions/[email protected]
with:
name: playwright-report-desktop-chrome
path: blob-report
- name: Download Blob Report from Mobile
uses: actions/[email protected]
with:
name: playwright-report-mobile-chrome
path: blob-report
- name: Merge Blob Reports into HTML Report
run: npx playwright merge-reports --reporter html ./blob-report
- name: Upload Merged Report
if: always()
uses: actions/[email protected]
with:
name: playwright-merged-report
path: playwright-report
retention-days: 5
- name: Delete temporary artifacts
uses: geekyeggo/[email protected]
with:
name: |
playwright-report-desktop-chrome
playwright-report-mobile-chrome
publish-playwright-report:
if: always()
needs: merge-reports
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
contents: write
issues: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
outputs:
playwright_report_url: ${{ steps.comment.outputs.playwright_report_url }}
steps:
- uses: actions/[email protected]
with:
repository: Satellite-im/test-reports
ref: gh-pages
path: gh-pages
- name: Download Merged Report
uses: actions/[email protected]
with:
name: playwright-merged-report
path: playwright-report
- name: Set a timestamp one
id: timestampidone
run: echo "timestamp=$(date --utc +%Y%m%d_%H%M%SZ)" >> "$GITHUB_OUTPUT"
- name: Deploy Playwright HTML report to Github Pages
if: always()
uses: peaceiris/actions-gh-pages@v4
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
external_repository: Satellite-im/test-reports
publish_branch: gh-pages
publish_dir: ./playwright-report
destination_dir: ${{ steps.timestampidone.outputs.timestamp }}
- name: Set Playwright report URL output
id: comment
run: echo "playwright_report_url=https://satellite-im.github.io/test-reports/${{ steps.timestampidone.outputs.timestamp }}/" >> "$GITHUB_OUTPUT"
publish-allure-report:
if: always()
needs: publish-playwright-report
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
contents: write
issues: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- name: Download Allure results artifact for desktop
uses: actions/[email protected]
with:
name: allure-results-desktop-chrome
path: allure/desktop-chrome
- name: Download Allure results artifact for mobile
uses: actions/[email protected]
with:
name: allure-results-mobile-chrome
path: allure/mobile-chrome
- name: Merge Allure results
run: |
mkdir -p allure-results
cp -r allure/desktop-chrome/* allure-results/
cp -r allure/mobile-chrome/* allure-results/
- name: Get Allure history
uses: actions/[email protected]
if: always()
continue-on-error: true
with:
repository: Satellite-im/test-reports
ref: gh-pages
path: gh-pages
- name: Generate Allure Report
if: always()
uses: simple-elf/allure-report-action@master
with:
gh_pages: gh-pages
allure_results: allure-results
allure_report: allure-report
allure_history: allure-history
keep_reports: 20
github_repo: Satellite-im/test-reports
github_repo_owner: Satellite-im
- name: Deploy report to Github Pages
uses: peaceiris/actions-gh-pages@v4
if: always()
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
external_repository: Satellite-im/test-reports
publish_branch: gh-pages
publish_dir: ./allure-history
- name: Comment PR with Allure test results
if: always() && github.event_name == 'pull_request'
uses: mshick/[email protected]
with:
message: |
Automated tests execution is complete! You can find the Playwright test report [here](${{ needs.publish-playwright-report.outputs.playwright_report_url }}) and the Allure Test Report [here](https://satellite-im.github.io/test-reports/${{ github.run_number }})
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
remove-label:
needs: [playwright-run, merge-reports, publish-playwright-report, publish-allure-report]
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
contents: write
issues: read
steps:
- name: Checkout directory 🔖
uses: actions/[email protected]
- name: Delete artifacts required on failed execution
uses: geekyeggo/[email protected]
with:
name: |
playwright-merged-report
allure-results-desktop-chrome
allure-results-mobile-chrome
- name: Remove label if all test jobs succeeded
uses: buildsville/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
labels: |
Failed Automated Test
type: remove