Repository navigation
107 lines (103 loc) · 4.41 KB
/
Copy pathci.yml
File metadata and controls
107 lines (103 loc) · 4.41 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
name: CI
# 每次 push / PR 都在三个平台上跑同一套 engine + ui 测试。分片只影响墙钟,不减少覆盖面:
# 所有分片都必须通过。本仓库是公开仓库,GitHub 托管的 runner 不计费,所以这里用**更多
# runner**换更短的等待时间,而不是削减平台或测试范围。
#
# 分片数按实测的最慢 job 配平(2026-10-06,run 37517484489):
# Ubuntu 1/1 @4 worker = 298s,macOS 1/1 @4 worker = 408s,Windows 1/3 @2 worker = 546s。
# 单个 runner 上的 file worker 数保持不变(Windows 仍是 2),只增加机器数量:Windows 收窄到
# 2 是刻意的,用于限制 SQLite/watcher 清理争用,加机器不会放开这个约束。
# 分片数按 573 个测试文件的平均值估算,首轮实测后按最慢分片再调。
#
# 刻意不放进这个工作流的东西(放夜间或手动任务):
# - 真实 LSP 端到端(__tests__/lsp-real-servers.test.ts):需要按平台预装
# 语言服务器,属于环境准备而不是代码门禁;
# - 原生 kernel 构建与 kernel 对齐套件(codegraph-kernel/、kernel-*.test.ts):
# 需要 Rust 工具链,release.yml 已经在发布矩阵里构建各平台 prebuild;
# - 能耗/续航测量:共享 runner 上的墙钟功耗数字没有可比性。
#
# 严格计时门禁(npm run test:perf)同样是手动/夜间触发:它用
# CODEGRAPH_PERF_ASSERT=1 串行跑计时敏感套件,共享 runner 的抖动足以让它误报,
# 因此不阻塞普通 PR —— 普通 `npm test` 里的计时断言已按 perf-utils.ts 的系数放宽。
#
# Windows 上无需额外环境变量:平台差异(路径、命名管道、%APPDATA%、CRLF)在测试里
# 用 it.runIf/skipIf(process.platform ...) 显式分流,见 docs/development.md 的
# "Windows-gated tests"。这里也不引入 cross-env 等新依赖;每个平台各自
# `npm ci` 安装本地二进制(esbuild/rollup 的平台包不能跨平台复用)。
on:
push:
branches: ['**']
paths-ignore:
- 'docs/**'
- '**/*.md'
pull_request:
paths-ignore:
- 'docs/**'
- '**/*.md'
# 同一 ref 的新 push 取消尚未结束的旧 run:连续推送时不把过期的红色结果留在列表里,
# 也不让新 run 排在旧 run 后面等 runner。
# 默认分支(personal)除外:个人发布要先确认“同一提交的 CI 成功”,取消会让那个提交
# 永远等不到成功结果。
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/personal' }}
jobs:
build-test:
name: build-test (${{ matrix.os }}, shard ${{ matrix.shard }})
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
workers: 4
shard: '1/2'
- os: ubuntu-latest
workers: 4
shard: '2/2'
- os: macos-latest
workers: 2
shard: '1/2'
- os: macos-latest
workers: 2
shard: '2/2'
# Separate runners reduce elapsed time while keeping handle contention bounded.
- os: windows-latest
workers: 2
shard: '1/6'
- os: windows-latest
workers: 2
shard: '2/6'
- os: windows-latest
workers: 2
shard: '3/6'
- os: windows-latest
workers: 2
shard: '4/6'
- os: windows-latest
workers: 2
shard: '5/6'
- os: windows-latest
workers: 2
shard: '6/6'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 22
cache: npm
- run: npm ci
# 发布版本镜像必须在耗时构建前失败,避免全量测试结束才发现 UI 版本遗漏。
- run: npm run check:release-metadata
- run: npm run build
# 只跑 engine + ui 两个项目;串行严格计时的 perf 项目不在这里。
- name: Test on macOS with a descriptor budget
if: runner.os == 'macOS'
shell: bash
run: |
printf 'File descriptor soft limit before tests: '
ulimit -Sn
ulimit -Sn 4096
npm test -- --maxWorkers=${{ matrix.workers }} --shard=${{ matrix.shard }}
- run: npm test -- --maxWorkers=${{ matrix.workers }} --shard=${{ matrix.shard }}
if: runner.os != 'macOS'