1147 lines
53 KiB
YAML
1147 lines
53 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
permissions:
|
|
contents: read
|
|
|
|
env:
|
|
PRIMARY_NODE_VERSION: '^24.22.3'
|
|
# 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'
|
|
|
|
# Cancel a superseded pull-request run on a new push so a fresh head does not
|
|
# queue a second full run behind a stale one (paid enterprise runners
|
|
# would otherwise stack with no auto-cancellation).
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
publisher-isolated:
|
|
strategy:
|
|
max-parallel: 1
|
|
fail-fast: false
|
|
matrix:
|
|
os: [linux, macos]
|
|
runs-on: >-
|
|
${{ matrix.os == 'macos' && 'macos-latest'
|
|
|| vars.DSH_CI_FAILOVER_LINUX == 'blacksmith' && 'blacksmith-4vcpu-ubuntu-2404'
|
|
|| vars.DSH_CI_FAILOVER_LINUX == 'selfhosted'
|
|
&& github.event.pull_request.user.login != 'dependabot[bot]'
|
|
&& fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
|
|
|| 'ubuntu-latest' }}
|
|
timeout-minutes: 15
|
|
steps:
|
|
- uses: actions/[email protected]
|
|
with:
|
|
persist-credentials: false
|
|
path: publisher-isolated
|
|
- uses: actions/[email protected]
|
|
with:
|
|
node-version: '^24.22.3'
|
|
- name: Check preflights before dependency installation
|
|
working-directory: publisher-isolated
|
|
run: node apps/desktop-publisher/tests/preinstall.mjs
|
|
- uses: pnpm/[email protected]
|
|
with:
|
|
package_json_file: publisher-isolated/package.json
|
|
dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
|
|
- name: Install only publisher production dependencies
|
|
working-directory: publisher-isolated
|
|
run: pnpm --filter @deepseek-ai/dsh-desktop-publisher --fail-if-no-match install --prod --frozen-lockfile --ignore-scripts
|
|
- name: Load publisher without Desktop or root development dependencies
|
|
working-directory: publisher-isolated/apps/desktop-publisher
|
|
run: node --import tsx tests/isolated-install.mjs
|
|
|
|
|
|
# Enterprise jobs isolate coverage, static analysis, and the build-backed
|
|
# tail. Coverage runs two file shards on separate runners and merges them on
|
|
# one small report runner. The build job
|
|
# owns the only Linux artifact build; the consumer job and the two web
|
|
# snapshot shards restore its output instead of rebuilding.
|
|
#
|
|
# FAILOVER (Linux): each Linux enterprise job resolves its pool through the
|
|
# DSH_CI_FAILOVER_LINUX repository variable. Unset (normal), the expressions
|
|
# pick the hosted enterprise pools below. Setting the variable to
|
|
# 'selfhosted' (repo Settings → Actions → Variables; writer-manageable
|
|
# repository state — not PR-editable, no merge required) retargets them
|
|
# all onto the in-house
|
|
# vm-backup pool and re-running the failed jobs is the entire switch —
|
|
# see .agents/notes/implemented/process/2026-07-26-ci-failover-runbook.md.
|
|
# Setting the variable to 'blacksmith' instead routes the same jobs onto
|
|
# Blacksmith's hosted runners sized per workload (see
|
|
# .agents/notes/implemented/process/2026-09-09-blacksmith-failover-leg.md). The
|
|
# in-house pool's readiness is re-proven on every master push by the
|
|
# serial-linux-selfhosted standby lane in ci-master.yml. Native Windows jobs
|
|
# and their separate DSH_CI_FAILOVER_WINDOWS switch live in ci-windows.yml.
|
|
node-24:
|
|
if: github.event_name == 'pull_request'
|
|
runs-on: >-
|
|
${{ vars.DSH_CI_FAILOVER_LINUX == 'blacksmith' && 'blacksmith-8vcpu-ubuntu-2404'
|
|
|| vars.DSH_CI_FAILOVER_LINUX == 'selfhosted'
|
|
&& github.event.pull_request.user.login != 'dependabot[bot]'
|
|
&& fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
|
|
|| 'dsh-ubuntu-24-04-16core' }}
|
|
name: node 24 / static
|
|
env:
|
|
# Shared hosts expose host CPUs, not an isolated allocation.
|
|
DSH_GATE_CONCURRENCY: ${{ vars.DSH_CI_FAILOVER_LINUX == 'selfhosted' && github.event.pull_request.user.login != 'dependabot[bot]' && '8' || '' }}
|
|
# Stop the aggregate at the first blocking gate failure so a red run
|
|
# does not keep burning enterprise runner time on the remaining gates.
|
|
DSH_GATE_FAIL_FAST: '1'
|
|
steps:
|
|
# Runner cleanup owns tool caches and fixtures, including cancelled runs.
|
|
- name: Use runner-owned temporary storage
|
|
run: |
|
|
echo "TMPDIR=${{ runner.temp }}" >> "$GITHUB_ENV"
|
|
|
|
# Fetch complete history so the archive gate can read the trusted PR base from a reused shallow checkout.
|
|
- uses: actions/[email protected]
|
|
with:
|
|
fetch-depth: 0
|
|
persist-credentials: false
|
|
|
|
# Redirect the Node compile cache (enabled by pnpm and TypeScript) off
|
|
# the root partition's /tmp before the first pnpm call in this lane.
|
|
- name: Redirect Node compile cache to runner temp
|
|
run: echo "NODE_COMPILE_CACHE=${{ runner.temp }}/node-compile-cache" >> "$GITHUB_ENV"
|
|
|
|
- uses: pnpm/[email protected]
|
|
with:
|
|
dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
|
|
|
|
- uses: actions/[email protected]
|
|
with:
|
|
node-version: ${{ env.PRIMARY_NODE_VERSION }}
|
|
|
|
- name: Configure pnpm store path
|
|
id: pnpm-store
|
|
run: |
|
|
store_root="$HOME/.local/share/pnpm/store"
|
|
echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
|
|
store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
|
|
echo "path=$store_path" >> "$GITHUB_OUTPUT"
|
|
|
|
# Pull requests consume the default-branch cache but do not put cache
|
|
# compression and upload on the paid latency-critical path. Skipped
|
|
# under failover — see the coverage lane's identical rationale.
|
|
- uses: actions/cache/[email protected]
|
|
if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
|
|
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
|
|
|
|
- name: Run static gates
|
|
env:
|
|
DSH_ARCHIVE_BASE_REF: ${{ github.event.pull_request.base.sha }}
|
|
run: pnpm run check:ci:static
|
|
|
|
node-24-coverage:
|
|
if: github.event_name == 'pull_request'
|
|
runs-on: >-
|
|
${{ vars.DSH_CI_FAILOVER_LINUX == 'blacksmith' && 'blacksmith-16vcpu-ubuntu-2404'
|
|
|| vars.DSH_CI_FAILOVER_LINUX == 'selfhosted'
|
|
&& github.event.pull_request.user.login != 'dependabot[bot]'
|
|
&& fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
|
|
|| 'dsh-ubuntu-24-04-16core' }}
|
|
# Two instrumented file shards run on separate runners; the first also
|
|
# runs the uninstrumented heavy suites. node-24-coverage-report merges the
|
|
# shard blobs and owns the thresholds and the duration history.
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
shard: [1, 2]
|
|
name: node 24 / coverage ${{ matrix.shard }}/2
|
|
env:
|
|
DSH_COVERAGE_SHARD: ${{ matrix.shard }}/2
|
|
# Shared hosts expose host CPUs, not an isolated allocation.
|
|
DSH_COVERAGE_MAX_WORKERS: ${{ vars.DSH_CI_FAILOVER_LINUX == 'selfhosted' && github.event.pull_request.user.login != 'dependabot[bot]' && '6' || '' }}
|
|
DSH_COVERAGE_PARTITIONS: ${{ vars.DSH_CI_FAILOVER_LINUX == 'selfhosted' && github.event.pull_request.user.login != 'dependabot[bot]' && '4' || '' }}
|
|
DSH_GATE_CONCURRENCY: ${{ vars.DSH_CI_FAILOVER_LINUX == 'selfhosted' && github.event.pull_request.user.login != 'dependabot[bot]' && '3' || '' }}
|
|
# Managed-scope teardown cases run past the default per-test budget when
|
|
# this lane's partitions, workers, and sibling gates share one host: the
|
|
# disposal cases in subprocess-local and bash-sandbox exceeded 5000ms on
|
|
# the hosted image (run 34449848541) while the same commit stayed inside
|
|
# the budget on the in-house pool; the lane is green with this value
|
|
# (run 34457655892). The Windows coverage lane grants the same budget for
|
|
# the same reason.
|
|
DSH_COVERAGE_TEST_TIMEOUT_MS: '90000'
|
|
# A gate failure aborts the sibling gate instead of waiting out its
|
|
# multi-minute instrumented run.
|
|
DSH_GATE_FAIL_FAST: '1'
|
|
steps:
|
|
# Runner cleanup owns tool caches and fixtures, including cancelled runs.
|
|
- name: Use runner-owned temporary storage
|
|
run: |
|
|
echo "TMPDIR=${{ runner.temp }}" >> "$GITHUB_ENV"
|
|
|
|
- uses: actions/[email protected]
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Restore coverage duration history
|
|
uses: actions/cache/[email protected]
|
|
with:
|
|
path: .coverage-times.json
|
|
key: coverage-times-Linux-${{ runner.environment }}-${{ vars.DSH_CI_FAILOVER_LINUX || 'enterprise' }}-${{ github.run_id }}-${{ github.run_attempt }}
|
|
restore-keys: |
|
|
coverage-times-Linux-${{ runner.environment }}-${{ vars.DSH_CI_FAILOVER_LINUX || 'enterprise' }}-
|
|
|
|
# Redirect the Node compile cache (enabled by pnpm and TypeScript) off
|
|
# the root partition's /tmp before the first pnpm call in this lane.
|
|
- name: Redirect Node compile cache to runner temp
|
|
run: echo "NODE_COMPILE_CACHE=${{ runner.temp }}/node-compile-cache" >> "$GITHUB_ENV"
|
|
|
|
- uses: pnpm/[email protected]
|
|
with:
|
|
dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
|
|
|
|
- uses: actions/[email protected]
|
|
with:
|
|
node-version: ${{ env.PRIMARY_NODE_VERSION }}
|
|
|
|
- name: Configure pnpm store path
|
|
id: pnpm-store
|
|
run: |
|
|
store_root="$HOME/.local/share/pnpm/store"
|
|
echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
|
|
store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
|
|
echo "path=$store_path" >> "$GITHUB_OUTPUT"
|
|
|
|
# Self-hosted runners reuse the shared persistent pnpm store.
|
|
# Hosted runners restore the remote cache into their ephemeral store.
|
|
- uses: actions/cache/[email protected]
|
|
if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
|
|
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-
|
|
|
|
# The persistent self-hosted pool keeps ~/.cache between jobs on its own
|
|
# layout, so the archive cache follows the hosted-only pnpm store guard.
|
|
- name: Restore verified bubblewrap archive
|
|
id: bubblewrap-cache
|
|
if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
|
|
uses: actions/cache/[email protected]
|
|
with:
|
|
path: ~/.cache/dsh-ci/bubblewrap
|
|
key: bubblewrap-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('scripts/prepare-ci-bubblewrap.sh') }}
|
|
|
|
- name: Install dependencies and prepare bubblewrap
|
|
run: |
|
|
pnpm install --frozen-lockfile &
|
|
install_pid=$!
|
|
bash scripts/prepare-ci-bubblewrap.sh &
|
|
sandbox_pid=$!
|
|
install_status=0
|
|
wait "$install_pid" || install_status=$?
|
|
sandbox_status=0
|
|
wait "$sandbox_pid" || sandbox_status=$?
|
|
if (( install_status != 0 )); then exit "$install_status"; fi
|
|
exit "$sandbox_status"
|
|
|
|
# The save step is skipped on a hit. A restored archive whose digest fails
|
|
# is re-downloaded but not re-saved (the key already exists), so a tampered
|
|
# entry survives until eviction; that needs deliberate cache poisoning.
|
|
- name: Save verified bubblewrap archive
|
|
if: (vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]') && steps.bubblewrap-cache.outputs.cache-hit != 'true'
|
|
uses: actions/cache/[email protected]
|
|
with:
|
|
path: ~/.cache/dsh-ci/bubblewrap
|
|
key: bubblewrap-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('scripts/prepare-ci-bubblewrap.sh') }}
|
|
|
|
- name: Run coverage shard
|
|
run: pnpm run check:ci:coverage-shard
|
|
|
|
- name: Upload coverage shard blobs
|
|
uses: actions/[email protected]
|
|
with:
|
|
name: coverage-blobs-${{ matrix.shard }}
|
|
path: coverage/shard/
|
|
# A re-run of this shard replaces the previous attempt's output.
|
|
overwrite: true
|
|
if-no-files-found: error
|
|
include-hidden-files: true
|
|
retention-days: 30
|
|
|
|
# Merging blobs and checking thresholds runs after both coverage shards
|
|
# succeed. The merge converts every shard's V8 coverage to per-file reports
|
|
# and needs several GB of heap: a 2-vCPU runner took 154s against ~30s on the
|
|
# former 16-vCPU lane (run 44667701311), so this job uses an 8-vCPU runner.
|
|
# A failed shard skips this job, and the skipped result fails all-checks-passed.
|
|
node-24-coverage-report:
|
|
needs: node-24-coverage
|
|
if: github.event_name == 'pull_request'
|
|
runs-on: >-
|
|
${{ vars.DSH_CI_FAILOVER_LINUX == 'blacksmith' && 'blacksmith-8vcpu-ubuntu-2404'
|
|
|| vars.DSH_CI_FAILOVER_LINUX == 'selfhosted'
|
|
&& github.event.pull_request.user.login != 'dependabot[bot]'
|
|
&& fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
|
|
|| 'dsh-ubuntu-24-04-8core' }}
|
|
name: node 24 / coverage report
|
|
steps:
|
|
# Runner cleanup owns tool caches and fixtures, including cancelled runs.
|
|
- name: Use runner-owned temporary storage
|
|
run: |
|
|
echo "TMPDIR=${{ runner.temp }}" >> "$GITHUB_ENV"
|
|
|
|
- uses: actions/[email protected]
|
|
with:
|
|
persist-credentials: false
|
|
|
|
# Redirect the Node compile cache (enabled by pnpm and TypeScript) off
|
|
# the root partition's /tmp before the first pnpm call in this lane.
|
|
- name: Redirect Node compile cache to runner temp
|
|
run: echo "NODE_COMPILE_CACHE=${{ runner.temp }}/node-compile-cache" >> "$GITHUB_ENV"
|
|
|
|
- uses: pnpm/[email protected]
|
|
with:
|
|
dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
|
|
|
|
- uses: actions/[email protected]
|
|
with:
|
|
node-version: ${{ env.PRIMARY_NODE_VERSION }}
|
|
|
|
- name: Configure pnpm store path
|
|
id: pnpm-store
|
|
run: |
|
|
store_root="$HOME/.local/share/pnpm/store"
|
|
echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
|
|
store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
|
|
echo "path=$store_path" >> "$GITHUB_OUTPUT"
|
|
|
|
# Self-hosted runners reuse the shared persistent pnpm store.
|
|
# Hosted runners restore the remote cache into their ephemeral store.
|
|
- uses: actions/cache/[email protected]
|
|
if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
|
|
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 dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Download coverage shard blobs
|
|
uses: actions/[email protected]
|
|
with:
|
|
pattern: coverage-blobs-*
|
|
path: ${{ runner.temp }}/coverage-shards
|
|
|
|
# Node sizes its default heap from host memory; merging the whole
|
|
# inventory exceeded the ~2 GB default of a 2-vCPU runner (run
|
|
# 44664262449), so the merge states its heap instead of inheriting one.
|
|
- name: Merge coverage shards and check thresholds
|
|
env:
|
|
NODE_OPTIONS: --max-old-space-size=4096
|
|
run: pnpm run test:coverage:merge-shards "$RUNNER_TEMP/coverage-shards"
|
|
|
|
- name: Save coverage duration history
|
|
if: ${{ !cancelled() }}
|
|
uses: actions/cache/[email protected]
|
|
with:
|
|
path: .coverage-times.json
|
|
key: coverage-times-Linux-${{ runner.environment }}-${{ vars.DSH_CI_FAILOVER_LINUX || 'enterprise' }}-${{ github.run_id }}-${{ github.run_attempt }}
|
|
|
|
# Lint and duplication get their own lane instead of riding the artifact
|
|
# consumers: a red lint no longer costs the snapshot and artifact consumers a
|
|
# full rerun. The lane compiles package declarations because oxlint's
|
|
# type-aware rules read them.
|
|
node-24-lint:
|
|
if: github.event_name == 'pull_request'
|
|
runs-on: >-
|
|
${{ vars.DSH_CI_FAILOVER_LINUX == 'blacksmith' && 'blacksmith-8vcpu-ubuntu-2404'
|
|
|| vars.DSH_CI_FAILOVER_LINUX == 'selfhosted'
|
|
&& github.event.pull_request.user.login != 'dependabot[bot]'
|
|
&& fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
|
|
|| 'dsh-ubuntu-24-04-16core' }}
|
|
name: node 24 / lint
|
|
env:
|
|
# Shared hosts expose host CPUs, not an isolated allocation.
|
|
DSH_GATE_CONCURRENCY: ${{ vars.DSH_CI_FAILOVER_LINUX == 'selfhosted' && github.event.pull_request.user.login != 'dependabot[bot]' && '8' || '' }}
|
|
DSH_OXLINT_THREADS: ${{ vars.DSH_CI_FAILOVER_LINUX == 'selfhosted' && github.event.pull_request.user.login != 'dependabot[bot]' && '8' || '' }}
|
|
steps:
|
|
# Runner cleanup owns tool caches and fixtures, including cancelled runs.
|
|
- name: Use runner-owned temporary storage
|
|
run: |
|
|
echo "TMPDIR=${{ runner.temp }}" >> "$GITHUB_ENV"
|
|
|
|
- uses: actions/[email protected]
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Redirect Node compile cache to runner temp
|
|
run: echo "NODE_COMPILE_CACHE=${{ runner.temp }}/node-compile-cache" >> "$GITHUB_ENV"
|
|
|
|
- uses: pnpm/[email protected]
|
|
with:
|
|
dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
|
|
|
|
- uses: actions/[email protected]
|
|
with:
|
|
node-version: ${{ env.PRIMARY_NODE_VERSION }}
|
|
|
|
- name: Configure pnpm store path
|
|
id: pnpm-store
|
|
run: |
|
|
store_root="$HOME/.local/share/pnpm/store"
|
|
echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
|
|
store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
|
|
echo "path=$store_path" >> "$GITHUB_OUTPUT"
|
|
|
|
- uses: actions/cache/[email protected]
|
|
if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
|
|
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
|
|
|
|
# oxlint's type-aware rules resolve workspace imports through the package
|
|
# declarations, so this lane compiles them without bundling anything.
|
|
- name: Compile package declarations
|
|
run: pnpm run typecheck
|
|
|
|
- name: Run lint and duplication
|
|
run: pnpm run check:ci:lint:contracts-ready
|
|
|
|
# The two suite phases run on separate idle runners from the shared build
|
|
# output: phase `first` holds the corpus cases that tolerate a sibling and
|
|
# phase `last` the browser, animation-frame, and fresh-child cases that need
|
|
# an idle runner (SERIAL_BENCH_FILES in scripts/run-bench-suite.ts).
|
|
node-24-bench:
|
|
needs: node-24-build
|
|
if: github.event_name == 'pull_request'
|
|
runs-on: >-
|
|
${{ vars.DSH_CI_FAILOVER_LINUX == 'blacksmith' && 'blacksmith-4vcpu-ubuntu-2404'
|
|
|| 'ubuntu-24.04' }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- shard: 1
|
|
phase: first
|
|
- shard: 2
|
|
phase: last
|
|
name: node 24 / benchmarks ${{ matrix.shard }}/2
|
|
# Wall-clock budgets need an otherwise idle runner, so each phase runs
|
|
# alone on its runner instead of joining a concurrent gate aggregate; the
|
|
# first phase keeps its own two-file parallelism inside that runner. The
|
|
# self-hosted failover pool is shared, so the benchmarks stay on hosted
|
|
# Linux there.
|
|
timeout-minutes: 20
|
|
env:
|
|
DSH_BENCH_PHASE: ${{ matrix.phase }}
|
|
steps:
|
|
- uses: actions/[email protected]
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- uses: pnpm/[email protected]
|
|
with:
|
|
dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
|
|
|
|
- uses: actions/[email protected]
|
|
with:
|
|
node-version: ${{ env.PRIMARY_NODE_VERSION }}
|
|
|
|
- name: Configure pnpm store path
|
|
id: pnpm-store
|
|
run: |
|
|
store_root="$HOME/.local/share/pnpm/store"
|
|
echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
|
|
store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
|
|
echo "path=$store_path" >> "$GITHUB_OUTPUT"
|
|
|
|
- uses: actions/cache/[email protected]
|
|
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
|
|
|
|
- name: Download build output
|
|
uses: actions/[email protected]
|
|
with:
|
|
name: build-output
|
|
path: ${{ runner.temp }}/build-output
|
|
|
|
- name: Unpack build output
|
|
run: |
|
|
set -o pipefail
|
|
archive="$RUNNER_TEMP/build-output/build-output.tar.zst"
|
|
# -m stamps restored files with the extraction time: newer than this
|
|
# checkout and never in the future.
|
|
zstd -dc -T0 "$archive" | tar -xmf -
|
|
test -f apps/cli/lib/bin.js && test -f apps/web/dist/index.html && test -f .dsh-build/client-build-environment.json
|
|
|
|
# node-24-build can run on another pool (vm-backup under self-hosted
|
|
# failover) while the benchmarks stay on hosted Linux, so the restored
|
|
# Node-API addon is loaded here and rebuilt on this runner if it fails.
|
|
- name: Rebuild the native addon if the restored one does not load
|
|
run: |
|
|
addon=native/system/packages/linux-x64/bin/glibc/system.node
|
|
if node -e 'process.dlopen({ exports: {} }, process.argv[1])' "$addon"; then
|
|
echo "Restored native addon loads on this runner."
|
|
else
|
|
echo "::notice::Restored native addon does not load on this runner; rebuilding it."
|
|
pnpm run build:native-system
|
|
node -e 'process.dlopen({ exports: {} }, process.argv[1])' "$addon"
|
|
fi
|
|
|
|
- name: Install benchmark browser and hosted dependencies
|
|
run: pnpm --filter @deepseek-ai/dsh-benchmarks exec playwright install --with-deps chromium
|
|
|
|
- name: Run performance benchmarks
|
|
env:
|
|
DSH_GATE_VERBOSE: '1'
|
|
run: pnpm run check:ci:bench-prebuilt
|
|
|
|
# The report global teardown writes results.jsonl and environment.json
|
|
# after the run, including after a failing budget assertion; the report
|
|
# job renders both phases into one report. A phase that fails before
|
|
# recording any timing has no results, so missing files warn.
|
|
- name: Upload benchmark results
|
|
if: ${{ !cancelled() }}
|
|
uses: actions/[email protected]
|
|
with:
|
|
name: benchmark-results-${{ matrix.shard }}
|
|
path: benchmarks/.dsh-report/
|
|
include-hidden-files: true
|
|
if-no-files-found: warn
|
|
retention-days: 7
|
|
# A re-run of this phase replaces the previous attempt's results.
|
|
overwrite: true
|
|
|
|
# Bookkeeping only: renders one scaled report from both phases, including
|
|
# after a failing budget. The benchmark verdict comes from node-24-bench, so
|
|
# this job stays out of all-checks-passed.
|
|
node-24-bench-report:
|
|
needs: node-24-bench
|
|
if: ${{ !cancelled() && github.event_name == 'pull_request' }}
|
|
runs-on: >-
|
|
${{ vars.DSH_CI_FAILOVER_LINUX == 'blacksmith' && 'blacksmith-2vcpu-ubuntu-2404'
|
|
|| 'ubuntu-latest' }}
|
|
name: node 24 / benchmark report
|
|
steps:
|
|
- uses: actions/[email protected]
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- uses: actions/[email protected]
|
|
with:
|
|
node-version: ${{ env.PRIMARY_NODE_VERSION }}
|
|
|
|
- name: Download benchmark results
|
|
uses: actions/[email protected]
|
|
with:
|
|
pattern: benchmark-results-*
|
|
path: ${{ runner.temp }}/benchmark-results
|
|
|
|
# The renderer runs under Node type stripping and needs no install.
|
|
- name: Render scaled benchmark report
|
|
run: |
|
|
shopt -s nullglob
|
|
phases=("$RUNNER_TEMP"/benchmark-results/*/)
|
|
if (( ${#phases[@]} == 0 )); then
|
|
echo "::warning::No benchmark phase uploaded results."
|
|
exit 0
|
|
fi
|
|
node scripts/render-benchmark-report.ts benchmarks/.dsh-report "${phases[@]}"
|
|
|
|
- name: Upload scaled benchmark report
|
|
if: ${{ !cancelled() }}
|
|
uses: actions/[email protected]
|
|
with:
|
|
name: benchmark-report
|
|
path: benchmarks/.dsh-report/
|
|
include-hidden-files: true
|
|
if-no-files-found: warn
|
|
retention-days: 7
|
|
|
|
# Build the artifacts once, run the cheap readers, and publish the output
|
|
# for the downstream consumer and web snapshot jobs, which restore it
|
|
# instead of rebuilding.
|
|
node-24-build:
|
|
if: github.event_name == 'pull_request'
|
|
runs-on: >-
|
|
${{ vars.DSH_CI_FAILOVER_LINUX == 'blacksmith' && 'blacksmith-16vcpu-ubuntu-2404'
|
|
|| vars.DSH_CI_FAILOVER_LINUX == 'selfhosted'
|
|
&& github.event.pull_request.user.login != 'dependabot[bot]'
|
|
&& fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
|
|
|| 'dsh-ubuntu-24-04-16core' }}
|
|
name: node 24 / build
|
|
env:
|
|
# Shared hosts expose host CPUs, not an isolated allocation.
|
|
DSH_GATE_CONCURRENCY: ${{ vars.DSH_CI_FAILOVER_LINUX == 'selfhosted' && github.event.pull_request.user.login != 'dependabot[bot]' && '10' || '' }}
|
|
DSH_PUBLINT_CONCURRENCY: ${{ vars.DSH_CI_FAILOVER_LINUX == 'selfhosted' && github.event.pull_request.user.login != 'dependabot[bot]' && '8' || '' }}
|
|
# A failing gate aborts its running siblings.
|
|
DSH_GATE_FAIL_FAST: '1'
|
|
steps:
|
|
# Runner cleanup owns tool caches and fixtures, including cancelled runs.
|
|
- name: Use runner-owned temporary storage
|
|
run: |
|
|
echo "TMPDIR=${{ runner.temp }}" >> "$GITHUB_ENV"
|
|
|
|
- uses: actions/[email protected]
|
|
with:
|
|
persist-credentials: false
|
|
|
|
# Redirect the Node compile cache (enabled by pnpm and TypeScript) off
|
|
# the root partition's /tmp before the first pnpm call in this lane.
|
|
- name: Redirect Node compile cache to runner temp
|
|
run: echo "NODE_COMPILE_CACHE=${{ runner.temp }}/node-compile-cache" >> "$GITHUB_ENV"
|
|
|
|
- uses: pnpm/[email protected]
|
|
with:
|
|
dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
|
|
|
|
- uses: actions/[email protected]
|
|
with:
|
|
node-version: ${{ env.PRIMARY_NODE_VERSION }}
|
|
|
|
- name: Configure pnpm store path
|
|
id: pnpm-store
|
|
run: |
|
|
store_root="$HOME/.local/share/pnpm/store"
|
|
echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
|
|
store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
|
|
echo "path=$store_path" >> "$GITHUB_OUTPUT"
|
|
|
|
# Pull requests restore the pnpm store without paying compression and
|
|
# upload on the required path. Self-hosted runners reuse the shared
|
|
# persistent store instead of restoring the remote archive.
|
|
- uses: actions/cache/[email protected]
|
|
if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
|
|
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 dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
# Everything the build adds to the ignored or untracked set is its output.
|
|
- name: Record files before the build
|
|
run: git status --porcelain=v1 --ignored --untracked-files=normal > "$RUNNER_TEMP/files-before.txt"
|
|
|
|
- name: Build artifacts and run the cheap readers
|
|
run: pnpm run check:ci:build
|
|
|
|
- name: Pack build output
|
|
env:
|
|
# Compression costs well under a second at -T0; a smaller archive
|
|
# shortens the upload and every download.
|
|
ZSTD_LEVEL: '9'
|
|
run: |
|
|
set -o pipefail
|
|
out="$RUNNER_TEMP/build-output"
|
|
mkdir -p "$out"
|
|
git status --porcelain=v1 --ignored --untracked-files=normal > "$RUNNER_TEMP/files-after.txt"
|
|
comm -13 <(sort "$RUNNER_TEMP/files-before.txt") <(sort "$RUNNER_TEMP/files-after.txt") \
|
|
| sed -n -E 's/^(!!|\?\?) //p' \
|
|
| grep -v -E '(^|/)(node_modules|\.node-next-types-[^/]*|\.doc-typecheck-[^/]*|\.oxlint-contract-[^/]*|\.typert-[^/]*|\.cache)/?$' \
|
|
| sed 's#/$##' > "$out/paths.txt"
|
|
echo "build output entries: $(wc -l < "$out/paths.txt")"
|
|
du -sch $(cat "$out/paths.txt") | tail -1
|
|
tar -cf - -T "$out/paths.txt" | zstd -q -T0 -"$ZSTD_LEVEL" -o "$out/build-output.tar.zst"
|
|
zstd -dc "$out/build-output.tar.zst" | tar -tf - > "$out/contents.txt"
|
|
for required in apps/cli/lib/bin.js apps/web/dist/index.html .dsh-build/client-build-environment.json; do
|
|
grep -qx "$required" "$out/contents.txt" || { echo "::error::build output is missing $required"; exit 1; }
|
|
done
|
|
echo "archive entries: $(wc -l < "$out/contents.txt")"
|
|
rm "$out/contents.txt"
|
|
|
|
- name: Upload build output
|
|
uses: actions/[email protected]
|
|
with:
|
|
name: build-output
|
|
path: |
|
|
${{ runner.temp }}/build-output/build-output.tar.zst
|
|
${{ runner.temp }}/build-output/paths.txt
|
|
# Re-running a failed downstream job does not rebuild; keep the output
|
|
# for GitHub's 30-day re-run window.
|
|
retention-days: 30
|
|
compression-level: 0
|
|
if-no-files-found: error
|
|
# A re-run of this job replaces the previous attempt's output.
|
|
overwrite: true
|
|
|
|
node-24-consumers:
|
|
needs: node-24-build
|
|
if: github.event_name == 'pull_request'
|
|
runs-on: >-
|
|
${{ vars.DSH_CI_FAILOVER_LINUX == 'blacksmith' && 'blacksmith-16vcpu-ubuntu-2404'
|
|
|| vars.DSH_CI_FAILOVER_LINUX == 'selfhosted'
|
|
&& github.event.pull_request.user.login != 'dependabot[bot]'
|
|
&& fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
|
|
|| 'dsh-ubuntu-24-04-16core' }}
|
|
name: node 24 / snapshots and artifacts
|
|
env:
|
|
# Shared hosts expose host CPUs, not an isolated allocation.
|
|
DSH_GATE_CONCURRENCY: ${{ vars.DSH_CI_FAILOVER_LINUX == 'selfhosted' && github.event.pull_request.user.login != 'dependabot[bot]' && '10' || '' }}
|
|
DSH_SNAPSHOT_MAX_CONCURRENCY: ${{ vars.DSH_CI_FAILOVER_LINUX == 'selfhosted' && github.event.pull_request.user.login != 'dependabot[bot]' && '12' || '' }}
|
|
DSH_NODE_COMPAT_SKIP_TYPECHECK: '1'
|
|
# A failing gate aborts its running siblings.
|
|
DSH_GATE_FAIL_FAST: '1'
|
|
steps:
|
|
# Runner cleanup owns tool caches and fixtures, including cancelled runs.
|
|
- name: Use runner-owned temporary storage
|
|
run: |
|
|
echo "TMPDIR=${{ runner.temp }}" >> "$GITHUB_ENV"
|
|
|
|
- uses: actions/[email protected]
|
|
with:
|
|
persist-credentials: false
|
|
|
|
# Redirect the Node compile cache (enabled by pnpm and TypeScript) off
|
|
# the root partition's /tmp before the first pnpm call in this lane.
|
|
- name: Redirect Node compile cache to runner temp
|
|
run: echo "NODE_COMPILE_CACHE=${{ runner.temp }}/node-compile-cache" >> "$GITHUB_ENV"
|
|
|
|
- uses: pnpm/[email protected]
|
|
with:
|
|
dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
|
|
|
|
- uses: actions/[email protected]
|
|
with:
|
|
node-version: ${{ env.PRIMARY_NODE_VERSION }}
|
|
|
|
- name: Configure pnpm store path
|
|
id: pnpm-store
|
|
run: |
|
|
store_root="$HOME/.local/share/pnpm/store"
|
|
echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
|
|
store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
|
|
echo "path=$store_path" >> "$GITHUB_OUTPUT"
|
|
|
|
# Pull requests restore the pnpm store without paying compression and
|
|
# upload on the required path. Self-hosted runners reuse the shared
|
|
# persistent store instead of restoring the remote archive.
|
|
- uses: actions/cache/[email protected]
|
|
if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
|
|
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-
|
|
|
|
# The persistent self-hosted pool keeps ~/.cache between jobs on its own
|
|
# layout, so the archive cache follows the hosted-only pnpm store guard.
|
|
- name: Restore verified bubblewrap archive
|
|
id: bubblewrap-cache
|
|
if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
|
|
uses: actions/cache/[email protected]
|
|
with:
|
|
path: ~/.cache/dsh-ci/bubblewrap
|
|
key: bubblewrap-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('scripts/prepare-ci-bubblewrap.sh') }}
|
|
|
|
- name: Install dependencies and prepare bubblewrap
|
|
run: |
|
|
pnpm install --frozen-lockfile &
|
|
install_pid=$!
|
|
bash scripts/prepare-ci-bubblewrap.sh &
|
|
sandbox_pid=$!
|
|
install_status=0
|
|
wait "$install_pid" || install_status=$?
|
|
sandbox_status=0
|
|
wait "$sandbox_pid" || sandbox_status=$?
|
|
if (( install_status != 0 )); then exit "$install_status"; fi
|
|
exit "$sandbox_status"
|
|
|
|
- name: Save verified bubblewrap archive
|
|
if: (vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]') && steps.bubblewrap-cache.outputs.cache-hit != 'true'
|
|
uses: actions/cache/[email protected]
|
|
with:
|
|
path: ~/.cache/dsh-ci/bubblewrap
|
|
key: bubblewrap-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('scripts/prepare-ci-bubblewrap.sh') }}
|
|
|
|
# Restore the build job's output after the install, so no install or
|
|
# postinstall step can replace restored files. The fixed artifact name
|
|
# resolves within this run, including a re-run of this job alone.
|
|
- name: Download build output
|
|
uses: actions/[email protected]
|
|
with:
|
|
name: build-output
|
|
path: ${{ runner.temp }}/build-output
|
|
|
|
- name: Unpack build output
|
|
run: |
|
|
set -o pipefail
|
|
archive="$RUNNER_TEMP/build-output/build-output.tar.zst"
|
|
# -m stamps restored files with the extraction time: newer than this
|
|
# checkout and never in the future. Build-time mtimes ahead of the
|
|
# clock make HMR treat freshly loaded lib/ modules as changed.
|
|
zstd -dc -T0 "$archive" | tar -xmf -
|
|
test -f apps/cli/lib/bin.js && test -f apps/web/dist/index.html && test -f .dsh-build/client-build-environment.json
|
|
|
|
# No gate reads the Office runtime output, so it builds beside the gates.
|
|
# GitHub runners keep a background process started in one step alive for
|
|
# the later steps of the same job; the final step collects its status.
|
|
- name: Start the Linux Office runtime build
|
|
id: office-runtime
|
|
run: |
|
|
(
|
|
status=0
|
|
CI=true pnpm run prepare:primary-runtime --target linux-x64 --output "$RUNNER_TEMP/office-runtime" --cache "$RUNNER_TEMP/office-runtime-downloads" || status=$?
|
|
echo "$status" > "$RUNNER_TEMP/office-runtime.status"
|
|
) > "$RUNNER_TEMP/office-runtime.log" 2>&1 &
|
|
echo "$!" > "$RUNNER_TEMP/office-runtime.pid"
|
|
|
|
- name: Run compatibility, snapshot, and artifact gates
|
|
run: pnpm run check:ci:consumers-prebuilt
|
|
|
|
- name: Wait for the Linux Office runtime
|
|
if: ${{ !cancelled() && steps.office-runtime.outcome == 'success' }}
|
|
run: |
|
|
pid=$(cat "$RUNNER_TEMP/office-runtime.pid")
|
|
while kill -0 "$pid" 2>/dev/null; do sleep 1; done
|
|
cat "$RUNNER_TEMP/office-runtime.log"
|
|
status=$(cat "$RUNNER_TEMP/office-runtime.status" 2>/dev/null || echo missing)
|
|
if [[ "$status" != 0 ]]; then
|
|
echo "::error::Linux Office runtime build failed with status $status"
|
|
exit 1
|
|
fi
|
|
|
|
node-24-web-snapshot:
|
|
needs: node-24-build
|
|
if: github.event_name == 'pull_request'
|
|
runs-on: >-
|
|
${{ vars.DSH_CI_FAILOVER_LINUX == 'blacksmith' && 'blacksmith-16vcpu-ubuntu-2404'
|
|
|| vars.DSH_CI_FAILOVER_LINUX == 'selfhosted'
|
|
&& github.event.pull_request.user.login != 'dependabot[bot]'
|
|
&& fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
|
|
|| 'dsh-ubuntu-24-04-16core' }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
shard: [1, 2]
|
|
name: node 24 / web snapshots ${{ matrix.shard }}/2
|
|
env:
|
|
# Shared hosts expose host CPUs, not an isolated allocation.
|
|
DSH_GATE_CONCURRENCY: ${{ vars.DSH_CI_FAILOVER_LINUX == 'selfhosted' && github.event.pull_request.user.login != 'dependabot[bot]' && '10' || '' }}
|
|
DSH_WEB_SNAPSHOT_WORKERS: ${{ vars.DSH_CI_FAILOVER_LINUX == 'selfhosted' && github.event.pull_request.user.login != 'dependabot[bot]' && '6' || '' }}
|
|
DSH_WEB_SNAPSHOT_SHARD: ${{ matrix.shard }}/2
|
|
# Every shard reads these shares. Each shard runs alone on its
|
|
# machine; the last shard also runs the ~40s of serial files first.
|
|
DSH_WEB_SNAPSHOT_SHARD_SHARES: '0.54,0.46'
|
|
# A failing gate aborts its running siblings.
|
|
DSH_GATE_FAIL_FAST: '1'
|
|
steps:
|
|
# Runner cleanup owns tool caches and fixtures, including cancelled runs.
|
|
- name: Use runner-owned temporary storage
|
|
run: |
|
|
echo "TMPDIR=${{ runner.temp }}" >> "$GITHUB_ENV"
|
|
echo "PLAYWRIGHT_BROWSERS_PATH=${RUNNER_TEMP%/*}/ms-playwright" >> "$GITHUB_ENV"
|
|
|
|
- uses: actions/[email protected]
|
|
with:
|
|
persist-credentials: false
|
|
|
|
# Redirect the Node compile cache (enabled by pnpm and TypeScript) off
|
|
# the root partition's /tmp before the first pnpm call in this lane.
|
|
- name: Redirect Node compile cache to runner temp
|
|
run: echo "NODE_COMPILE_CACHE=${{ runner.temp }}/node-compile-cache" >> "$GITHUB_ENV"
|
|
|
|
- uses: pnpm/[email protected]
|
|
with:
|
|
dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
|
|
|
|
- uses: actions/[email protected]
|
|
with:
|
|
node-version: ${{ env.PRIMARY_NODE_VERSION }}
|
|
|
|
- name: Configure pnpm store path
|
|
id: pnpm-store
|
|
run: |
|
|
store_root="$HOME/.local/share/pnpm/store"
|
|
echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
|
|
store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
|
|
echo "path=$store_path" >> "$GITHUB_OUTPUT"
|
|
|
|
# Pull requests restore the pnpm store without paying compression and
|
|
# upload on the required path. Self-hosted runners reuse the shared
|
|
# persistent store instead of restoring the remote archive.
|
|
- uses: actions/cache/[email protected]
|
|
if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
|
|
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-
|
|
|
|
# Self-hosted runners retain their own browser cache between jobs.
|
|
- uses: actions/cache/[email protected]
|
|
if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
|
|
with:
|
|
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
|
|
key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-playwright-
|
|
|
|
# The persistent self-hosted pool keeps ~/.cache between jobs on its own
|
|
# layout, so the archive cache follows the hosted-only pnpm store guard.
|
|
- name: Restore verified bubblewrap archive
|
|
id: bubblewrap-cache
|
|
if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
|
|
uses: actions/cache/[email protected]
|
|
with:
|
|
path: ~/.cache/dsh-ci/bubblewrap
|
|
key: bubblewrap-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('scripts/prepare-ci-bubblewrap.sh') }}
|
|
|
|
- name: Install dependencies and prepare bubblewrap
|
|
run: |
|
|
pnpm install --frozen-lockfile &
|
|
install_pid=$!
|
|
bash scripts/prepare-ci-bubblewrap.sh &
|
|
sandbox_pid=$!
|
|
install_status=0
|
|
wait "$install_pid" || install_status=$?
|
|
sandbox_status=0
|
|
wait "$sandbox_pid" || sandbox_status=$?
|
|
if (( install_status != 0 )); then exit "$install_status"; fi
|
|
exit "$sandbox_status"
|
|
|
|
- name: Save verified bubblewrap archive
|
|
if: (vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]') && steps.bubblewrap-cache.outputs.cache-hit != 'true'
|
|
uses: actions/cache/[email protected]
|
|
with:
|
|
path: ~/.cache/dsh-ci/bubblewrap
|
|
key: bubblewrap-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('scripts/prepare-ci-bubblewrap.sh') }}
|
|
|
|
# Ubuntu HTTP archive mirrors can stall for tens of seconds per package
|
|
# (Blacksmith lists http://azure.archive.ubuntu.com first), so every
|
|
# ephemeral runner fetches the archive over HTTPS before Playwright's apt.
|
|
- name: Use HTTPS for Ubuntu archives
|
|
if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
|
|
run: |
|
|
sudo python3 - <<'PY'
|
|
from pathlib import Path
|
|
import re
|
|
|
|
apt = Path('/etc/apt')
|
|
sources = [apt / 'sources.list', apt / 'blacksmith-ubuntu-mirrors.txt',
|
|
*(apt / 'sources.list.d').glob('*.list'),
|
|
*(apt / 'sources.list.d').glob('*.sources')]
|
|
for source in sources:
|
|
if source.is_file():
|
|
source.write_text(re.sub(
|
|
r'http://(?:[a-z0-9-]+\.)*(archive|security)\.ubuntu\.com/',
|
|
r'https://\1.ubuntu.com/', source.read_text()))
|
|
PY
|
|
|
|
# The browser install overlaps the artifact download and unpack. GitHub
|
|
# runners keep a background process started in one step alive for the
|
|
# later steps of the same job, and the wait step below collects its exit
|
|
# status. The persistent VM image owns Playwright's Linux system packages,
|
|
# so the failover pool skips apt instead of mutating the shared host.
|
|
- name: Start Playwright browser install
|
|
env:
|
|
PLAYWRIGHT_INSTALL_MODE: ${{ vars.DSH_CI_FAILOVER_LINUX == 'selfhosted' && github.event.pull_request.user.login != 'dependabot[bot]' && 'browsers' || 'with-deps' }}
|
|
run: |
|
|
deps=()
|
|
if [[ "$PLAYWRIGHT_INSTALL_MODE" == with-deps ]]; then deps=(--with-deps); fi
|
|
(
|
|
status=0
|
|
pnpm --filter @deepseek-ai/dsh-web-frontend exec playwright install "${deps[@]}" chromium webkit || status=$?
|
|
echo "$status" > "$RUNNER_TEMP/playwright-install.status"
|
|
) > "$RUNNER_TEMP/playwright-install.log" 2>&1 &
|
|
echo "$!" > "$RUNNER_TEMP/playwright-install.pid"
|
|
|
|
# Restore the build job's output after the install, so no install or
|
|
# postinstall step can replace restored files. The fixed artifact name
|
|
# resolves within this run, including a re-run of this job alone.
|
|
- name: Download build output
|
|
uses: actions/[email protected]
|
|
with:
|
|
name: build-output
|
|
path: ${{ runner.temp }}/build-output
|
|
|
|
- name: Unpack build output
|
|
run: |
|
|
set -o pipefail
|
|
archive="$RUNNER_TEMP/build-output/build-output.tar.zst"
|
|
# -m stamps restored files with the extraction time: newer than this
|
|
# checkout and never in the future. Build-time mtimes ahead of the
|
|
# clock make HMR treat freshly loaded lib/ modules as changed.
|
|
zstd -dc -T0 "$archive" | tar -xmf -
|
|
test -f apps/cli/lib/bin.js && test -f apps/web/dist/index.html && test -f .dsh-build/client-build-environment.json
|
|
|
|
- name: Wait for Playwright browsers
|
|
run: |
|
|
pid=$(cat "$RUNNER_TEMP/playwright-install.pid")
|
|
while kill -0 "$pid" 2>/dev/null; do sleep 1; done
|
|
cat "$RUNNER_TEMP/playwright-install.log"
|
|
status=$(cat "$RUNNER_TEMP/playwright-install.status" 2>/dev/null || echo missing)
|
|
if [[ "$status" != 0 ]]; then
|
|
echo "::error::Playwright browser install failed with status $status"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Run web browser snapshot shard
|
|
run: pnpm run check:ci:web-snapshot-prebuilt
|
|
|
|
node-compat:
|
|
needs: publisher-isolated
|
|
if: github.event_name == 'pull_request'
|
|
# Under the selfhosted leg this job admits only repository-owned PR code
|
|
# to the persistent shared VM; the blacksmith branch targets ephemeral
|
|
# runners and carries none of those predicates.
|
|
runs-on: >-
|
|
${{ vars.DSH_CI_FAILOVER_LINUX == 'blacksmith' && 'blacksmith-4vcpu-ubuntu-2404'
|
|
|| vars.DSH_CI_FAILOVER_LINUX == 'selfhosted'
|
|
&& github.event.pull_request.head.repo.full_name == github.repository
|
|
&& github.event.pull_request.head.repo.fork == false
|
|
&& github.event.pull_request.user.login != 'dependabot[bot]'
|
|
&& fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
|
|
|| matrix.runner }}
|
|
name: ${{ matrix.name }}
|
|
env:
|
|
DSH_GATE_CONCURRENCY: ${{ matrix.gate_concurrency }}
|
|
DSH_NODE_COMPAT_SKIP_TYPECHECK: '1'
|
|
DSH_NODE_COMPAT_BUILD: ${{ matrix.build }}
|
|
# A failed smoke aborts the remaining compatibility gates instead of
|
|
# letting the build-backed legs run against an already-red aggregate.
|
|
DSH_GATE_FAIL_FAST: '1'
|
|
strategy:
|
|
fail-fast: false
|
|
max-parallel: 1
|
|
matrix:
|
|
include:
|
|
# Pin the supported floor. Primary jobs track latest 24, which can be
|
|
# this same release, so only this leg requests the build-backed gates.
|
|
- node: '24.22.3'
|
|
name: node 24.22.3
|
|
runner: ubuntu-latest
|
|
gate_concurrency: '1'
|
|
build: '1'
|
|
- node: 26
|
|
name: node 26
|
|
runner: ubuntu-latest
|
|
gate_concurrency: '1'
|
|
build: ''
|
|
steps:
|
|
- uses: actions/[email protected]
|
|
with:
|
|
persist-credentials: false
|
|
|
|
# Shared hosts keep version installs and generated caches inside runner temp.
|
|
- name: Isolate compatibility caches
|
|
if: runner.environment == 'self-hosted'
|
|
run: |
|
|
echo "NODE_COMPILE_CACHE=$RUNNER_TEMP/node-compile-cache" >> "$GITHUB_ENV"
|
|
echo "npm_config_devdir=$RUNNER_TEMP/node-gyp" >> "$GITHUB_ENV"
|
|
echo "PNPM_CONFIG_STORE_DIR=$HOME/.local/share/pnpm/store" >> "$GITHUB_ENV"
|
|
|
|
- uses: pnpm/[email protected]
|
|
with:
|
|
dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
|
|
|
|
- uses: actions/[email protected]
|
|
env:
|
|
# The runner overwrites RUNNER_* step env before starting JavaScript actions.
|
|
NODE_OPTIONS: ${{ runner.environment == 'self-hosted' && '--import=./scripts/ci-compatible-toolcache.mjs' || '' }}
|
|
with:
|
|
node-version: ${{ matrix.node }}
|
|
cache: ${{ runner.environment == 'github-hosted' && 'pnpm' || '' }}
|
|
package-manager-cache: false
|
|
|
|
- name: Verify isolated Node installation
|
|
if: runner.environment == 'self-hosted'
|
|
run: |
|
|
node_path=$(node -p process.execPath)
|
|
echo "Node executable: $node_path"
|
|
case "$node_path" in
|
|
"$RUNNER_TEMP/node-compat-toolcache/"*) ;;
|
|
*) echo "::error::Node compatibility installation is outside runner temp"; exit 1 ;;
|
|
esac
|
|
|
|
- name: Install (immutable)
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
# The persistent self-hosted pool keeps ~/.cache between jobs on its own
|
|
# layout, so the archive cache follows the hosted-only pnpm store guard.
|
|
- name: Restore verified bubblewrap archive
|
|
id: bubblewrap-cache
|
|
if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
|
|
uses: actions/cache/[email protected]
|
|
with:
|
|
path: ~/.cache/dsh-ci/bubblewrap
|
|
key: bubblewrap-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('scripts/prepare-ci-bubblewrap.sh') }}
|
|
|
|
- name: Prepare bubblewrap (unrestrict userns)
|
|
run: bash scripts/prepare-ci-bubblewrap.sh
|
|
|
|
- name: Save verified bubblewrap archive
|
|
if: (vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]') && steps.bubblewrap-cache.outputs.cache-hit != 'true'
|
|
uses: actions/cache/[email protected]
|
|
with:
|
|
path: ~/.cache/dsh-ci/bubblewrap
|
|
key: bubblewrap-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('scripts/prepare-ci-bubblewrap.sh') }}
|
|
|
|
- name: Run compatibility smokes
|
|
env:
|
|
DSH_BUILD_CLIENT_PROFILE: official
|
|
run: pnpm run check:node-compat
|
|
|
|
# Kept out of the gate aggregate: the shape a Node release carries only
|
|
# changes with the Node version, so this belongs to the version matrix
|
|
# rather than to every commit's checks.
|
|
- name: Check Loader internal shape detection
|
|
run: pnpm exec vitest run packages/boot/app-boot/tests/loader-shape.compat.spec.ts
|
|
|
|
# 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` or be needed by a listed job: a failed node-24-coverage shard skips
|
|
# node-24-coverage-report, and a skipped need fails this verdict. `needs`
|
|
# cannot cross workflow files: native Windows jobs report
|
|
# the separate "windows checks passed" verdict from ci-windows.yml, Python
|
|
# jobs report "python checks passed" from ci-python.yml, and Wine plus the
|
|
# master-only runtime targets live in ci-master.yml.
|
|
# An explicit status function runs the verdict after failed/skipped needs
|
|
# without keeping a cancelled workflow alive for an obsolete verdict.
|
|
all-checks-passed:
|
|
name: all checks passed
|
|
# This bookkeeping-only verdict must not depend on custom-pool
|
|
# provisioning — and under Linux failover it follows the same selector as
|
|
# the worker jobs it aggregates, so a standard-hosted outage cannot strand
|
|
# the branch-protection verdict either. It retargets with the Linux switch
|
|
# (DSH_CI_FAILOVER_LINUX), not the Windows one, because it aggregates the
|
|
# required Linux workers and runs on the vm-backup pool. Under the
|
|
# 'blacksmith' value the verdict shares Blacksmith's pool with its workers
|
|
# through the same selector, so a Blacksmith outage strands both together —
|
|
# the accepted consequence of the explicit opt-in switch.
|
|
runs-on: >-
|
|
${{ vars.DSH_CI_FAILOVER_LINUX == 'blacksmith' && 'blacksmith-4vcpu-ubuntu-2404'
|
|
|| vars.DSH_CI_FAILOVER_LINUX == 'selfhosted'
|
|
&& github.event.pull_request.user.login != 'dependabot[bot]'
|
|
&& fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
|
|
|| 'ubuntu-latest' }}
|
|
needs: [publisher-isolated, node-24, node-24-coverage-report, node-24-lint, node-24-bench, node-24-build, node-24-consumers, node-24-web-snapshot, node-compat]
|
|
if: ${{ !cancelled() && github.event_name == 'pull_request' }}
|
|
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, ', ') }})"
|