-
Notifications
You must be signed in to change notification settings - Fork 4.9k
283 lines (246 loc) · 11.7 KB
/
Copy pathend2end-test.yml
File metadata and controls
283 lines (246 loc) · 11.7 KB
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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
name: End-to-End Tests
on:
pull_request:
push:
branches:
- trunk
- 'release/**'
- 'wp/**'
# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true
# Disable permissions for all available scopes by default.
# Any needed permissions should be configured at the job level.
permissions: {}
jobs:
build:
name: Build
runs-on: ${{ vars.RUNNERS_NAME || 'ubuntu-24.04' }}
permissions:
contents: read
if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }}
timeout-minutes: 30
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
persist-credentials: false
- name: Setup Node.js and install dependencies
uses: ./.github/setup-node
- name: Npm build
run: npm run build -- --skip-types
# Wider than the `build*` directories, because the build also emits
# generated files next to sources: the block parsers, the icon
# library, and the worker entry points.
- name: Upload build output
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: build-output
path: |
build
packages/*/build
packages/*/build-module
packages/*/build-style
packages/*/build-types
packages/*/build-wp
packages/*/src/library/*.tsx
packages/*/src/library/index.ts
packages/*/src/worker-code.ts
packages/block-serialization-spec-parser/parser.js
packages/block-serialization-spec-parser/parser.php
retention-days: 3
if-no-files-found: error
# Allow re-running the workflow over a previous attempt.
overwrite: true
e2e-playwright:
name: Playwright - ${{ matrix.part }}
runs-on: ${{ vars.RUNNERS_NAME || 'ubuntu-24.04' }}
needs: build
timeout-minutes: 45
# A skipped check counts as passing for required status checks, so a
# broken build must not skip these jobs — they have to start and go red
# (see the guard step below). `!cancelled()` is what drops the implicit
# `success()`; `!= 'skipped'` keeps the fork/repository filter that now
# lives on the build job.
if: ${{ !cancelled() && needs.build.result != 'skipped' }}
permissions:
contents: read
id-token: write
strategy:
fail-fast: false
matrix:
part: [1, 2, 3, 4, 5, 6, 7, 8]
totalParts: [8]
steps:
# Bail out before checkout and `npm ci` rather than after.
- name: Fail if the build job failed
if: ${{ needs.build.result != 'success' }}
run: exit 1
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
persist-credentials: false
- name: Setup Node.js and install dependencies
uses: ./.github/setup-node
- name: Download build output
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: build-output
- name: Install Playwright dependencies
uses: ./.github/setup-playwright
with:
workspace: '@wordpress/e2e-tests-playwright'
browsers: chromium firefox webkit
- name: Install WordPress and start the server
run: |
npm run wp-env-test start
- name: Run the tests
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: |
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run --workspace @wordpress/e2e-tests-playwright test:e2e -- --shard=${{ matrix.part }}/${{ matrix.totalParts }}
- name: Archive blob reports (HTML)
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: ${{ !cancelled() }}
with:
name: blob-reports--${{ matrix.part }}
path: test/e2e/blob-report
if-no-files-found: ignore
- name: Archive flaky tests report
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: ${{ !cancelled() }}
with:
name: flaky-tests-report--${{ matrix.part }}
path: test/e2e/flaky-tests
if-no-files-found: ignore
e2e-playwright-rtc-websocket:
name: Playwright - RTC WebSocket
runs-on: ${{ vars.RUNNERS_NAME || 'ubuntu-24.04' }}
needs: build
timeout-minutes: 20
# A skipped check counts as passing for required status checks, so a
# broken build must not skip these jobs — they have to start and go red
# (see the guard step below). `!cancelled()` is what drops the implicit
# `success()`; `!= 'skipped'` keeps the fork/repository filter that now
# lives on the build job.
if: ${{ !cancelled() && needs.build.result != 'skipped' }}
permissions:
contents: read
id-token: write
steps:
# Bail out before checkout and `npm ci` rather than after.
- name: Fail if the build job failed
if: ${{ needs.build.result != 'success' }}
run: exit 1
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
persist-credentials: false
- name: Setup Node.js and install dependencies
uses: ./.github/setup-node
- name: Download build output
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: build-output
# No collaboration spec is tagged `@webkit` or `@firefox`.
- name: Install Playwright dependencies
uses: ./.github/setup-playwright
with:
workspace: '@wordpress/e2e-tests-playwright'
browsers: chromium
- name: Install WordPress and start the server
run: |
npm run wp-env-test start
- name: Run the tests
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
# Run against the "slow" profile (a short simulated send
# delay) for better coverage of real-world timing.
RTC_WS_DELAY: 50
# Label flaky reports so this job's diagnostics don't collide
# with the default suite's when artifacts are merged, and so
# WebSocket-provider flakes are reported as their own issues.
FLAKY_TESTS_REPORT_LABEL: 'RTC WebSocket'
run: |
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run --workspace @wordpress/e2e-tests-playwright test:e2e:rtc-websocket
- name: Archive blob reports (HTML)
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: ${{ !cancelled() }}
with:
name: blob-reports--rtc-websocket
path: test/e2e/blob-report
if-no-files-found: ignore
- name: Archive flaky tests report
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: ${{ !cancelled() }}
with:
name: flaky-tests-report--rtc-websocket
path: test/e2e/flaky-tests
if-no-files-found: ignore
merge-artifacts:
name: Merge Artifacts
if: ${{ !cancelled() }}
needs: [e2e-playwright, e2e-playwright-rtc-websocket]
runs-on: 'ubuntu-24.04'
permissions:
contents: read
# Needed to comment the flaky tests report on the pull request.
pull-requests: write
timeout-minutes: 5
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
persist-credentials: false
- name: Setup Node.js and install dependencies
uses: ./.github/setup-node
- name: Merge flaky tests reports
id: merge-flaky-tests-reports
uses: actions/upload-artifact/merge@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
continue-on-error: true
with:
name: flaky-tests-report
pattern: flaky-tests-report*
delete-merged: true
- name: Merge blob reports
uses: actions/upload-artifact/merge@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
continue-on-error: true
with:
name: blob-reports-merged
pattern: blob-reports--*
delete-merged: true
- name: Download merged blob reports
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
continue-on-error: true
with:
name: blob-reports-merged
path: all-blob-reports
- name: Merge blob reports into HTML report
run: npx playwright merge-reports --reporter html ./all-blob-reports
continue-on-error: true
- name: Upload merged HTML report
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
continue-on-error: true
with:
name: html-report--attempt-${{ github.run_attempt }}
path: playwright-report
if-no-files-found: ignore
# Flaky tests are only reported as a comment on the pull request. The
# merge step above only sets `artifact-id` when a report was produced,
# so both steps are skipped on runs without any flaky test.
- name: Download merged flaky tests report
id: download-flaky-tests-report
if: ${{ github.event_name == 'pull_request' && steps.merge-flaky-tests-reports.outputs.artifact-id }}
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: flaky-tests-report
path: flaky-tests
- name: Report flaky tests
if: ${{ steps.download-flaky-tests-report.outcome == 'success' }}
uses: ./packages/report-flaky-tests
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
artifact-path: flaky-tests