mirror of
https://github.com/makecindy/cindy.git
synced 2026-12-06 22:08:18 +08:00
Apply account-pool settings to implicit native subscription tasks. Share hard concurrency limits with provider groups, reserve account handoffs through runtime takeover, and fail over unavailable accounts with context recovery and persisted cooldowns. Resolve Codex defaults through connected-provider routing, clear stale cooldowns on re-login or removal, keep read-only quota separate from concurrency admission, and localize desktop/mobile capacity errors. Use the Kernel Archives Ubuntu mirror with the existing Ubuntu signature verification so Linux checks can install their test tools. Assisted-by: Cindy (https://cindy.app) Signed-off-by: Lizi <jiali@magiclizi.com>
481 lines
19 KiB
YAML
481 lines
19 KiB
YAML
name: client-ci
|
|
|
|
on:
|
|
pull_request:
|
|
# merge queue 把 PR 与最新 main(及排在前面的 PR)合成临时分支,在上面重跑必需检查
|
|
# (verify / Windows unit tests),全绿才合入。没有这个触发,队列会一直等到超时再把 PR 移出。
|
|
merge_group:
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: client-ci-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
XDT_SKIP_AGENT_BIN_INSTALL: '1'
|
|
ELECTRON_SKIP_BINARY_DOWNLOAD: '1'
|
|
ELECTRON_OVERRIDE_DIST_PATH: '${{ github.workspace }}/.electron-stub-dist'
|
|
# 8192: desktop tsc 全量 typecheck 峰值内存随仓体增长已突破 4GB(2026-08-02 起
|
|
# 所有 PR 的 verify 在 Typecheck desktop 步骤稳定 OOM,含纯 mobile 改动);
|
|
# 公开仓 ubuntu-latest runner 内存 16GB,8GB heap 安全。
|
|
NODE_OPTIONS: '--max-old-space-size=8192'
|
|
|
|
jobs:
|
|
# 静态检查、类型检查和 runner 自测与 Linux 单测分片并行。这里不装
|
|
# bundled ripgrep;它只在 Desktop 单测收集时需要,由单测分片自行安装。
|
|
verify-checks:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 40
|
|
|
|
steps:
|
|
- name: Checkout client
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
fetch-depth: 0
|
|
lfs: true
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
|
with:
|
|
run_install: false
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
cache-dependency-path: pnpm-lock.yaml
|
|
|
|
- name: Check built-in Skill bundle versions
|
|
env:
|
|
SKILLS_BASE_REF: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha || github.event.before || 'HEAD' }}
|
|
run: node scripts/check-built-in-skills.mjs --base-ref "$SKILLS_BASE_REF"
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
# 纯文本扫描、秒级返回:逐用例重置模块、真实等待和普通单测读源码文本只允许
|
|
# 比基线少(engineering-conventions.md §3.2 性能预算),在耗时步骤前快速失败。
|
|
- name: Check unit test hygiene
|
|
run: pnpm check:test-hygiene
|
|
|
|
- name: Check settings search coverage
|
|
env:
|
|
SETTINGS_BASE_REF: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha || github.event.before || 'HEAD^' }}
|
|
run: pnpm check:settings-search --base-ref "$SETTINGS_BASE_REF"
|
|
|
|
# test:unit 的 runner 自测不能跟着 Vitest 分片重复执行;在检查 job 中跑一次,
|
|
# Linux 单测分片只负责 workspace unit tier。
|
|
- name: Run test runner self-tests
|
|
run: pnpm test:runner
|
|
|
|
# Cross-file security, permission, and design contracts are intentionally
|
|
# outside the ordinary behavior-test pool, but remain a required gate.
|
|
- name: Run Desktop and Mobile source-contract guards
|
|
run: pnpm test:guard
|
|
|
|
# No private service checkout or secrets: exercise production clients over real
|
|
# loopback WebSockets with bounded fault injection. Failure blocks verify.
|
|
- name: Run Device Link connection integration tests
|
|
run: |
|
|
pnpm --filter desktop exec tsc --project ../../scripts/device-link/tsconfig.json
|
|
pnpm test:device-link
|
|
|
|
# DS-7: candidate merge/head versus the event base; only mature colour
|
|
# consumers block. Geometry/adoption observations remain report-only.
|
|
- name: Check added design colours
|
|
env:
|
|
DESIGN_BASE_REF: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha || github.event.before || 'HEAD^' }}
|
|
DESIGN_HEAD_REF: ${{ github.sha }}
|
|
run: pnpm check:design-colors --base-ref "$DESIGN_BASE_REF" --head-ref "$DESIGN_HEAD_REF"
|
|
|
|
- name: Check design inventory registration
|
|
run: pnpm check:design-inventory
|
|
|
|
- name: Check endpoint literals
|
|
run: pnpm check:endpoints
|
|
|
|
# i18n 三道静态门禁:key 结构一致性、品牌名收口、术语表一致性。
|
|
# 都是纯文件扫描、秒级返回,放在耗时的 typecheck / 单测之前快速失败。
|
|
- name: Check i18n key consistency
|
|
run: pnpm check:i18n
|
|
|
|
- name: Check brand terminology
|
|
run: pnpm check:brand-terminology
|
|
|
|
- name: Check i18n glossary
|
|
run: pnpm check:i18n-glossary
|
|
|
|
# desktop 的 tsc 峰值内存已经贴着全局 4096MB 上限(2026-08-03 本地实测
|
|
# 约 4.2GB,`--extendedDiagnostics` 下 Types ~125 万、Instantiations ~277 万),
|
|
# 在 runner 上会随机 OOM(FATAL ERROR: Ineffective mark-compacts near heap
|
|
# limit)。已排除单点热点:移走最大的单个测试文件只省 ~5MB、移走 1400 行的
|
|
# 插件页组件只省 ~14MB,skipLibCheck 也早已开启——是整仓类型规模的自然结果,
|
|
# 不是某处写法。这一步单独给更大的堆,其它步骤维持全局值。
|
|
- name: Typecheck desktop
|
|
env:
|
|
NODE_OPTIONS: '--max-old-space-size=6144'
|
|
run: pnpm --filter desktop typecheck
|
|
|
|
- name: Typecheck mobile
|
|
run: pnpm --filter mobile typecheck
|
|
|
|
- name: Validate SQLite migrations
|
|
env:
|
|
XDT_MIGRATION_BASE_REF: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha || github.event.before || 'origin/main' }}
|
|
run: pnpm --filter desktop db:validate
|
|
|
|
- name: Run scheduler architecture guard
|
|
run: pnpm ci:scheduler-guard
|
|
|
|
- name: Run mobile scope guard
|
|
run: pnpm --filter mobile test:scope
|
|
|
|
# Linux 单测使用与 Windows 相同的确定性 Vitest 分片。四个分片分别覆盖每个
|
|
# workspace 经 Vitest 切分后的测试文件,并集等于完整 unit tier;不重复 test:runner。
|
|
linux-unit-shards:
|
|
name: Linux unit tests (${{ matrix.shard }}/4)
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 40
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
shard: [1, 2, 3, 4]
|
|
env:
|
|
XDT_UNIT_TEST_SHARD: ${{ matrix.shard }}/4
|
|
|
|
steps:
|
|
- name: Checkout client
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
# Unit shards only read the working tree; full history and every remote
|
|
# branch cost ~0.5 min per shard (verify, runner and Git jobs keep depth 0).
|
|
with:
|
|
lfs: true
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
|
with:
|
|
run_install: false
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
cache-dependency-path: pnpm-lock.yaml
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
# XDT_SKIP_AGENT_BIN_INSTALL 跳过了 postinstall 的全部 agent 二进制,但
|
|
# runtime-configs.ts 模块顶层的 bundledRipgrepDir() 缺 rg 时直接 throw,
|
|
# 会让 apps/desktop 单测在收集阶段全挂——每个分片都必须单独装回来。
|
|
# 缓存 bundled ripgrep:各分片都要装,GitHub Releases 偶发 504 时会整批变红。
|
|
# 命中后 install:ripgrep 按 .version 标记直接跳过下载。
|
|
- name: Cache bundled ripgrep
|
|
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
with:
|
|
path: apps/ripgrep-bin
|
|
key: ripgrep-bin-${{ runner.os }}-${{ hashFiles('tools/ripgrep/latest.json') }}
|
|
|
|
- name: Install bundled ripgrep
|
|
env:
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
run: pnpm install:ripgrep
|
|
|
|
- name: Install Linux user-installer test tools
|
|
run: |
|
|
# Ubuntu's archive hostnames have repeatedly failed DNS on runners.
|
|
# Use the Kernel Archives' Ubuntu mirror without changing Ubuntu's
|
|
# archive signing keys or the image's security fallback.
|
|
if [ -f /etc/apt/apt-mirrors.txt ]; then
|
|
sudo sed -i -e '/azure\.archive\.ubuntu\.com/d' \
|
|
-e 's|https://archive\.ubuntu\.com/ubuntu/|https://mirrors.kernel.org/ubuntu/|' \
|
|
/etc/apt/apt-mirrors.txt
|
|
fi
|
|
sudo apt-get update
|
|
sudo apt-get install --yes libarchive-tools binutils desktop-file-utils xdg-utils
|
|
|
|
- name: Run client and package unit test shard
|
|
# package script 会传递 npm_execpath,让子进程复用当前 pnpm 入口。
|
|
run: pnpm run test:workspaces --tier unit
|
|
|
|
# 真实进程与 Unix socket 覆盖独立执行一次,不混入日常 unit 或其他分片。
|
|
- name: Run Pi manager integration tests
|
|
if: matrix.shard == 1
|
|
run: pnpm run test:workspaces --tier integration --workspace @cindy/maker-pi-manager
|
|
|
|
# localDb suites are outside the unit tier; exercise these DB boundaries on both OSes.
|
|
- name: Run companion database regressions
|
|
if: matrix.shard == 1
|
|
run: pnpm --filter desktop exec vitest run src/main/localDb/ipc/__tests__/botCanonicalSession.test.ts src/main/localDb/ipc/__tests__/botRemoteResourceProvider.test.ts
|
|
|
|
# Detect once without dependency installation; unrelated changes allocate no
|
|
# Windows/macOS Host runners. All event types retain the stable verify gate.
|
|
host-changes:
|
|
name: Select Host regressions
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
outputs:
|
|
required: ${{ steps.changes.outputs.required }}
|
|
steps:
|
|
- name: Checkout client
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Select Host regressions
|
|
id: changes
|
|
run: node scripts/ci-host-tests.mjs
|
|
|
|
# Host's Node tests are outside the Vitest workspace tiers. Exercise its
|
|
# actual loaders, HTTP authorization and worker processes on every desktop OS.
|
|
# Credential tests use synthetic records; no login or system keychain access.
|
|
host-regressions:
|
|
needs: host-changes
|
|
if: needs.host-changes.outputs.required == 'true'
|
|
name: Host regressions (${{ matrix.os }})
|
|
runs-on: ${{ matrix.os }}
|
|
timeout-minutes: 20
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
steps:
|
|
- name: Checkout client
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
lfs: true
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
|
with:
|
|
run_install: false
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
cache-dependency-path: pnpm-lock.yaml
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
- name: Run Host regressions
|
|
run: pnpm --filter @cindy/host test
|
|
# Types are platform independent: once is enough. A shared desktop body that
|
|
# gains a port wired only in the desktop assembly passes the desktop checks
|
|
# and fails here instead of at runtime in the Host.
|
|
- name: Typecheck Host
|
|
if: matrix.os == 'ubuntu-latest'
|
|
run: pnpm --filter @cindy/host typecheck
|
|
|
|
# 保留原 required check 名 verify;Host 仅允许明确无关时跳过,选择失败也阻断。
|
|
verify:
|
|
name: verify
|
|
if: ${{ always() }}
|
|
needs:
|
|
- verify-checks
|
|
- linux-unit-shards
|
|
- host-changes
|
|
- host-regressions
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Require checks and every Linux unit shard
|
|
env:
|
|
VERIFY_CHECKS_RESULT: ${{ needs.verify-checks.result }}
|
|
LINUX_UNIT_SHARDS_RESULT: ${{ needs.linux-unit-shards.result }}
|
|
HOST_CHANGES_RESULT: ${{ needs.host-changes.result }}
|
|
HOST_REQUIRED: ${{ needs.host-changes.outputs.required }}
|
|
HOST_REGRESSIONS_RESULT: ${{ needs.host-regressions.result }}
|
|
run: |
|
|
test "$VERIFY_CHECKS_RESULT" = "success"
|
|
test "$LINUX_UNIT_SHARDS_RESULT" = "success"
|
|
test "$HOST_CHANGES_RESULT" = "success"
|
|
case "$HOST_REQUIRED:$HOST_REGRESSIONS_RESULT" in
|
|
true:success|false:skipped) ;;
|
|
*) echo "Host selection or regressions did not pass"; exit 1 ;;
|
|
esac
|
|
|
|
# Linux 全绿不能覆盖 path separator、盘符、大小写和文件系统能力差异。四个
|
|
# Windows 分片并行运行,分片并集仍完整覆盖 test:unit,不能缩成少量 smoke。
|
|
# 只需执行一次的检查放在 windows-runner-checks,不压在任一分片的关键路径上。
|
|
windows-unit-shards:
|
|
name: Windows unit tests (${{ matrix.shard }}/4)
|
|
runs-on: windows-latest
|
|
timeout-minutes: 40
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
shard: [1, 2, 3, 4]
|
|
env:
|
|
XDT_UNIT_TEST_SHARD: ${{ matrix.shard }}/4
|
|
|
|
steps:
|
|
- name: Checkout client
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
# Unit shards only read the working tree; full history and every remote
|
|
# branch cost ~0.5 min per shard (verify, runner and Git jobs keep depth 0).
|
|
with:
|
|
lfs: true
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
|
with:
|
|
run_install: false
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
cache-dependency-path: pnpm-lock.yaml
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
# 缓存 bundled ripgrep:各分片都要装,GitHub Releases 偶发 504 时会整批变红。
|
|
# 命中后 install:ripgrep 按 .version 标记直接跳过下载。
|
|
- name: Cache bundled ripgrep
|
|
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
with:
|
|
path: apps/ripgrep-bin
|
|
key: ripgrep-bin-${{ runner.os }}-${{ hashFiles('tools/ripgrep/latest.json') }}
|
|
|
|
- name: Install bundled ripgrep
|
|
env:
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
run: pnpm install:ripgrep
|
|
|
|
- name: Run client and package unit tests
|
|
# 通过 package script 传递
|
|
# npm_execpath,避免 Windows 子进程退回 PATH 上的 pnpm.cmd。
|
|
run: pnpm run test:workspaces --tier unit
|
|
|
|
# Windows runner 自测和伴侣数据库回归各只需执行一次。单独并行运行,避免给
|
|
# 某一个 unit 分片额外叠加约 4 分钟、拖长整条关键路径。
|
|
windows-runner-checks:
|
|
name: Windows runner and database checks
|
|
runs-on: windows-latest
|
|
timeout-minutes: 25
|
|
|
|
steps:
|
|
- name: Checkout client
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
fetch-depth: 0
|
|
lfs: true
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
|
with:
|
|
run_install: false
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
cache-dependency-path: pnpm-lock.yaml
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
# 缓存 bundled ripgrep:各分片都要装,GitHub Releases 偶发 504 时会整批变红。
|
|
# 命中后 install:ripgrep 按 .version 标记直接跳过下载。
|
|
- name: Cache bundled ripgrep
|
|
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
with:
|
|
path: apps/ripgrep-bin
|
|
key: ripgrep-bin-${{ runner.os }}-${{ hashFiles('tools/ripgrep/latest.json') }}
|
|
|
|
- name: Install bundled ripgrep
|
|
env:
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
run: pnpm install:ripgrep
|
|
|
|
# 保留 Windows 路径、进程与锁的自测覆盖。
|
|
- name: Run Windows test runner self-tests
|
|
run: pnpm test:runner
|
|
|
|
- name: Check Windows Codex credential publication
|
|
run: node --experimental-strip-types apps/desktop/scripts/check-windows-codex-auth-move.mjs
|
|
|
|
# localDb suites are outside the unit tier; exercise these DB boundaries on both OSes.
|
|
- name: Run companion database regressions
|
|
run: pnpm --filter desktop exec vitest run src/main/localDb/ipc/__tests__/botCanonicalSession.test.ts src/main/localDb/ipc/__tests__/botRemoteResourceProvider.test.ts
|
|
|
|
# Reuse this supported runner and its native dependencies. Do not filter the
|
|
# workflow itself: PRs, merge queue and main pushes must keep the stable gate.
|
|
- name: Select database regressions
|
|
id: database-changes
|
|
run: node scripts/ci-database-tests.mjs detect
|
|
|
|
# Includes real empty/old database upgrades and reopen/idempotency checks.
|
|
# The runner rejects unsupported platforms and skipped migration replay.
|
|
- name: Run database and migration regressions
|
|
if: steps.database-changes.outputs.required == 'true'
|
|
run: node scripts/ci-database-tests.mjs run
|
|
|
|
# 保留稳定的必需检查名,并确保任一分片或一次性检查失败、取消都会阻断汇总门禁。
|
|
windows-unit:
|
|
name: Windows unit tests
|
|
if: ${{ always() }}
|
|
needs:
|
|
- windows-unit-shards
|
|
- windows-runner-checks
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Require every Windows unit shard and runner checks
|
|
env:
|
|
WINDOWS_UNIT_SHARDS_RESULT: ${{ needs.windows-unit-shards.result }}
|
|
WINDOWS_RUNNER_CHECKS_RESULT: ${{ needs.windows-runner-checks.result }}
|
|
run: |
|
|
test "$WINDOWS_UNIT_SHARDS_RESULT" = "success"
|
|
test "$WINDOWS_RUNNER_CHECKS_RESULT" = "success"
|
|
|
|
git-integration:
|
|
name: Desktop Git integration
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 25
|
|
|
|
steps:
|
|
- name: Checkout client
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
fetch-depth: 0
|
|
lfs: true
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
|
with:
|
|
run_install: false
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
cache-dependency-path: pnpm-lock.yaml
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
# 缓存 bundled ripgrep:各分片都要装,GitHub Releases 偶发 504 时会整批变红。
|
|
# 命中后 install:ripgrep 按 .version 标记直接跳过下载。
|
|
- name: Cache bundled ripgrep
|
|
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
with:
|
|
path: apps/ripgrep-bin
|
|
key: ripgrep-bin-${{ runner.os }}-${{ hashFiles('tools/ripgrep/latest.json') }}
|
|
|
|
- name: Install bundled ripgrep
|
|
env:
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
run: pnpm install:ripgrep
|
|
|
|
- name: Run Desktop Git integration tests
|
|
run: pnpm test:git-integration
|