refine(ci): keep Electron preparation independent of build

This commit is contained in:
turtle1999 committed 2026-09-30 17:57:24 +08:00
1 parent 40133c707f
commit fe56439edc
5 files changed
+14 -10

No files matched your search

+2 -2
View File
@@ -30,8 +30,8 @@
en: 84a9cc7ca9455aa8
zh: 4091b8aa8231b74a
/deepseek-harness-desktop/develop:
en: a468943c4ea8a919
zh: 3f484eef0fdcd283
en: fe6d23e6a3d3bc66
zh: d60c8d3a55747916
/deepseek-harness-desktop/develop/startup-onboarding:
en: a51346b8d880ddba
zh: 7913214c1c66063c
+1 -1
View File
@@ -160,7 +160,7 @@ The Web counterparts are `pnpm run dev:web` and `pnpm run start:web`, documented
The [native/renderer keyboard tests](tests/keyboard.spec.ts) compile as part of the repository Client typecheck. Their Desktop imports are limited to Cordis-free input, persistence, IPC, browser-guest, and overlay modules.
Before running the [Windows console-signal tests](tests/windows-cli-signals.spec.ts) directly, prepare the locked Electron binary with `pnpm --filter @deepseek-ai/dsh-desktop exec install-electron` from the repository root. For downloads through a proxy, enable `ELECTRON_GET_USE_PROXY=1` for that installer process. Windows coverage aggregates require successful provisioning before the instrumented unit inventory starts.
Dependency installation does not run the locked Electron package's separate binary installer. Before running the [Windows console-signal tests](tests/windows-cli-signals.spec.ts) directly, prepare the locked Electron binary with `pnpm --filter @deepseek-ai/dsh-desktop exec install-electron` from the repository root. For downloads through a proxy, enable `ELECTRON_GET_USE_PROXY=1` for that installer process. Windows coverage aggregates require successful provisioning before the instrumented unit inventory starts.
### Startup onboarding
+1 -1
View File
@@ -162,7 +162,7 @@ Web 侧的对应命令是 `pnpm run dev:web` 与 `pnpm run start:web`,见[开
[原生输入与渲染进程键盘测试](tests/keyboard.spec.ts)直接纳入仓库 Client 类型检查。它只导入不依赖 Cordis 的 Desktop 输入、持久化、IPC、浏览器 guest 和蒙层模块。
直接运行 [Windows 控制台信号测试](tests/windows-cli-signals.spec.ts)前,在仓库根目录执行 `pnpm --filter @deepseek-ai/dsh-desktop exec install-electron`,准备锁定版本的 Electron 二进制。通过代理下载时,为该安装进程启用 `ELECTRON_GET_USE_PROXY=1`。Windows 覆盖率检查要求安装成功后,才启动带覆盖率插桩的单元测试集。
安装工作区依赖不会自动运行锁定版本 Electron 提供的独立二进制安装程序。直接运行 [Windows 控制台信号测试](tests/windows-cli-signals.spec.ts)前,在仓库根目录执行 `pnpm --filter @deepseek-ai/dsh-desktop exec install-electron`,准备锁定版本的 Electron 二进制。通过代理下载时,为该安装进程启用 `ELECTRON_GET_USE_PROXY=1`。Windows 覆盖率检查要求安装成功后,才启动带覆盖率插桩的单元测试集。
### 启动引导
+8 -4
View File
@@ -149,6 +149,7 @@ function withEnv<T>(name: string, value: string | undefined, action: () => T): T
}
}
// Mutates worker-global state: only use for synchronous, non-concurrent graph inspection.
function withPlatform<T>(platform: NodeJS.Platform, action: () => T): T {
const original = Object.getOwnPropertyDescriptor(process, 'platform')!
Object.defineProperty(process, 'platform', { ...original, value: platform })
@@ -547,6 +548,7 @@ describe('gate graph validation', () => {
const installers = gates.filter(gate => gate.id === 'electron-install')
expect(installers).toHaveLength(1)
expect(installers[0]?.allowFailure).not.toBe(true)
expect(installers[0]?.needs ?? []).not.toContain('build')
expect(gates.find(gate => gate.id === 'coverage')?.needs).toContain('electron-install')
let installed = false
await runGates(gates, 8, async (subject) => {
@@ -592,12 +594,12 @@ describe('gate graph validation', () => {
},
)
it.each(['ci-primary', 'ci-linux-primary', 'ci-coverage', 'ci-artifacts', 'ci-windows-blocking'] as const)(
it.each(['ci-coverage', 'ci-artifacts', 'ci-windows-blocking'] as const)(
'only provisions Electron for native Windows coverage in %s', (mode) => {
const original = Object.getOwnPropertyDescriptor(process, 'platform')
for (const platform of ['linux', 'darwin', 'win32'] as const) {
const gates = withPlatform(platform, () => withPnpmEntrypoint(() => gatesForMode(mode)))
const needed = platform === 'win32' && ['ci-primary', 'ci-linux-primary', 'ci-coverage'].includes(mode)
const needed = platform === 'win32' && mode === 'ci-coverage'
expect(gates.filter(gate => gate.id === 'electron-install')).toHaveLength(needed ? 1 : 0)
if (needed) {
expect(gates.find(gate => gate.id === 'coverage')?.needs).toContain('electron-install')
@@ -609,9 +611,11 @@ describe('gate graph validation', () => {
},
)
it('restores the platform descriptor after failed graph inspection', () => {
it('restores the platform descriptor when coverage configuration is rejected', () => {
const original = Object.getOwnPropertyDescriptor(process, 'platform')
expect(() => withPlatform('win32', () => { throw new Error('inspection failed') })).toThrow('inspection failed')
expect(() => withEnv('DSH_COVERAGE_PARTITIONS', '1', () =>
withPlatform('win32', () => withPnpmEntrypoint(() => gatesForMode('ci-coverage')))))
.toThrow('DSH_COVERAGE_PARTITIONS must be an integer greater than 1')
expect(Object.getOwnPropertyDescriptor(process, 'platform')).toEqual(original)
})
+2 -2
View File
@@ -582,10 +582,10 @@ function ciWindowsBlockingGates(): Gate[] {
}
function ciWindowsCompleteGates(): Gate[] {
const coverage = coverageGates('win32').map(gate => ({
const coverage = coverageGates('win32').map(gate => gate.id === 'electron-install' ? gate : {
...gate,
needs: [...new Set(['build', ...(gate.needs ?? [])])],
}))
})
const coverageAfter = coverage.map(gate => gate.id)
const observational = ciWindowsObservationalGates()
// Coverage owns Electron preparation. The required production site replaces