-
Notifications
You must be signed in to change notification settings - Fork 447
750 lines (724 loc) · 31.6 KB
/
Copy pathci.yml
File metadata and controls
750 lines (724 loc) · 31.6 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
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
name: CI
on:
push:
branches:
- trunk
pull_request:
# Disable permissions for all available scopes by default.
# Any needed permissions should be configured at the job level.
permissions: {}
jobs:
set-nx-shas:
name: 'Resolve Nx affected SHAs'
if: github.repository == 'WordPress/wordpress-playground' || github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
actions: read # Required to find the last successful CI run.
contents: read # Required to clone the repo.
outputs:
base: ${{ steps.set_shas.outputs.base }}
head: ${{ steps.set_shas.outputs.head }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
filter: tree:0
- id: set_shas
name: Derive appropriate SHAs for nx affected
uses: nrwl/nx-set-shas@afb73a62d26e41464e9254689e1fd6122ee683c1 # v5.0.1
with:
main-branch-name: trunk
set-environment-variables-for-job: false
# This step:
# * Warms up the node_modules cache
# * Performs linting and typechecking
# * Checks for orphaned documentation pages
#
# The linting tasks take ~5s to complete and it doesn't
# make sense to separate them into separate steps that would
# take ~25s just to run git clone and restore node_modules.
lint-and-typecheck:
name: 'Lint and typecheck'
needs: set-nx-shas
if: github.repository == 'WordPress/wordpress-playground' || github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read # Required to clone the repo.
env:
NX_BASE: ${{ needs.set-nx-shas.outputs.base }}
NX_HEAD: ${{ needs.set-nx-shas.outputs.head }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/prepare-playground
- run: npx nx affected --target=lint
- run: npx nx affected --target=typecheck
- run: npx nx check-orphan-pages docs-site
- run: bash tools/check-node-engine-alignment.sh
test-unit-asyncify:
needs: set-nx-shas
if: github.repository == 'WordPress/wordpress-playground' || github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read # Required to clone the repo.
env:
NX_BASE: ${{ needs.set-nx-shas.outputs.base }}
NX_HEAD: ${{ needs.set-nx-shas.outputs.head }}
strategy:
fail-fast: false
matrix:
include:
- name: test-unit-asyncify (1/7)
target: test
- name: test-unit-asyncify (2/7)
target: test-group-1-asyncify
- name: test-unit-asyncify (3/7)
target: test-group-2-asyncify
- name: test-unit-asyncify (4/7)
target: test-group-3-asyncify
- name: test-unit-asyncify (5/7)
target: test-group-4-asyncify
- name: test-unit-asyncify (6/7)
target: test-group-5-asyncify
- name: test-unit-asyncify (7/7)
target: test-group-6-asyncify
name: ${{ matrix.name }}
services:
mysql:
image: mysql:5.7
env:
MYSQL_DATABASE: test_db
MYSQL_USER: user
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: rootpassword
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping --silent"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/prepare-playground
with:
node-version: 20
- run: node --expose-gc node_modules/nx/bin/nx affected --target=${{ matrix.target }}
env:
MYSQL_DATABASE: test_db
MYSQL_USER: user
MYSQL_PASSWORD: password
test-unit-jspi:
needs: set-nx-shas
if: github.repository == 'WordPress/wordpress-playground' || github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read # Required to clone the repo.
env:
NX_BASE: ${{ needs.set-nx-shas.outputs.base }}
NX_HEAD: ${{ needs.set-nx-shas.outputs.head }}
strategy:
fail-fast: false
matrix:
include:
- name: test-unit-jspi (1/6)
target: test-group-1-jspi
- name: test-unit-jspi (2/6)
target: test-group-2-jspi
- name: test-unit-jspi (3/6)
target: test-group-3-jspi
- name: test-unit-jspi (4/6)
target: test-group-4-jspi
- name: test-unit-jspi (5/6)
target: test-group-5-jspi
- name: test-unit-jspi (6/6)
target: test-group-6-jspi
name: ${{ matrix.name }}
services:
mysql:
image: mysql:5.7
env:
MYSQL_DATABASE: test_db
MYSQL_USER: user
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: rootpassword
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping --silent"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/prepare-playground
with:
node-version: 24
- run: node --expose-gc node_modules/nx/bin/nx affected --target=${{ matrix.target }}
env:
MYSQL_DATABASE: test_db
MYSQL_USER: user
MYSQL_PASSWORD: password
test-playground-cli:
needs: set-nx-shas
if: github.repository == 'WordPress/wordpress-playground' || github.event_name == 'pull_request'
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 30
permissions:
contents: read # Required to clone the repo.
env:
NX_BASE: ${{ needs.set-nx-shas.outputs.base }}
NX_HEAD: ${{ needs.set-nx-shas.outputs.head }}
name: 'test-playground-cli (${{ matrix.os }})'
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/prepare-playground
with:
node-version: 22
- name: Run full test suite
run: node node_modules/nx/bin/nx affected --target=test-playground-cli
test-file-locking:
needs: set-nx-shas
if: github.repository == 'WordPress/wordpress-playground' || github.event_name == 'pull_request'
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
async-strategy: [asyncify, jspi]
continue-on-error: true
runs-on: ${{ matrix.os }}
timeout-minutes: 30
permissions:
contents: read # Required to clone the repo.
env:
NX_BASE: ${{ needs.set-nx-shas.outputs.base }}
NX_HEAD: ${{ needs.set-nx-shas.outputs.head }}
name: 'test-file-locking-${{ matrix.async-strategy }} (${{ matrix.os }})'
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/prepare-playground
with:
node-version: 22
- name: Run full test suite
run: node node_modules/nx/bin/nx affected --target=test-file-locking-${{ matrix.async-strategy }}
test-e2e-php-wasm-web-jspi:
if: github.repository == 'WordPress/wordpress-playground' || github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read # Required to clone the repo.
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/prepare-playground
- run: sudo npx playwright install
- run: sudo CI=true JSPI=true npx nx e2e php-wasm-web
test-e2e-php-wasm-web-asyncify:
if: github.repository == 'WordPress/wordpress-playground' || github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read # Required to clone the repo.
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/prepare-playground
- run: sudo npx playwright install
- run: sudo CI=true npx nx e2e php-wasm-web
test-e2e:
if: github.repository == 'WordPress/wordpress-playground' || github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read # Required to clone the repo.
# Run as root to allow node to bind to port 80
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/prepare-playground
- run: sudo ./node_modules/.bin/cypress install --force
- run: sudo CYPRESS_CI=1 npx nx e2e playground-website --configuration=ci --verbose
# Upload the Cypress screenshots as artifacts if the job fails
- uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: cypress-screenshots
path: dist/cypress/packages/playground/website/screenshots
# E2E Playwright tests - builds inline per runner for faster parallel execution
# Previously used a prepare job + artifact sharing, but inline builds allow
# all shards to start immediately in parallel, reducing total wall time.
test-e2e-playwright:
if: github.repository == 'WordPress/wordpress-playground' || github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read # Required to clone the repo.
strategy:
fail-fast: false
matrix:
# Keep three balanced shards for non-storage tests. Storage tests
# have their own unsharded lane because OPFS is browser-scoped.
# That lane uses one worker, so Playwright can retry only the
# failed test without allowing storage tests to overlap.
include:
- browser: 'chromium'
shard: '1/3'
shard_name: '1-of-3'
- browser: 'chromium'
shard: '2/3'
shard_name: '2-of-3'
- browser: 'chromium'
shard: '3/3'
shard_name: '3-of-3'
- browser: 'firefox'
shard: '1/3'
shard_name: '1-of-3'
- browser: 'firefox'
shard: '2/3'
shard_name: '2-of-3'
- browser: 'firefox'
shard: '3/3'
shard_name: '3-of-3'
- browser: 'webkit'
shard: '1/3'
shard_name: '1-of-3'
- browser: 'webkit'
shard: '2/3'
shard_name: '2-of-3'
- browser: 'webkit'
shard: '3/3'
shard_name: '3-of-3'
- browser: 'chromium'
test_group: 'storage'
- browser: 'firefox'
test_group: 'storage'
- browser: 'webkit'
test_group: 'storage'
steps:
- name: Free up runner disk space
shell: bash
run: |
set -euo pipefail
echo "Disk usage before cleanup:"
df -h
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/share/dotnet
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
echo "Disk usage after cleanup:"
df -h
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/prepare-playground
- name: Install Playwright Browser
run: sudo npx playwright install ${{ matrix.browser }} --with-deps
- name: Build app for E2E tests
run: CORS_PROXY_URL=http://127.0.0.1:5263/cors-proxy.php? npx nx e2e:playwright:prepare-app-deploy-and-offline-mode playground-website
- name: Run Playwright${{ matrix.test_group && format(' {0}', matrix.test_group) || '' }} tests - ${{ matrix.browser }}${{ matrix.shard && format(' (shard {0})', matrix.shard) || '' }}
run: |
SHARD_ARG=""
if [ -n "${{ matrix.shard }}" ]; then
SHARD_ARG="--shard=${{ matrix.shard }}"
fi
if [ "${{ matrix.browser }}" = "firefox" ]; then
sudo -E HOME=/root XDG_RUNTIME_DIR=/root CI=true PLAYWRIGHT_TEST_GROUP=${{ matrix.test_group || 'regular' }} npx playwright test --config=packages/playground/website/playwright/playwright.ci.config.ts --project=${{ matrix.browser }} $SHARD_ARG
else
sudo CI=true PLAYWRIGHT_TEST_GROUP=${{ matrix.test_group || 'regular' }} npx playwright test --config=packages/playground/website/playwright/playwright.ci.config.ts --project=${{ matrix.browser }} $SHARD_ARG
fi
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report-${{ matrix.browser }}${{ matrix.test_group && format('-{0}', matrix.test_group) || '' }}${{ matrix.shard_name && format('-shard-{0}', matrix.shard_name) || '' }}
path: packages/playground/website/playwright-report/
if-no-files-found: ignore
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-snapshots-${{ matrix.browser }}${{ matrix.test_group && format('-{0}', matrix.test_group) || '' }}${{ matrix.shard_name && format('-shard-{0}', matrix.shard_name) || '' }}
path: packages/playground/website/playwright/e2e/deployment.spec.ts-snapshots/
if-no-files-found: ignore
test-e2e-personal-wp:
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read # Required to clone the repo.
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/prepare-playground
- name: Install Playwright Browser
run: npx playwright install chromium --with-deps
- name: Run personal-wp Playwright e2e tests
run: CI=true npx playwright test --config=packages/playground/personal-wp/playwright/playwright.config.ts --project=chromium
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-personal-wp-report
path: packages/playground/personal-wp/playwright-report/
if-no-files-found: ignore
test-e2e-components:
if: github.repository == 'WordPress/wordpress-playground' || github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read # Required to clone the repo.
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/prepare-playground
- name: Install Playwright Browsers
run: npx playwright install --with-deps chromium
- name: Run Playwright tests for components
run: npx nx e2e playground-components
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-components-report
path: packages/playground/components/playwright-report/
if-no-files-found: ignore
# Run MCP e2e tests independently from other tests because running a local version of the MCP server from TypeScript files requires Node 22+
test-e2e-mcp:
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read # Required to clone the repo.
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/prepare-playground
with:
node-version: '22'
- name: Install Playwright Browsers
run: npx playwright install --with-deps chromium
- name: Run MCP e2e tests
run: npx nx test:mcp playground-mcp
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-mcp-report
path: packages/playground/mcp/playwright-report/
if-no-files-found: ignore
test-docs-api-reference:
if: github.repository == 'WordPress/wordpress-playground' || github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read # Required to clone the repo.
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/prepare-playground
- name: Install Playwright Browsers
run: npx playwright install --with-deps chromium
- name: Verify docs API reference
run: npx nx run docs-site:api-e2e
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: docs-api-e2e-report
path: packages/docs/site/test-results/
if-no-files-found: ignore
test-built-npm-packages:
if: github.repository == 'WordPress/wordpress-playground' || github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read # Required to clone the repo.
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/prepare-playground
with:
node-version: 22
- name: Validate publish package overrides
run: node tools/scripts/check-publish-package-overrides.mjs
- name: Install Playwright Browsers
run: npx --no-install playwright install --with-deps chromium
- name: Build packages, start local registry, and run integration tests
run: packages/playground/test-built-npm-packages/run-tests.sh
test-playground-client-types-rollup:
if: github.repository == 'WordPress/wordpress-playground' || github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read # Required to clone the repo.
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/prepare-playground
with:
node-version: 22
- name: Verify bundled client declarations
run: |
npm exec -- nx run playground-client:test:rollup-declarations
npm pack --dry-run dist/packages/playground/client
test-running-unbuilt-playground-cli:
if: github.repository == 'WordPress/wordpress-playground' || github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read # Required to clone the repo.
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/prepare-playground
with:
node-version: 22
- run: packages/playground/cli/tests/test-running-unbuilt-cli.sh
test-php-wasm-cli-smoke:
if: github.repository == 'WordPress/wordpress-playground' || github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read # Required to clone the repo.
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/prepare-playground
with:
node-version: 20
- run: packages/php-wasm/cli/tests/smoke-test.sh
detect-compile-extension-helper-changes:
if: github.repository == 'WordPress/wordpress-playground' || github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read # Required to clone the repo and fetch commit history.
outputs:
changed: ${{ steps.changed.outputs.changed }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- id: changed
name: Check compile-extension package changes
shell: bash
run: |
set -euo pipefail
if [ "${{ github.event_name }}" = "pull_request" ]; then
base_sha="${{ github.event.pull_request.base.sha }}"
else
base_sha="${{ github.event.before }}"
fi
if [ -z "$base_sha" ] || [[ "$base_sha" =~ ^0+$ ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
exit 0
fi
git fetch --no-tags --depth=1 origin "$base_sha"
if git diff --name-only "$base_sha" "$GITHUB_SHA" -- packages/php-wasm/compile-extension/ | grep -q .; then
echo "changed=true" >> "$GITHUB_OUTPUT"
else
echo "changed=false" >> "$GITHUB_OUTPUT"
fi
test-compile-extension-helper:
needs: [detect-compile-extension-helper-changes, set-nx-shas]
if: (github.repository == 'WordPress/wordpress-playground' || github.event_name == 'pull_request') && needs.detect-compile-extension-helper-changes.outputs.changed == 'true'
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: read # Required to clone the repo.
env:
NX_BASE: ${{ needs.set-nx-shas.outputs.base }}
NX_HEAD: ${{ needs.set-nx-shas.outputs.head }}
steps:
- name: Free up runner disk space
shell: bash
run: |
set -euo pipefail
cleanup_path() {
echo "Removing $1"
sudo rm -rf "$1"
}
echo "Disk usage before cleanup:"
df -h
cleanup_path /usr/local/lib/android
cleanup_path /usr/share/dotnet
cleanup_path /opt/ghc
cleanup_path /opt/hostedtoolcache/CodeQL
timeout 120s docker system prune -af || true
echo "Disk usage after cleanup:"
df -h
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/prepare-playground
with:
node-version: 24
- name: Verify lazy Docker asset fetch from built package
run: node --expose-gc node_modules/nx/bin/nx run php-wasm-compile-extension:test-lazy-docker-asset-fetch --output-style=stream
- name: Build and load PHP.wasm extension fixtures
run: node --expose-gc node_modules/nx/bin/nx affected --target=test-compile-extension-integration --parallel=1 --output-style=stream
test-legacy-wp-version-boot:
if: github.repository == 'WordPress/wordpress-playground' || github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read # Required to clone the repo.
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/prepare-playground
- name: Install Playwright Browser
run: npx playwright install chromium --with-deps
- name: Start dev server
run: |
npm run dev > /tmp/playground-dev.log 2>&1 &
timeout=120; elapsed=0
until curl -s -o /dev/null http://127.0.0.1:5400/website-server/ 2>/dev/null; do
sleep 3
elapsed=$((elapsed + 3))
if [ $elapsed -ge $timeout ]; then
echo "Dev server failed to start within ${timeout}s"
cat /tmp/playground-dev.log | tail -50
exit 1
fi
done
- name: Test legacy WordPress version boot
run: node packages/playground/wordpress/tests/test-legacy-wp-version-boot.mjs
# Redis extension tests - verifies the php-redis extension loads
# and provides the expected API, and can connect to a real Redis server.
# Redis requires JSPI because asyncify cannot properly handle exceptions
# during network I/O. Attempting to load Redis with asyncify throws an error.
test-redis-extension:
if: github.repository == 'WordPress/wordpress-playground' || github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read # Required to clone the repo.
services:
redis:
image: redis:7-alpine
ports:
- 6379:6379
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/prepare-playground
with:
node-version: 24
- name: Run Redis extension tests (JSPI)
run: node --expose-gc node_modules/nx/bin/nx run php-wasm-node:test-redis-extension-jspi
env:
REDIS_HOST: 127.0.0.1
REDIS_PORT: 6379
- name: Run Redis network tests (JSPI)
run: node --expose-gc node_modules/nx/bin/nx run php-wasm-node:test-redis-network-jspi
env:
REDIS_HOST: 127.0.0.1
REDIS_PORT: 6379
# Memcached extension tests - verifies the php-memcached extension loads
# and provides the expected API, and can connect to a real memcached server.
test-memcached-extension:
if: github.repository == 'WordPress/wordpress-playground' || github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read # Required to clone the repo.
services:
memcached:
image: memcached:1.6-alpine
ports:
- 11211:11211
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/prepare-playground
with:
node-version: 24
- name: Run memcached extension tests
run: node --expose-gc node_modules/nx/bin/nx run php-wasm-node:test-memcached-extension-jspi
- name: Run memcached network tests
run: node --expose-gc node_modules/nx/bin/nx run php-wasm-node:test-memcached-network-jspi
env:
MEMCACHED_HOST: 127.0.0.1
MEMCACHED_PORT: 11211
build:
needs: set-nx-shas
if: github.repository == 'WordPress/wordpress-playground' || github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read # Required to clone the repo.
env:
NX_BASE: ${{ needs.set-nx-shas.outputs.base }}
NX_HEAD: ${{ needs.set-nx-shas.outputs.head }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/prepare-playground
with:
node-version: 20
- run: |
if ADDITIONAL_REMOTE_ORIGINS=invalid-origin npx nx build playground-client; then
echo "The Playground client build should have failed due to an invalid additional origin."
echo "The build does not appear to be applying ADDITIONAL_REMOTE_ORIGINS."
exit 1
fi
npx nx affected --target=build --parallel=3 --verbose
- name: Verify npm pack works (catches override conflicts before publish)
run: npm pack --dry-run --workspace=packages/php-wasm/logger
# Deploy documentation job
deploy_docs:
# Only deploy docs when pushing to the WordPress/wordpress-playground repository
if: >
github.repository == 'WordPress/wordpress-playground' &&
github.ref == 'refs/heads/trunk' &&
github.event_name == 'push'
# Add a dependency to the build job
needs: [test-unit-asyncify, test-e2e, test-e2e-components, build]
name: 'Deploy doc site'
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
contents: read # Required to clone the repo.
pages: write # Required to deploy to GitHub Pages.
id-token: write # Required to verify the deployment originates from an appropriate source.
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
# Specify runner + deployment step
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/prepare-playground
- run: npm run build:docs
- uses: actions/upload-pages-artifact@v3
with: { path: dist/docs/build }
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4