forked from cloudflare/workers-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
311 lines (290 loc) · 15 KB
/
Copy pathc3-e2e.yml
File metadata and controls
311 lines (290 loc) · 15 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
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
name: C3 E2E
on:
merge_group:
pull_request:
permissions:
contents: read
pull-requests: read
# pnpm 11-specific settings - recognised by pnpm 11+ and
# silently ignored by pnpm 10.
#
# - pmOnFail=ignore: pnpm 11's default `download` would silently re-exec as
# the monorepo's pinned pnpm 10.33.0, defeating the matrix override.
# - verifyDepsBeforeRun=false: pnpm 11's default `install` would re-run
# `pnpm install` at the monorepo root before invoking the script, which
# then trips on engines.pnpm.
env:
pnpm_config_pm_on_fail: ignore
pnpm_config_verify_deps_before_run: "false"
jobs:
e2e:
# Runs the non-frameworks C3 E2E tests on all supported operating systems
# and package managers.
timeout-minutes: 45
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os.name }}-${{ matrix.pm.name }}-${{ matrix.pm.version }}${{ matrix.experimental && '-experimental' || '' }}-${{ matrix.filter }}
cancel-in-progress: ${{ github.head_ref != 'changeset-release/main' }}
# `matrix.pm.label` is the display name in job/artifact names. Default
# pm entries use the plain name (e.g. `pnpm`) to keep historical required-
# check names stable; non-default entries (e.g. pnpm 11) suffix the version.
name: ${{ format('C3 E2E ({0}, {1}{2}) - {3}', matrix.pm.label, matrix.os.description, matrix.experimental && ', experimental' || '', matrix.filter) }}
strategy:
fail-fast: false
matrix:
experimental: [false]
filter: ["cli", "workers"]
os: [{ name: ubuntu-latest, description: Linux }]
pm:
- { name: pnpm, version: "10.33.0", label: "pnpm" }
- { name: pnpm, version: "11.5.1", label: "pnpm@11.5.1" }
- { name: npm, version: "0.0.0", label: "npm" }
# The yarn tests keep failing on Linux with out of space errors, with no clear reason why. Disabling for now.
# - { name: yarn, version: "1.0.0", label: "yarn" }
include:
# Windows and experimental entries stay on the default pnpm to
# preserve historical required-check names. pnpm 11 coverage comes
# from the Linux base entries above.
- os: { name: windows-latest, description: Windows }
pm: { name: pnpm, version: "10.33.0", label: "pnpm" }
filter: "cli"
- os: { name: windows-latest, description: Windows }
pm: { name: pnpm, version: "10.33.0", label: "pnpm" }
filter: "workers"
- os: { name: ubuntu-latest, description: Linux }
pm: { name: pnpm, version: "10.33.0", label: "pnpm" }
experimental: true
filter: "cli"
- os: { name: ubuntu-latest, description: Linux }
pm: { name: pnpm, version: "10.33.0", label: "pnpm" }
experimental: true
filter: "workers"
runs-on: ${{ matrix.os.name }}
steps:
- name: Checkout Repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
persist-credentials: false
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
id: changes
with:
filters: |
everything_but_markdown:
- '!**/*.md'
- name: Install Dependencies
if: steps.changes.outputs.everything_but_markdown == 'true'
uses: ./.github/actions/install-dependencies
with:
turbo-api: ${{ secrets.TURBO_API }}
turbo-team: ${{ secrets.TURBO_TEAM }}
turbo-token: ${{ secrets.TURBO_TOKEN }}
turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
- name: Install Python uv
if: steps.changes.outputs.everything_but_markdown == 'true'
uses: ./.github/actions/install-python-uv
# Needed because gatsby requires git
- name: Configure Git
shell: bash
run: |
git config --global user.email wrangler@cloudflare.com
git config --global user.name 'Wrangler Tester'
# Put the matrix pnpm version on PATH so scaffolded-project installs
# run it (not the monorepo's pinned pnpm 10.33.0). Without this, the
# matrix only relabels C3's `npm_config_user_agent` and pnpm 11
# regressions go undetected.
#
# `pnpm/action-setup` refuses when both `version` input and the root
# `package.json#packageManager` are set, so we point it at a stub
# `package.json`. We also loosen `engines.pnpm` to avoid pnpm 11
# bailing with ERR_PNPM_UNSUPPORTED_ENGINE at the monorepo root.
- name: Prepare workspace for matrix pnpm install
if: matrix.pm.name == 'pnpm' && steps.changes.outputs.everything_but_markdown == 'true'
shell: bash
run: |
mkdir -p .ci-pnpm-setup-stub
printf '{"name":"ci-stub","private":true}\n' > .ci-pnpm-setup-stub/package.json
node -e "
const fs = require('node:fs');
const pkg = JSON.parse(fs.readFileSync('package.json','utf8'));
if (pkg.engines && pkg.engines.pnpm) pkg.engines.pnpm = '*';
fs.writeFileSync('package.json', JSON.stringify(pkg, null, '\t') + '\n');
"
- name: Install matrix pnpm version for scaffolded installs
if: matrix.pm.name == 'pnpm' && steps.changes.outputs.everything_but_markdown == 'true'
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
with:
version: ${{ matrix.pm.version }}
package_json_file: .ci-pnpm-setup-stub/package.json
# Distinct dest so `addPath` prepends ahead of the monorepo's
# pinned pnpm 10.x from the earlier `~/setup-pnpm`.
dest: ~/matrix-pnpm
- name: Verify pnpm on PATH matches matrix version
if: matrix.pm.name == 'pnpm' && steps.changes.outputs.everything_but_markdown == 'true'
shell: bash
run: |
got="$(pnpm --version)"
want="${{ matrix.pm.version }}"
echo "pnpm on PATH: $got (expected $want)"
[ "$got" = "$want" ] || { echo "ERROR: PATH pnpm is $got, not $want — scaffolded installs would silently run the wrong version."; exit 1; }
- id: run-e2e
if: steps.changes.outputs.everything_but_markdown == 'true'
shell: bash
run: pnpm run test:e2e:c3
env:
NODE_VERSION: ${{ env.NODE_VERSION }}
E2E_EXPERIMENTAL: ${{ matrix.experimental }}
E2E_TEST_PM: ${{ matrix.pm.name }}
E2E_TEST_PM_VERSION: ${{ matrix.pm.version }}
E2E_TEST_FILTER: ${{ matrix.filter }}
CI_OS: ${{ runner.os }}
GITHUB_TOKEN: ${{ github.token }} # Needed for begit to clone the repo in the e2e tests for solid-start
- name: Upload Logs
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: ${{ !cancelled() && steps.changes.outputs.everything_but_markdown == 'true' }}
with:
name: ${{ format('e2e-logs-{0}-{1}-{2}-{3}', matrix.pm.label, matrix.os.description, matrix.experimental && 'experimental' || 'normal', matrix.filter) }}
path: packages/create-cloudflare/.e2e-logs${{matrix.experimental == 'true' && '-experimental' || ''}}/${{ matrix.pm.name }}/${{ matrix.filter }}
include-hidden-files: true
- name: Upload Turbo Summary
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: ${{ !cancelled() && steps.changes.outputs.everything_but_markdown == 'true' }}
with:
name: ${{ format('turbo-runs-{0}-{1}-{2}-{3}', matrix.pm.label, matrix.os.description, matrix.experimental && 'experimental' || 'normal', matrix.filter) }}
path: .turbo/runs
include-hidden-files: true
frameworks-e2e:
# Runs the C3 frameworks E2E tests only in the merge queue, on the release branch, if create-cloudflare has changed, or when explicitly requested via label.
#
# Frameworks that delegate install to their own generator (e.g. `hono`)
# don't route through C3's `ERR_PNPM_IGNORED_BUILDS` recovery path; those
# tests opt out of pnpm 11 via `unsupportedPmRanges` in the test config.
timeout-minutes: 45
concurrency:
group: ${{ github.workflow }}-frameworks${{ matrix.experimental && '-experimental' || '' }}-${{ github.ref }}-${{ matrix.os.name }}-${{ matrix.pm.name }}-${{ matrix.pm.version }}
cancel-in-progress: ${{ github.head_ref != 'changeset-release/main' }}
name: ${{ format('C3 E2E ({0}, {1}{2}) - frameworks', matrix.pm.label, matrix.os.description, matrix.experimental && ', experimental' || '') }}
strategy:
fail-fast: false
matrix:
experimental: [false]
os:
- { name: ubuntu-latest, description: Linux }
pm:
- { name: pnpm, version: "10.33.0", label: "pnpm" }
- { name: pnpm, version: "11.5.1", label: "pnpm@11.5.1" }
- { name: npm, version: "0.0.0", label: "npm" }
include:
# Experimental stays on the default pnpm to preserve historical
# required-check names; pnpm 11 coverage comes from the base entry.
- os: { name: ubuntu-latest, description: Linux }
pm: { name: pnpm, version: "10.33.0", label: "pnpm" }
experimental: true
runs-on: ${{ matrix.os.name }}
steps:
- name: Checkout Repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
persist-credentials: false
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
id: changes
with:
filters: |
everything_but_markdown:
- '!**/*.md'
framework_deps:
- 'packages/create-cloudflare/**'
- name: Check if frameworks tests should run
id: check-frameworks
shell: bash
env:
GH_TOKEN: ${{ github.token }}
EVENT_NAME: ${{ github.event_name }}
HEAD_REF: ${{ github.head_ref }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REPO: ${{ github.repository }}
FRAMEWORK_DEPS_CHANGED: ${{ steps.changes.outputs.framework_deps }}
run: |
if [ "$EVENT_NAME" = "merge_group" ] || \
[ "$HEAD_REF" = "changeset-release/main" ] || \
[ "$FRAMEWORK_DEPS_CHANGED" = "true" ]; then
echo "run_frameworks=true" >> "$GITHUB_OUTPUT"
elif [ "$EVENT_NAME" = "pull_request" ]; then
HAS_LABEL=$(gh pr view "$PR_NUMBER" \
--repo "$REPO" --json labels \
--jq '[.labels[].name] | any(. == "run-c3-frameworks-tests")')
echo "run_frameworks=${HAS_LABEL}" >> "$GITHUB_OUTPUT"
else
echo "run_frameworks=false" >> "$GITHUB_OUTPUT"
fi
- name: Install Dependencies
if: steps.check-frameworks.outputs.run_frameworks == 'true' && steps.changes.outputs.everything_but_markdown == 'true'
uses: ./.github/actions/install-dependencies
with:
turbo-api: ${{ secrets.TURBO_API }}
turbo-team: ${{ secrets.TURBO_TEAM }}
turbo-token: ${{ secrets.TURBO_TOKEN }}
turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
- name: Install Python uv
if: steps.check-frameworks.outputs.run_frameworks == 'true' && steps.changes.outputs.everything_but_markdown == 'true'
uses: ./.github/actions/install-python-uv
- name: Configure Git
if: steps.check-frameworks.outputs.run_frameworks == 'true' && steps.changes.outputs.everything_but_markdown == 'true'
shell: bash
run: |
git config --global user.email wrangler@cloudflare.com
git config --global user.name 'Wrangler Tester'
# See the equivalent step in the `e2e` job above for context.
- name: Prepare workspace for matrix pnpm install
if: matrix.pm.name == 'pnpm' && steps.check-frameworks.outputs.run_frameworks == 'true' && steps.changes.outputs.everything_but_markdown == 'true'
shell: bash
run: |
mkdir -p .ci-pnpm-setup-stub
printf '{"name":"ci-stub","private":true}\n' > .ci-pnpm-setup-stub/package.json
node -e "
const fs = require('node:fs');
const pkg = JSON.parse(fs.readFileSync('package.json','utf8'));
if (pkg.engines && pkg.engines.pnpm) pkg.engines.pnpm = '*';
fs.writeFileSync('package.json', JSON.stringify(pkg, null, '\t') + '\n');
"
- name: Install matrix pnpm version for scaffolded installs
if: matrix.pm.name == 'pnpm' && steps.check-frameworks.outputs.run_frameworks == 'true' && steps.changes.outputs.everything_but_markdown == 'true'
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
with:
version: ${{ matrix.pm.version }}
package_json_file: .ci-pnpm-setup-stub/package.json
dest: ~/matrix-pnpm
- name: Verify pnpm on PATH matches matrix version
if: matrix.pm.name == 'pnpm' && steps.check-frameworks.outputs.run_frameworks == 'true' && steps.changes.outputs.everything_but_markdown == 'true'
shell: bash
run: |
got="$(pnpm --version)"
want="${{ matrix.pm.version }}"
echo "pnpm on PATH: $got (expected $want)"
[ "$got" = "$want" ] || { echo "ERROR: PATH pnpm is $got, not $want — scaffolded installs would silently run the wrong version."; exit 1; }
- id: run-e2e
if: steps.check-frameworks.outputs.run_frameworks == 'true' && steps.changes.outputs.everything_but_markdown == 'true'
shell: bash
run: pnpm run test:e2e:c3
env:
NODE_VERSION: ${{ env.NODE_VERSION }}
E2E_EXPERIMENTAL: ${{ matrix.experimental }}
E2E_TEST_PM: ${{ matrix.pm.name }}
E2E_TEST_PM_VERSION: ${{ matrix.pm.version }}
E2E_TEST_FILTER: frameworks
CI_OS: ${{ runner.os }}
GITHUB_TOKEN: ${{ github.token }}
- name: Upload Logs
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: ${{ !cancelled() && steps.check-frameworks.outputs.run_frameworks == 'true' && steps.changes.outputs.everything_but_markdown == 'true' }}
with:
name: ${{ format('e2e-logs-{0}-{1}-{2}-frameworks', matrix.pm.label, matrix.os.description, matrix.experimental && 'experimental' || 'normal') }}
path: packages/create-cloudflare/.e2e-logs${{matrix.experimental == 'true' && '-experimental' || ''}}/${{ matrix.pm.name }}/frameworks
include-hidden-files: true
- name: Upload Turbo Summary
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: ${{ !cancelled() && steps.check-frameworks.outputs.run_frameworks == 'true' && steps.changes.outputs.everything_but_markdown == 'true' }}
with:
name: ${{ format('turbo-runs-{0}-{1}-{2}-frameworks', matrix.pm.label, matrix.os.description, matrix.experimental && 'experimental' || 'normal') }}
path: .turbo/runs
include-hidden-files: true