-
Notifications
You must be signed in to change notification settings - Fork 0
187 lines (158 loc) · 5.97 KB
/
Copy pathci.yml
File metadata and controls
187 lines (158 loc) · 5.97 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
name: CI
on:
push:
branches:
- trunk
pull_request:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
js:
name: Lint, typecheck, Jest
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: |
package-lock.json
gutenberg/package-lock.json
- name: Install plugin dependencies
run: npm ci
# Jest and typecheck resolve @wordpress/sync + yjs from the vendored
# subtree, which is committed source-only. --ignore-scripts skips the
# subtree's husky prepare hook (it errors outside a git root); the
# lifecycle outputs it also skips are regenerated by `npm run build`.
- name: Install and build the vendored Gutenberg subtree
run: |
cd gutenberg
npm ci --ignore-scripts
npm run build
# PHP lint (composer lint) is deliberately absent: the plugin carries
# documented pre-existing PHPCS debt (see AGENTS.md known issues).
- name: Lint
run: npm run lint:js
- name: Typecheck
run: npm run typecheck
- name: Jest
run: npm run test:js
- name: Build the plugin bundle
run: npm run build
php:
name: PHPUnit (wp-env)
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: |
package-lock.json
gutenberg/package-lock.json
- name: Install plugin dependencies
run: npm ci
# An UNBUILT gutenberg.php refuses to load its lib/ (the framework),
# so the plugin under test finds no WP_Sync_* contracts and the
# PHPUnit bootstrap dies with "Interface WP_Sync_Engine not found".
# The subtree build is required even for the PHP-only test path.
- name: Install and build the vendored Gutenberg subtree
run: |
cd gutenberg
npm ci --ignore-scripts
npm run build
# The conformance suites run on the runner's PHP directly (no
# WordPress). automerge-php's grapheme-cluster paths need the fixed
# GB11 rules of PCRE2 >= 10.43, which PHP bundles from 8.4 — under
# PHP <= 8.3 (PCRE2 10.42, including the stock runner PHP) two
# adjacent emoji-ZWJ sequences count as ONE \X cluster and exactly
# 2 of its 680 tests fail. Pin 8.4.
- name: Set up PHP for the conformance suites
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: mbstring
tools: composer
- name: Install PHP dependencies
run: composer install --no-progress
# The vendored y-php library's own conformance suite: translated
# upstream Yjs tests plus byte-level fixtures generated from the JS
# implementation.
- name: y-php conformance
run: |
composer --working-dir=includes/lib/y-php install --no-progress
composer --working-dir=includes/lib/y-php test
# The vendored automerge-php library's own conformance suite:
# ported upstream Automerge JS/Rust tests (680 mapped). Needs no
# Composer install (hand-rolled runner). The runner exits non-zero
# on any failing test; keep its report visible either way.
- name: automerge-php conformance
run: |
status=0
php includes/lib/automerge-php/tests/run.php > automerge-conformance.json || status=$?
php -r '
$report = json_decode( (string) file_get_contents( "automerge-conformance.json" ), true );
if ( ! is_array( $report ) ) {
echo "Runner produced no JSON report:\n";
echo file_get_contents( "automerge-conformance.json" ), "\n";
exit( 1 );
}
printf( "passing=%d failing=%d (%s%%)\n", $report["passingTests"] ?? -1, $report["failingTests"] ?? -1, $report["passPercent"] ?? "?" );
'
if [ "$status" -ne 0 ]; then
echo "=== failing tests ==="
grep -B 8 '"passed": false' automerge-conformance.json || true
fi
exit "$status"
# Tests target the dedicated tests environment (.wp-env.tests.json)
# — the default .wp-env.json is the dev environment, whose afterStart
# hook (the websocket daemon) has no business in CI.
- name: Start wp-env (tests)
run: npm run env:tests start
- name: PHPUnit
run: npm run test:php
e2e:
name: End-to-end (Playwright)
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: |
package-lock.json
gutenberg/package-lock.json
- name: Install plugin dependencies
run: npm ci
- name: Install and build the vendored Gutenberg subtree
run: |
cd gutenberg
npm ci --ignore-scripts
npm run build
- name: Build the plugin bundle
run: npm run build
- name: Install Playwright browser
run: npx playwright install --with-deps chromium
- name: Start wp-env (tests)
run: npm run env:tests start
# The @wordpress/scripts base config applies 2 retries under CI,
# which absorbs the suite's known under-load flake (a fixture login
# navigation can time out in a full run; every spec is green solo —
# see AGENTS.md).
- name: Playwright
run: npm run test:e2e
# cancelled() covers timed-out runs, where we also want artifacts
- name: Upload test artifacts
if: failure() || cancelled()
uses: actions/upload-artifact@v4
with:
name: e2e-artifacts
path: artifacts/
retention-days: 7