211 lines
8.9 KiB
YAML
211 lines
8.9 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
# `dev` is the alpha integration branch (AGENTS.md §0): everything lands
|
|
# there first, so its post-merge state needs the same green signal `main`
|
|
# gets. `pull_request` below has no branch filter, so PRs targeting `dev`
|
|
# are already covered.
|
|
branches: [main, dev]
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
# Cancel a superseded PR run (it is on a stale commit); never cancel a
|
|
# push run — it is already producing the post-merge signal. The mount job
|
|
# boots a real DSH + Chromium, so the savings matter there most.
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
|
|
jobs:
|
|
ci:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
with:
|
|
# Tests run git log against this repository and need the full history.
|
|
fetch-depth: 0
|
|
# pnpm version is pinned via packageManager in package.json; the action
|
|
# reads it from there (specifying both makes action-setup fail on
|
|
# purpose with ERR_PNPM_BAD_PM_VERSION).
|
|
- uses: pnpm/action-setup@v6
|
|
- uses: actions/setup-node@v7
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
# The plugin's git revert/cherry-pick spawn git without setting an
|
|
# identity (deliberate, see tests/smoke.spec.ts) and rely on ambient
|
|
# config; the runner has none by default.
|
|
- name: Configure git identity for tests
|
|
run: |
|
|
git config --global user.name "dsh-better-sidebar-ci"
|
|
git config --global user.email "ci@dsh.invalid"
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
- name: Typecheck
|
|
run: pnpm typecheck
|
|
- name: Lint
|
|
run: pnpm lint
|
|
- name: Test
|
|
run: pnpm test
|
|
- name: Build
|
|
run: pnpm build
|
|
# The consumer-facing declaration surface guard: a browser-only plugin
|
|
# (no @types/node, skipLibCheck: false) must type-check against the
|
|
# shipped lib/types. Runs AFTER build (it reads the built output).
|
|
- name: Check consumer type surface
|
|
run: pnpm check:consumer-types
|
|
|
|
# Windows parity lane for the pure-logic suite. The codebase carries real
|
|
# win32 branches (shell parsing, WSL path projection, the PowerShell
|
|
# installer) that mock-injection tests alone cannot validate — this lane
|
|
# runs the same typecheck / test / build / consumer-type-surface steps on
|
|
# a real Windows runtime. The plugin-mount lane (real DSH + Playwright
|
|
# Chromium) stays ubuntu-only and is deliberately NOT mirrored here.
|
|
#
|
|
# It also carries the search-engine gate: real fd/ripgrep binaries land on
|
|
# PATH (choco) before the suite runs, and the output-shape assertions run
|
|
# against them afterwards. Windows is where the engine output format bites
|
|
# hardest (backslash separators, CR line endings, console code pages);
|
|
# docs/ci-windows.md holds the red lines.
|
|
ci-windows:
|
|
runs-on: windows-latest
|
|
timeout-minutes: 30
|
|
defaults:
|
|
run:
|
|
# The runner ships Git Bash: multi-line steps and
|
|
# scripts/check-consumer-types.sh work verbatim.
|
|
shell: bash
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
with:
|
|
# Tests run git log against this repository and need the full history.
|
|
fetch-depth: 0
|
|
# pnpm version is pinned via packageManager in package.json; the action
|
|
# reads it from there (specifying both makes action-setup fail on
|
|
# purpose with ERR_PNPM_BAD_PM_VERSION).
|
|
- uses: pnpm/action-setup@v6
|
|
- uses: actions/setup-node@v7
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
# Same rationale as the ci job: smoke tests spawn git without an
|
|
# identity and rely on ambient config, which the runner lacks.
|
|
- name: Configure git identity for tests
|
|
run: |
|
|
git config --global user.name "dsh-better-sidebar-ci"
|
|
git config --global user.email "ci@dsh.invalid"
|
|
# Real engine binaries for the output-shape assertions below. The probe
|
|
# inside src/search-engines.ts reads PATH, so the whole suite runs with
|
|
# engines present here; the specs never depend on that (they inject
|
|
# their own probes, and the one real-engine case skips when absent).
|
|
- name: Install fd / ripgrep (choco)
|
|
run: choco install fd ripgrep -y --no-progress
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
- name: Typecheck
|
|
run: pnpm typecheck
|
|
- name: Lint
|
|
run: pnpm lint
|
|
# `test:windows` runs the whole suite in ONE fork (`--maxWorkers=1`),
|
|
# not `pnpm test`'s unbounded pool. Two distinct Windows-only failures
|
|
# motivated it, both recorded in docs/plans/2026-09-10-dsh-0.1.5-rc.2-adaptation.md:
|
|
#
|
|
# 1. Six red runs were real 5000 ms vitest timeouts in specs that
|
|
# really start a process (tests/agent-pty:71/:106,
|
|
# tests/install-powershell:105 — a cold powershell.exe start
|
|
# measured 12.1 s, tests/git.spec.ts:85 at 9.6 s). The suite now
|
|
# declares its own budgets (global testTimeout 15 s, 30 s in the
|
|
# two heaviest describes), and serial execution stops the
|
|
# process-spawning specs starving each other on a 2-core runner.
|
|
# 2. Four runs died at teardown with `[vitest-pool]: Worker forks
|
|
# emitted error / Worker exited unexpectedly` while reporting
|
|
# N-1 of N files passed and zero FAIL lines — a worker recycling
|
|
# race, not a test failure. It survived --maxWorkers=2, so the
|
|
# lane now recycles nothing at all.
|
|
#
|
|
# No retries: they would hide a real regression instead of removing the
|
|
# race. The cost is wall-clock (the Windows step runs several minutes
|
|
# against a 30-minute job budget), not signal.
|
|
- name: Test
|
|
run: pnpm test:windows
|
|
- name: Build
|
|
run: pnpm build
|
|
- name: Check consumer type surface
|
|
run: pnpm check:consumer-types
|
|
# Output-shape assertions on the REAL engine binaries installed above:
|
|
# the plugin's own argv must produce '/'-separated, CR-free paths and
|
|
# hit a non-ASCII file name. An engine that is absent skips (so the
|
|
# script stays runnable on a dev machine); an assertion failure exits
|
|
# non-zero.
|
|
- name: Engine output-shape assertions (real fd/rg)
|
|
run: pnpm check:engines
|
|
|
|
# Pack the plugin as an npm tarball, mount it into a REAL DSH instance
|
|
# through the official `dsh plugin --profile web add` channel, and render
|
|
# the DSH web UI headlessly (Playwright Chromium) to prove the plugin
|
|
# mounts without crashing the shell. Drives `pnpm test:mount`, which boots
|
|
# a keyless `dsh web` against a scratch profile and sweeps every built-in
|
|
# sidebar tab. No API key needed — the whole lane is deterministic.
|
|
plugin-mount:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
# CI runs must never report to the production telemetry endpoint baked
|
|
# into the DSH composition (same guard DSH's own CI uses).
|
|
env:
|
|
DSH_TELEMETRY_DISABLED: '1'
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
|
|
# pnpm version is pinned via packageManager in package.json; the action
|
|
# reads it from there (specifying both makes action-setup fail on
|
|
# purpose with ERR_PNPM_BAD_PM_VERSION).
|
|
- uses: pnpm/action-setup@v6
|
|
|
|
- uses: actions/setup-node@v7
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
# Pin the exact 0.2.1-rc.1 host CLI; never use a dist-tag.
|
|
# Keep peer resolution ON: do not add --legacy-peer-deps; it skips boot peers.
|
|
# The lanes speak the slash-only RPC dialect (tests/e2e/host-protocol.ts).
|
|
# NODE_OPTIONS below preserves the heap budget needed for prerelease peer resolution.
|
|
- name: Install dsh CLI (pinned)
|
|
env:
|
|
NODE_OPTIONS: --max-old-space-size=4096
|
|
run: npm install -g @deepseek-ai/dsh@0.2.1-rc.1
|
|
|
|
# lib/ is gitignored; the tarball is produced from this build.
|
|
- name: Build and pack the npm tarball
|
|
run: pnpm build && pnpm pack
|
|
|
|
- name: Install Playwright Chromium
|
|
run: pnpm exec playwright install --with-deps chromium
|
|
|
|
- name: Mount + headless-render smoke
|
|
run: pnpm test:mount
|
|
|
|
# Aggregate double-mount regression: a fixture aggregate bundle mounts
|
|
# dsh-better-sidebar under its own entry id BEFORE the plugin's bundle
|
|
# row; the plugin must back off (no duplicate /sidebar/api, boot OK).
|
|
# Uses the pinned DSH CLI installed above.
|
|
- name: Aggregate double-mount regression
|
|
env:
|
|
DSH_CMD: dsh
|
|
run: pnpm test:mount:aggregate
|
|
|
|
- name: Upload Playwright report on failure
|
|
if: failure()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: playwright-report
|
|
path: |
|
|
playwright-report/
|
|
test-results/
|
|
if-no-files-found: ignore
|