pnpm run build ran every step in one serial chain, including the two noEmit aggregate programs (tests, scripts, benchmarks, website) that no artifact step consumes, so the Host aggregate check alone delayed tsdown by about 66 s. - build:src (scripts/build.ts --scope src) builds every artifact in the existing order and writes the client build record; it replaces the removed --artifacts-only flag and the libraries CLI mode. - build:test (--scope test) type-checks only the Host and Client aggregate programs with tsc -p, concurrently, without compiling references or checking prerequisites. - build runs both as one dependency graph through run-gates' new runAggregate: each aggregate check starts once its face's packages are compiled, and Client compilation stays after the Host bundle that writes the Typert /remote declarations. DSH_GATE_CONCURRENCY=1 serializes it; DSH_GATE_FAIL_FAST=1 stops the remaining steps at the first failure. Passing steps print one PASS line (DSH_GATE_VERBOSE=1 shows their output). - PR artifact builds (e2e, release, preview, Node 22 compatibility) and the Python builder (--build-src) use build:src; dev:web and dev:desktop use build:src. test:*, bench, typecheck and the required consumer/Windows lanes keep the complete build. - lint, lint:fix, doc-typecheck and the Typert contracts gate prepare with host-libraries (Host package compilation + Host bundle) instead of build:lib:host; their own checks never read the aggregate root or the Desktop bundle. Parallel and serial build produce byte-identical lib/, Web dist and client build record; a test-only type error fails build and build:test while build:src passes. Refs #5852
128 lines
6.0 KiB
YAML
128 lines
6.0 KiB
YAML
name: E2E (real DeepSeek API)
|
|
|
|
# Real-API end-to-end suite (`pnpm run test:e2e`). Unlike ci.yml this job
|
|
# consumes the DEEPSEEK_API_KEY_EXTERNAL secret (mapped to the env var
|
|
# DEEPSEEK_API_KEY the tests read) and hits the external API at
|
|
# https://api.deepseek.com/anthropic (DEEPSEEK_BASE_URL is pinned explicitly so a
|
|
# stray repo-root .env can't redirect the run).
|
|
#
|
|
# pull_request IS a trigger, but GitHub withholds repo secrets from BOTH forked
|
|
# PRs and Dependabot PRs (the latter are same-repo, fork==false, but still
|
|
# keyless). The job-level `if:` below skips the whole job for those untrusted
|
|
# PRs. The Dependabot test keys on the PR AUTHOR (pull_request.user.login), not
|
|
# github.actor (the run trigger) — a maintainer reopening a Dependabot PR would
|
|
# make github.actor human while the PR is still keyless. When the job runs, the
|
|
# secret is expected, so the preflight hard-fails if it's missing (a missing
|
|
# secret would otherwise make the self-skipping suite report a false green). A
|
|
# job skipped by a job-level `if:` reports as a SUCCESSFUL check, so this
|
|
# workflow is safe to use as a required status check if desired.
|
|
#
|
|
# SECURITY — NEVER change this trigger to `pull_request_target`. `pull_request`
|
|
# checks out and runs the PR's HEAD code WITHOUT secrets for forks, which is what
|
|
# keeps an untrusted fork from exfiltrating the key. `pull_request_target` runs
|
|
# in the BASE repo's context WITH secrets while still able to check out untrusted
|
|
# fork code — a textbook key-leak vector, especially once this repo is public.
|
|
# The fork/secret model and its public-repo implications are recorded in
|
|
# .agents/notes/implemented/testing/2026-06-19-real-api-e2e-ci.md.
|
|
#
|
|
# Note: scheduled triggers are auto-disabled after 60 days of repo inactivity;
|
|
# push/pull_request/workflow_dispatch act as backstops.
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches: [main, master]
|
|
pull_request:
|
|
schedule:
|
|
# 00:17 UTC nightly = 08:17 Asia/Shanghai — off the top-of-hour cron stampede.
|
|
- cron: '17 0 * * *'
|
|
|
|
# Keep only the newest validation in each workflow/ref, including master
|
|
# pushes, nightly runs, and manual dispatches.
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
# Least privilege: this job only reads the repo to run tests.
|
|
permissions:
|
|
contents: read
|
|
|
|
env:
|
|
# CI runs must never report to the production telemetry endpoint baked
|
|
# into apps/cli/cordis.yml (AppCLIEntry disables the row when set).
|
|
DSH_TELEMETRY_DISABLED: '1'
|
|
|
|
jobs:
|
|
e2e:
|
|
runs-on: >-
|
|
${{ vars.DSH_CI_FAILOVER_LINUX == 'blacksmith'
|
|
&& 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-latest' }}
|
|
name: e2e
|
|
# Run on every trusted event. Skip untrusted PRs (forks + Dependabot) where
|
|
# the secret is withheld — they would otherwise hard-fail the preflight.
|
|
if: >-
|
|
github.event_name != 'pull_request'
|
|
|| !(github.event.pull_request.head.repo.fork || github.event.pull_request.user.login == 'dependabot[bot]')
|
|
# Profile e2e files can each own several complete dsh subprocess trees, so
|
|
# four file workers preserve process/PTY headroom. Tests retain 120s/test
|
|
# and retry 2; 45m still bounds retry storms against a slow API.
|
|
timeout-minutes: 45
|
|
steps:
|
|
- uses: actions/[email protected]
|
|
|
|
- uses: pnpm/[email protected]
|
|
|
|
- uses: actions/[email protected]
|
|
with:
|
|
node-version: 24
|
|
cache: pnpm
|
|
|
|
- name: Install (immutable)
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
# The with-key escalation e2e self-skips without a usable runner. Prepare
|
|
# bwrap so trusted CI exercises it; the functional probe remains the
|
|
# authority on whether the runner can use the sandbox.
|
|
- name: Prepare bubblewrap (unrestrict userns)
|
|
run: bash scripts/prepare-ci-bubblewrap.sh
|
|
|
|
# Guard against a false green: the e2e suites self-skip when the key is
|
|
# absent, so a missing/misconfigured secret would otherwise pass as
|
|
# "all skipped". This job only runs on trusted events (the `if:` above
|
|
# excludes keyless PRs), so the secret MUST be present — fail loudly if not.
|
|
- name: Preflight (require DEEPSEEK_API_KEY)
|
|
env:
|
|
# Repo secret DEEPSEEK_API_KEY_EXTERNAL holds the external-API key;
|
|
# the tests read process.env.DEEPSEEK_API_KEY, so map it across here.
|
|
DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY_EXTERNAL }}
|
|
run: |
|
|
set -euo pipefail
|
|
if [ -z "${DEEPSEEK_API_KEY:-}" ]; then
|
|
echo "::error::DEEPSEEK_API_KEY is empty. The e2e suite would self-skip and"
|
|
echo "::error::report a false green. Configure the repo secret DEEPSEEK_API_KEY_EXTERNAL."
|
|
exit 1
|
|
fi
|
|
echo "DEEPSEEK_API_KEY present."
|
|
|
|
# The e2e suites boot the example bins in `lib` mode (DSH_EXAMPLE_MODE=lib):
|
|
# the built artifact under plain Node, resolving plugins through real package
|
|
# exports — the shape a real consumer runs. That requires a prior build.
|
|
- name: Build (lib for the e2e example bins)
|
|
run: ${{ github.event_name == 'pull_request' && 'pnpm run build:src --profile official' || 'pnpm run build:official' }}
|
|
|
|
- name: Prepare Office runtime
|
|
run: pnpm run prepare:primary-runtime --target linux-x64 --output .cache/e2e-office
|
|
|
|
# Real-API end-to-end tests only. The keyless gates (lint/typecheck/
|
|
# coverage/snapshot/etc.) already run in ci.yml (pull requests) and
|
|
# ci-master.yml (master push standby).
|
|
# DEEPSEEK_BASE_URL is pinned to the external API; the secret is scoped to
|
|
# this step (and preflight) only — never exposed to checkout/setup/install.
|
|
- name: E2E tests (real DeepSeek API)
|
|
env:
|
|
DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY_EXTERNAL }}
|
|
DEEPSEEK_BASE_URL: https://api.deepseek.com/anthropic
|
|
DSH_PRIMARY_RUNTIME: ${{ github.workspace }}/.cache/e2e-office/primary-runtime
|
|
DSH_E2E_MAX_WORKERS: 4
|
|
DSH_EXAMPLE_MODE: lib
|
|
run: pnpm run test:e2e
|