ci: consolidate primary checks on one larger runner

This commit is contained in:
Tianyi Cui
2026-07-22 17:53:01 +08:00
parent 319005d56b
commit 41609c4ce4
24 changed files with 102 additions and 1330 deletions

View File

@@ -1,7 +1,6 @@
import { fileURLToPath } from 'node:url'
import { dirname, join } from 'node:path'
import { defineAcpSnapshotSuite, type Scenario, type SnapshotSuiteOptions } from '@deepseek-ai/dsh-acp-snapshot'
import { snapshotScenarioShardFromEnv } from './snapshot-scenario-shard.ts'
/**
* The acp-agent example's snapshot suite: the scenario table for
@@ -199,12 +198,9 @@ const SCENARIOS: Scenario[] = [
{ name: 'fs-escalation-approved', hasModelTurn: true, recorded: true, headerClass: 'sandbox' },
]
const scenarioShard = snapshotScenarioShardFromEnv(process.env.DSH_SNAPSHOT_SCENARIO_SHARD)
defineAcpSnapshotSuite({
agent: AGENT,
snapshotsDir: join(dirname(fileURLToPath(import.meta.url)), 'snapshots'),
scenarios: SCENARIOS,
mode: snapshotModeFromEnv(process.env.DSH_SNAPSHOT),
...scenarioShard === undefined ? {} : { scenarioShard },
})

View File

@@ -1,20 +0,0 @@
import { describe, expect, it } from 'vitest'
import { snapshotScenarioShardFromEnv } from './snapshot-scenario-shard.ts'
describe('ACP snapshot scenario shard environment', () => {
it('keeps ordinary snapshot runs complete', () => {
expect(snapshotScenarioShardFromEnv()).toBeUndefined()
expect(snapshotScenarioShardFromEnv('')).toBeUndefined()
})
it('parses a valid one-based shard', () => {
expect(snapshotScenarioShardFromEnv('2/4')).toEqual({ index: 2, total: 4 })
})
it.each(['0/1', '1/0', '2/1', '1.5/2', 'missing', '999999999999999999999/999999999999999999999'])(
'rejects %s',
(value) => {
expect(() => snapshotScenarioShardFromEnv(value)).toThrow('DSH_SNAPSHOT_SCENARIO_SHARD')
},
)
})

View File

@@ -1,18 +0,0 @@
import type { SnapshotScenarioShard } from '@deepseek-ai/dsh-acp-snapshot'
/**
* Parse the optional CI scenario shard passed to this snapshot suite.
*
* @param value An `INDEX/TOTAL` string or an unset value.
* @returns A validated one-based shard, or undefined for the complete suite.
*/
export function snapshotScenarioShardFromEnv(value?: string): SnapshotScenarioShard | undefined {
if (value === undefined || value === '') return undefined
const match = /^([1-9]\d*)\/([1-9]\d*)$/.exec(value)
if (match === null) throw new Error(`DSH_SNAPSHOT_SCENARIO_SHARD must be INDEX/TOTAL, got ${JSON.stringify(value)}`)
const shard = { index: Number(match[1]), total: Number(match[2]) }
if (!Number.isSafeInteger(shard.index) || !Number.isSafeInteger(shard.total) || shard.index > shard.total) {
throw new Error(`DSH_SNAPSHOT_SCENARIO_SHARD is out of range: ${JSON.stringify(value)}`)
}
return shard
}