forked from lynx-family/lynx-stack
-
Notifications
You must be signed in to change notification settings - Fork 0
435 lines (423 loc) · 16.1 KB
/
test.yml
File metadata and controls
435 lines (423 loc) · 16.1 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
name: Test
on:
pull_request:
branches:
- main
paths-ignore:
- "**/*.md"
merge_group:
types: [checks_requested]
permissions:
repository-projects: read
contents: read
statuses: read
env:
CI: 1
TURBO_TELEMETRY_DISABLED: 1
concurrency:
group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
benchmark:
needs: build
uses: ./.github/workflows/workflow-bench.yml
build:
uses: ./.github/workflows/workflow-build.yml
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
bundle-analysis:
needs: build
uses: ./.github/workflows/workflow-bundle-analysis.yml
code-style-check:
runs-on: lynx-ubuntu-24.04-medium
timeout-minutes: 10
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
# We need full history for changeset status check
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5
with:
node-version: "24"
package-manager-cache: false
- name: Install
run: |
npm install -g corepack@latest
corepack enable
pnpm install --frozen-lockfile
- name: Code Style Check
run: |
pnpm dprint check
pnpm biome check
- name: Package Metadata Check
run: pnpm --package=@pnpm/meta-updater@2.0.6 dlx meta-updater --test
- name: API Check
run: pnpm turbo api-extractor
- name: Changeset Check
run: pnpm changeset status --since=origin/main --output .changeset-status.json
- name: Major Bump Check
run: node .github/scripts/check-no-major-changeset.cjs .changeset-status.json
- name: Changeset Heading Check
run: node .github/scripts/check-no-heading-changeset.cjs .changeset-status.json
- name: Dependency Changeset Check
run: node .github/scripts/check-dep-changes-have-changeset.cjs .changeset-status.json
eslint:
needs: build
uses: ./.github/workflows/workflow-test.yml
permissions: {}
with:
runs-on: lynx-ubuntu-24.04-medium
run: pnpm eslint . --flag v10_config_lookup_from_file
ui-judge:
needs: build
uses: ./.github/workflows/workflow-test.yml
secrets:
MIDSCENE_MODEL_API_KEY: ${{ secrets.MIDSCENE_MODEL_API_KEY }}
MIDSCENE_MODEL_BASE_URL: ${{ secrets.MIDSCENE_MODEL_BASE_URL }}
MIDSCENE_MODEL_FAMILY: ${{ secrets.MIDSCENE_MODEL_FAMILY }}
MIDSCENE_MODEL_NAME: ${{ secrets.MIDSCENE_MODEL_NAME }}
MIDSCENE_OPENAI_INIT_CONFIG_JSON: ${{ secrets.MIDSCENE_OPENAI_INIT_CONFIG_JSON }}
with:
runs-on: lynx-custom-container
is-web: true
upload-codecov: false
artifact-name: ui-judge-results
artifact-path: ui-judge-results.json
artifact-if-no-files-found: error
web-report-name: ui-judge-playwright-report
web-report-path: packages/genui/ui-judge/playwright-report
run: |
cd "$GITHUB_WORKSPACE"
set -eu
export UI_JUDGE_RESULT_FILE="$GITHUB_WORKSPACE/ui-judge-results.json"
if [ -z "${MIDSCENE_MODEL_NAME:-}" ] || [ -z "${MIDSCENE_MODEL_API_KEY:-}" ]; then
UI_JUDGE_RESULT_ERROR_MESSAGE="Midscene secrets are unavailable; UI Judge model test was skipped." node .github/scripts/write-ui-judge-result.mjs
echo "Midscene secrets are unavailable; skipping UI Judge."
exit 0
fi
ulimit -Sn 655350
pnpm --filter @lynx-js/ui-judge run test:playwright
ui-judge-comment:
needs: ui-judge
if: always()
runs-on: lynx-ubuntu-24.04-medium
permissions:
contents: read
issues: write
pull-requests: write
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && needs.ui-judge.result != 'skipped' && needs.ui-judge.result != 'cancelled' }}
with:
persist-credentials: false
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && needs.ui-judge.result != 'skipped' && needs.ui-judge.result != 'cancelled' }}
with:
name: ui-judge-results
- name: Comment UI Judge result
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && needs.ui-judge.result != 'skipped' && needs.ui-judge.result != 'cancelled' }}
uses: ./.github/actions/ui-judge-comment
with:
result-file: ui-judge-results.json
lighthouse:
needs: build
uses: ./.github/workflows/workflow-test.yml
permissions:
statuses: write
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
with:
runs-on: lynx-custom-container
is-web: true
run: |
ulimit -Sn 655350
export NODE_OPTIONS="--max-old-space-size=32768"
pnpm --filter @lynx-js/web-core-e2e run lh || echo "Lighthouse failed"
playwright-web-elements:
needs: build
uses: ./.github/workflows/workflow-test.yml
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
strategy:
fail-fast: false
matrix:
shard: [1, 2]
name: Playwright Web Elements Test (${{ matrix.shard }}/2)
with:
runs-on: lynx-custom-container
is-web: true
codecov-flags: "e2e"
web-report-path: "packages/web-platform/web-elements/playwright-report"
run: |
ulimit -Sn 655350
export NODE_OPTIONS="--max-old-space-size=32768"
export PLAYWRIGHT_JUNIT_OUTPUT_NAME=test-report.junit.xml
pnpm --filter @lynx-js/web-elements run test --reporter='github,dot,junit,html' --shard=${{ matrix.shard }}/2
pnpm --filter @lynx-js/web-elements run coverage:ci
web-core-e2e:
needs: build
uses: ./.github/workflows/workflow-test.yml
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
name: Playwright ${{ matrix.render }} (${{ matrix.shard }}/2)
strategy:
fail-fast: false
matrix:
render: [CSR]
shard: [1, 2]
with:
runs-on: lynx-custom-container
is-web: true
web-report-name: "playwright-${{ matrix.render }}-shard${{ matrix.shard }}"
web-report-path: "packages/web-platform/web-core-e2e/playwright-report"
codecov-flags: "e2e"
run: |
if [ "${{ matrix.render }}" = "SSR" ]; then
export ENABLE_SSR=true
fi
ulimit -Sn 655350
export NODE_OPTIONS="--max-old-space-size=32768"
export PLAYWRIGHT_JUNIT_OUTPUT_NAME=test-report.junit.xml
pnpm --filter @lynx-js/web-core-e2e run test --reporter='github,dot,junit,html' --shard=${{ matrix.shard }}/2
pnpm --filter @lynx-js/web-core-e2e run coverage:ci
test-api:
needs: build
uses: ./.github/workflows/workflow-test.yml
with:
runs-on: lynx-ubuntu-24.04-medium
run: |
pnpm turbo api-extractor -- --local
if test "$(git diff -- './packages/**/*.api.md' --name-only | wc -l)" -gt 0 ; then
echo "::error::API Report Changes Detected"
echo "The following API reports have changed:"
git diff -- './packages/**/*.api.md' --name-only
echo "::error::Please run 'turbo api-extractor -- --local' to update them."
echo ""
exit 1;
fi
git add --intent-to-add .
if test "$(git diff -- './packages/**/*.api.md' --name-only | wc -l)" -gt 0 ; then
echo "::error::API Report Changes Detected"
echo "The following API reports have changed:"
git diff -- './packages/**/*.api.md' --name-only
echo "::error::Please run 'turbo api-extractor -- --local' to update them."
echo ""
exit 1;
fi
test-publish:
needs: build
uses: ./.github/workflows/workflow-test.yml
with:
runs-on: lynx-ubuntu-24.04-medium
run: |
# Generated smoke-test projects do not carry a packageManager pin, so
# keep this stage on pnpm 10 even when Corepack's registry default moves.
corepack prepare pnpm@10.29.3 --activate
pnpm dlx @pnpm/registry-mock@4 prepare
pnpm dlx @pnpm/registry-mock@4 &
printf '\n//localhost:4873/:_authToken="this-is-a-fake-token"\n' >> ~/.npmrc
pnpm changeset version --snapshot regression
node packages/tools/canary-release/snapshot.js
pnpm --recursive publish --no-git-checks --access public --registry=http://localhost:4873
cd `mktemp -d`
npx --registry http://localhost:4873 create-rspeedy-canary@latest --template react --dir create-rspeedy-regression --tools eslint --skill lynx-devtool
cd create-rspeedy-regression
npx --registry http://localhost:4873 upgrade-rspeedy-canary@latest
pnpm install --registry=http://localhost:4873
pnpm run build
pnpm run build --mode development
pnpm run lint
cd `mktemp -d`
npx --registry http://localhost:4873 create-rspeedy-canary@latest --template react --dir create-rspeedy-regression-vitest-rltl --tools eslint,vitest-rltl
cd create-rspeedy-regression-vitest-rltl
npx --registry http://localhost:4873 upgrade-rspeedy-canary@latest
pnpm install --registry=http://localhost:4873
pnpm run build
pnpm run build --mode development
pnpm run lint
pnpm run test
cd `mktemp -d`
npx --registry http://localhost:4873 create-rspeedy-canary@latest --template react --dir create-rspeedy-regression-rstest-rltl --tools eslint,rstest-rltl
cd create-rspeedy-regression-rstest-rltl
npx --registry http://localhost:4873 upgrade-rspeedy-canary@latest
pnpm install --registry=http://localhost:4873
pnpm run build
pnpm run build --mode development
pnpm run lint
pnpm run test
test-react:
needs: build
uses: ./.github/workflows/workflow-test.yml
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
runs-on: lynx-ubuntu-24.04-medium
run: >
pnpm
--filter @lynx-js/react-runtime
--filter @lynx-js/react-transform
run test
--reporter=github-actions
--reporter=dot
--reporter=junit
--outputFile=test-report.junit.xml
--coverage.reporter='json'
--coverage.reporter='text'
--testTimeout=50000
--no-cache
--logHeapUsage
--silent
test-rust:
uses: ./.github/workflows/rust.yml
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
test-type:
needs: build
uses: ./.github/workflows/workflow-test.yml
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
runs-on: lynx-ubuntu-24.04-medium
run: pnpm -r run test:type
test-rstest:
needs: build
uses: ./.github/workflows/workflow-test.yml
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
runs-on: lynx-ubuntu-24.04-medium
run: >
pnpm exec rstest run
-c rstest.config.ts
--coverage
--testTimeout=50000
--hookTimeout=50000
kitten-lynx-android-emulator:
needs: build
uses: ./.github/workflows/workflow-test.yml
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
MIDSCENE_MODEL_API_KEY: ${{ secrets.MIDSCENE_MODEL_API_KEY }}
MIDSCENE_MODEL_BASE_URL: ${{ secrets.MIDSCENE_MODEL_BASE_URL }}
MIDSCENE_MODEL_FAMILY: ${{ secrets.MIDSCENE_MODEL_FAMILY }}
MIDSCENE_MODEL_NAME: ${{ secrets.MIDSCENE_MODEL_NAME }}
MIDSCENE_OPENAI_INIT_CONFIG_JSON: ${{ secrets.MIDSCENE_OPENAI_INIT_CONFIG_JSON }}
name: Kitten Lynx Android Emulator Test
with:
runs-on: lynx-ubuntu-22.04-physical-medium
run: |
# 4. Start Emulator
echo "Starting emulator..."
${ANDROID_HOME}/emulator/emulator -avd Nexus_5_API_28 -no-window -no-audio -no-boot-anim -gpu swiftshader_indirect &
# 5. Wait for boot
echo "Waiting for emulator to boot..."
adb wait-for-device
BOOT_TIMEOUT=60
BOOT_ELAPSED=0
while [ "$(adb shell getprop sys.boot_completed | tr -d '\r')" != "1" ]; do
if [ $BOOT_ELAPSED -ge $BOOT_TIMEOUT ]; then
echo "Error: Emulator failed to boot within ${BOOT_TIMEOUT} seconds!"
exit 1
fi
sleep 2
BOOT_ELAPSED=$((BOOT_ELAPSED+2))
done
echo "Emulator is ready."
# 6. Install Lynx Explorer
wget -q https://github.com/lynx-family/lynx/releases/download/3.6.0/LynxExplorer-noasan-release.apk -O LynxExplorer.apk
adb install -r LynxExplorer.apk
# 7. Start Lynx Explorer and verify
echo "Starting Lynx Explorer..."
if ! adb shell pm list packages | grep -q com.lynx.explorer; then
echo "Error: com.lynx.explorer is not installed!"
exit 1
fi
adb shell monkey -p com.lynx.explorer -c android.intent.category.LAUNCHER 1
echo "Waiting for Lynx Explorer to start..."
MAX_RETRIES=10
RETRY_COUNT=0
while ! adb shell pidof com.lynx.explorer > /dev/null; do
if [ $RETRY_COUNT -eq $MAX_RETRIES ]; then
echo "Error: com.lynx.explorer failed to start!"
exit 1
fi
echo "Waiting... ($RETRY_COUNT/$MAX_RETRIES)"
sleep 2
RETRY_COUNT=$((RETRY_COUNT+1))
done
echo "Lynx Explorer is running."
# 8. Run the tests
pnpm --filter @lynx-js/kitten-lynx-test-infra run test --coverage --reporter=github-actions --reporter=dot --reporter=junit --outputFile=test-report.junit.xml --coverage.reporter='json' --coverage.reporter='text' --testTimeout=50000 --no-cache --logHeapUsage --silent
if [ -z "${MIDSCENE_MODEL_NAME:-}" ] || [ -z "${MIDSCENE_MODEL_API_KEY:-}" ]; then
echo "Midscene secrets are unavailable; skipping UI Judge Android integration."
else
UI_JUDGE_ANDROID_INTEGRATION=1 pnpm --filter @lynx-js/ui-judge run test:android --coverage --reporter=github-actions --reporter=dot --reporter=junit --outputFile=ui-judge-android-test-report.junit.xml --coverage.reporter='json' --coverage.reporter='text' --testTimeout=50000 --no-cache --logHeapUsage --silent
fi
test-typos:
runs-on: lynx-ubuntu-24.04-medium
steps:
- uses: taiki-e/checkout-action@3ab630d442e198ebb0ca30872832406ca01c46eb # v1.4.0
- uses: crate-ci/typos@57b11c6b7e54c402ccd9cda953f1072ec4f78e33 # v1.43.5
with:
files: .
test-vitest:
needs: build
uses: ./.github/workflows/workflow-test.yml
strategy:
fail-fast: false
matrix:
runs-on:
- name: Ubuntu
label: lynx-ubuntu-24.04-medium
- name: Windows
label: lynx-windows-2022-large
name: Vitest (${{ matrix.runs-on.name }})
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
runs-on: ${{ matrix.runs-on.label }}
run: >
pnpm run test
--reporter=github-actions
--reporter=dot
--reporter=junit
--outputFile=test-report.junit.xml
--expect.poll.timeout=5000
--testTimeout=50000
--hookTimeout=50000
--coverage
--coverage.reporter='json'
--coverage.reporter='text'
--no-cache
--logHeapUsage
--silent
website:
needs: build
uses: ./.github/workflows/workflow-website.yml
done:
needs:
- benchmark
- code-style-check
- eslint
- ui-judge
- ui-judge-comment
# - playwright-linux
- playwright-web-elements
- test-api
- test-publish
- test-react
- test-rust
- test-type
- test-rstest
- test-typos
- test-vitest
- web-core-e2e
- website
if: always()
runs-on: ubuntu-latest
name: Done
steps:
- run: exit 1
if: ${{ always() && (contains(needs.*.result, 'failure') || contains(needs.*.result, 'skipped') || contains(needs.*.result, 'cancelled')) }}