-
Notifications
You must be signed in to change notification settings - Fork 1
69 lines (54 loc) · 1.97 KB
/
Copy pathci.yml
File metadata and controls
69 lines (54 loc) · 1.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
# CI:每次 push / PR 跑 lint + test + build。
# 这是 AI 辅助开发最重要的安全网——模型改坏了什么,由机器把关,
# 而不是等部署到生产后由用户发现。
name: CI
on:
push:
branches: [master]
pull_request:
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v6
with:
node-version: 22
cache: npm
# 不同 npm 版本——甚至 11.x 内部不同小版本——对 optionalDependencies
# 树里 wasm32-wasi 可选原生绑定(@rolldown/binding-wasm32-wasi 等,
# linux-x64/win32 环境下从不会被实际安装)的物理布局(hoist/嵌套路径)
# 算法不同,导致同一份 lockfile 在生成它的 npm 版本下自洽,换一个
# 版本跑 `npm ci` 会报 "Missing ... from lock file"。已用本地精确
# npm 11.6.2 生成 lockfile 并交叉验证:npm 10 / npm 11(其他小版本)
# 复现失败,唯有同一精确版本通过——因此固定到与本地完全一致的版本,
# 而非宽泛的 npm@11(仍会拿到不同小版本、同样报错)。
- name: Align npm version
run: npm install -g npm@11.6.2
- name: Install
run: npm ci
- name: Lint
run: npm run lint
- name: Typecheck
run: npm run typecheck
- name: Test
run: npm test
- name: Build
run: npm run build
# E2E 单列一个 job:需要下载浏览器,比 lint/test/build 慢,隔离开不拖慢主检查。
e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v6
with:
node-version: 22
cache: npm
- name: Align npm version
run: npm install -g npm@11.6.2
- name: Install
run: npm ci
- name: Install Playwright browser
run: npx playwright install --with-deps chromium
- name: E2E
run: npm run test:e2e