Files
deepseek-harness/.github/workflows/ci.yml
2026-07-21 21:28:49 +08:00

447 lines
16 KiB
YAML

name: CI
on:
push:
branches: [main, master]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
PRIMARY_NODE_VERSION: '24'
jobs:
node-24:
runs-on: ubuntu-latest
name: node 24 / ${{ matrix.lane }}
timeout-minutes: 1
env:
DSH_GATE_CONCURRENCY: ${{ matrix.gate_concurrency }}
DSH_PUBLINT_CONCURRENCY: ${{ matrix.publint_concurrency }}
DSH_ARTIFACT_SHARD: ${{ matrix.artifact_shard }}
DSH_COVERAGE_MAX_WORKERS: ${{ matrix.coverage_max_workers }}
DSH_COVERAGE_SHARD: ${{ matrix.coverage_shard }}
DSH_LINT_SHARD: ${{ matrix.lint_shard }}
DSH_SNAPSHOT_LANE: ${{ matrix.snapshot_lane }}
DSH_STATIC_SHARD: ${{ matrix.static_shard }}
DSH_SNAPSHOT_MAX_CONCURRENCY: ${{ matrix.snapshot_max_concurrency }}
DSH_SNAPSHOT_PREBUILT: ${{ matrix.snapshot_prebuilt }}
DSH_ESLINT_CACHE: ${{ matrix.eslint_cache }}
strategy:
fail-fast: false
matrix:
include:
- lane: static-foundation
command: pnpm run check:ci:static
gate_concurrency: '4'
static_shard: foundation
- lane: static-api-contracts
command: pnpm run check:ci:static
gate_concurrency: '4'
static_shard: api-contracts
- lane: static-catalogs
command: pnpm run check:ci:static
gate_concurrency: '4'
static_shard: catalogs
- lane: static-prose
command: pnpm run check:ci:static
gate_concurrency: '4'
static_shard: prose
- lane: static-site-projection
command: pnpm run check:ci:static
gate_concurrency: '1'
static_shard: site-projection
- lane: static-site-mpa
command: pnpm run check:ci:static
gate_concurrency: '1'
static_shard: site-build
- lane: typecheck
command: pnpm run typecheck
- lane: lint-package-sources
command: pnpm run check:ci:lint
gate_concurrency: '1'
eslint_cache: '1'
lint_shard: package-sources
- lane: lint-package-tests
command: pnpm run check:ci:lint
gate_concurrency: '1'
eslint_cache: '1'
lint_shard: package-tests
- lane: lint-repository
command: pnpm run check:ci:lint
gate_concurrency: '1'
eslint_cache: '1'
lint_shard: repository
- lane: coverage-core
command: pnpm run check:ci:coverage
gate_concurrency: '1'
coverage_max_workers: '4'
coverage_shard: core
- lane: coverage-models-protocol
command: pnpm run check:ci:coverage
gate_concurrency: '1'
coverage_max_workers: '4'
coverage_shard: models-protocol
- lane: coverage-sdk-codex
command: pnpm run check:ci:coverage
gate_concurrency: '1'
coverage_max_workers: '4'
coverage_shard: sdk-codex
- lane: coverage-interfaces
command: pnpm run check:ci:coverage
gate_concurrency: '1'
coverage_max_workers: '4'
coverage_shard: interfaces
- lane: coverage-execution
command: pnpm run check:ci:coverage
gate_concurrency: '1'
coverage_max_workers: '4'
coverage_shard: execution
- lane: coverage-workflow
command: pnpm run check:ci:coverage
gate_concurrency: '1'
coverage_max_workers: '4'
coverage_shard: workflow
- lane: coverage-workflow-worker
command: pnpm run check:ci:coverage
gate_concurrency: '1'
coverage_max_workers: '4'
coverage_shard: workflow-worker
- lane: coverage-delegation
command: pnpm run check:ci:coverage
gate_concurrency: '1'
coverage_max_workers: '4'
coverage_shard: delegation
- lane: coverage-repository
command: pnpm run check:ci:coverage
gate_concurrency: '1'
coverage_max_workers: '4'
coverage_shard: repository
- lane: coverage-integrations-claude
command: pnpm run check:ci:coverage
gate_concurrency: '1'
coverage_max_workers: '4'
coverage_shard: integrations-claude
- lane: coverage-session-scripts
command: pnpm run check:ci:coverage
gate_concurrency: '1'
coverage_max_workers: '4'
coverage_shard: session-scripts
- lane: coverage-capabilities
command: pnpm run check:ci:coverage
gate_concurrency: '1'
coverage_max_workers: '4'
coverage_shard: capabilities
- lane: snapshot-ordinary
command: pnpm run check:ci:snapshot
gate_concurrency: '1'
snapshot_lane: ordinary
snapshot_max_concurrency: '5'
snapshot_prebuilt: '1'
- lane: snapshot-acp-1
command: pnpm run check:ci:snapshot
gate_concurrency: '1'
snapshot_lane: acp-1
snapshot_max_concurrency: '5'
snapshot_prebuilt: '1'
- lane: snapshot-acp-2
command: pnpm run check:ci:snapshot
gate_concurrency: '1'
snapshot_lane: acp-2
snapshot_max_concurrency: '5'
snapshot_prebuilt: '1'
- lane: snapshot-acp-3
command: pnpm run check:ci:snapshot
gate_concurrency: '1'
snapshot_lane: acp-3
snapshot_max_concurrency: '5'
snapshot_prebuilt: '1'
- lane: snapshot-acp-4
command: pnpm run check:ci:snapshot
gate_concurrency: '1'
snapshot_lane: acp-4
snapshot_max_concurrency: '5'
snapshot_prebuilt: '1'
- lane: artifacts-metadata
command: pnpm run check:ci:artifacts
gate_concurrency: '3'
publint_concurrency: '8'
artifact_shard: metadata
- lane: artifacts-smoke
command: pnpm run check:ci:artifacts
gate_concurrency: '1'
artifact_shard: smoke
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: ${{ env.PRIMARY_NODE_VERSION }}
- name: Enable corepack (pnpm)
run: corepack enable
- name: Resolve pnpm store path
id: pnpm-store
run: echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
- uses: actions/cache@v4
with:
path: ${{ steps.pnpm-store.outputs.path }}
key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
- name: Install (immutable)
run: pnpm install --frozen-lockfile
# The snapshot lanes REPLAY the sandbox example's recorded scenarios,
# re-executing their bash calls under a real runner. ubuntu-latest has
# no bubblewrap preinstalled and no built Landlock launcher, so without
# this the confined executions fail closed (SANDBOX_UNAVAILABLE). Same
# install as sandbox.yml's bwrap leg (incl. the Ubuntu 24.04 AppArmor
# userns knob). Building does not depend on bubblewrap, so overlap them.
- name: Prepare built snapshot runtime and bubblewrap
if: startsWith(matrix.lane, 'snapshot-')
run: |
pnpm run build &
build_pid=$!
(
sudo apt-get install -yq --no-install-recommends bubblewrap
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 \
|| echo "apparmor userns knob absent — the functional probe decides"
) &
sandbox_pid=$!
build_status=0
sandbox_status=0
wait "$build_pid" || build_status=$?
wait "$sandbox_pid" || sandbox_status=$?
if (( build_status != 0 )); then exit "$build_status"; fi
exit "$sandbox_status"
- uses: actions/cache@v4
if: startsWith(matrix.lane, 'lint-')
with:
path: .cache/eslint
key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-eslint-${{ hashFiles('pnpm-lock.yaml', 'eslint.config.mjs', 'tsconfig.json', 'packages/*/*/tsconfig.json', 'examples/*/tsconfig.json') }}
restore-keys: |
${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-eslint-
- name: Run gates
run: ${{ matrix.command }}
node-compat:
runs-on: ubuntu-latest
name: node ${{ matrix.node }}
timeout-minutes: 1
env:
DSH_GATE_CONCURRENCY: '2'
DSH_NODE_COMPAT_SKIP_TYPECHECK: ${{ matrix.skip_typecheck }}
strategy:
fail-fast: false
matrix:
include:
- node: '22.19'
skip_typecheck: '1'
- node: 24
skip_typecheck: '1'
- node: 26
skip_typecheck: '1'
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node }}
- name: Enable corepack (pnpm)
run: corepack enable
- name: Resolve pnpm store path
id: pnpm-store
run: echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
- uses: actions/cache@v4
with:
path: ${{ steps.pnpm-store.outputs.path }}
key: ${{ runner.os }}-node-${{ matrix.node }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-node-${{ matrix.node }}-pnpm-
- name: Install (immutable)
run: pnpm install --frozen-lockfile
- name: Run compatibility gates
run: pnpm run check:node-compat
python-sdk:
runs-on: ubuntu-latest
name: python 3.10 / keyless SDK
timeout-minutes: 1
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.10'
cache: pip
- name: Install uv
run: python -m pip install uv==0.11.23
- name: Run complete keyless Python suite
run: uv run --python 3.10 --group test --project python/sdk pytest
# Blocking Windows build lane: keep the already-green native build protected
# while the broader observational gate matrix below exposes the remaining
# portability work without blocking mainline merges.
windows-build:
runs-on: windows-2025
name: windows / build
timeout-minutes: 3
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: ${{ env.PRIMARY_NODE_VERSION }}
- name: Enable corepack (pnpm)
run: corepack enable
- name: Install (immutable)
run: pnpm install --frozen-lockfile
- name: Build (tsc -b + tsdown)
run: pnpm run build
- name: Build documentation site (production SPA)
run: pnpm run docs:build
# Observational, non-blocking Windows static, lint, and artifact lanes. Coverage
# and snapshot stay Linux-only until their platform-specific runtime failures
# have dedicated support. Run the gates from native PowerShell: an MSYS parent
# would change the environment being measured. This job intentionally stays
# out of all-checks-passed.needs.
windows-gates:
continue-on-error: true
runs-on: windows-2025
name: windows node 24 / ${{ matrix.lane }}
timeout-minutes: 3
env:
DSH_GATE_CONCURRENCY: ${{ matrix.gate_concurrency }}
DSH_PUBLINT_CONCURRENCY: ${{ matrix.publint_concurrency }}
DSH_ARTIFACT_SHARD: ${{ matrix.artifact_shard }}
DSH_STATIC_SHARD: ${{ matrix.static_shard }}
DSH_ESLINT_CACHE: ${{ matrix.eslint_cache }}
strategy:
fail-fast: false
matrix:
include:
- lane: static-foundation
command: pnpm run check:ci:static
gate_concurrency: '4'
static_shard: foundation
- lane: static-api-contracts
command: pnpm run check:ci:static
gate_concurrency: '4'
static_shard: api-contracts
- lane: static-catalogs
command: pnpm run check:ci:static
gate_concurrency: '4'
static_shard: catalogs
- lane: static-prose
command: pnpm run check:ci:static
gate_concurrency: '4'
static_shard: prose
- lane: static-site-projection
command: pnpm run check:ci:static
gate_concurrency: '1'
static_shard: site-projection
- lane: lint
command: pnpm run check:ci:lint
gate_concurrency: '1'
eslint_cache: '1'
- lane: artifacts-metadata
command: pnpm run check:ci:artifacts
gate_concurrency: '3'
publint_concurrency: '8'
artifact_shard: metadata
- lane: artifacts-smoke
command: pnpm run check:ci:artifacts
gate_concurrency: '1'
artifact_shard: smoke
steps:
- uses: actions/checkout@v6
- name: Enable Developer Mode (symlink support)
shell: pwsh
run: >-
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
/t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
- uses: actions/setup-node@v6
with:
node-version: ${{ env.PRIMARY_NODE_VERSION }}
- name: Enable corepack (pnpm)
shell: pwsh
run: corepack enable
- name: Resolve pnpm store path
id: pnpm-store
shell: pwsh
run: '"path=$(pnpm store path --silent)" >> $env:GITHUB_OUTPUT'
- uses: actions/cache@v4
with:
path: ${{ steps.pnpm-store.outputs.path }}
key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
- name: Install (immutable)
shell: pwsh
run: pnpm install --frozen-lockfile
- uses: actions/cache@v4
if: matrix.lane == 'lint'
with:
path: .cache/eslint
key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-eslint-${{ hashFiles('pnpm-lock.yaml', 'eslint.config.mjs', 'tsconfig.json', 'packages/*/*/tsconfig.json', 'examples/*/tsconfig.json') }}
restore-keys: |
${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-eslint-
- name: Run gates
shell: pwsh
run: ${{ matrix.command }}
# Single stable required check for branch protection: require "all checks
# passed" instead of enumerating matrix legs whose names change as lanes and
# node versions evolve. Every blocking job in THIS workflow must be listed in
# `needs`; explicitly observational jobs such as windows-gates stay out
# (`needs` cannot reach across workflow files; e2e.yml stays its own check).
# `if: always()` is load-bearing: without it a failed dependency
# would SKIP this job, and GitHub counts a skipped required check as passing
# — so this job always runs and fails on any non-success result, including
# 'cancelled' and 'skipped'.
all-checks-passed:
name: all checks passed
runs-on: ubuntu-latest
timeout-minutes: 1
needs: [node-24, node-compat, python-sdk, windows-build]
if: always()
steps:
- name: Fail if any needed job did not succeed
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped')
run: |
echo "::error::Needed job results: ${{ join(needs.*.result, ', ') }}"
exit 1
- name: All checks passed
run: echo "All needed jobs succeeded (${{ join(needs.*.result, ', ') }})"