mirror of
https://github.com/ranxianglei/billion-context.git
synced 2026-11-22 07:38:06 +08:00
Every pull_request-triggered job in all 20 PR workflows now carries `if: !contains(github.event.head_commit.message, '[ework:ci-held]')`, merged with pre-existing job conditions where present. Why: the ci-engineer lane rebase/fix sessions push incrementally, and each push spawned ~13 full workflow runs. Queued runs on the same ref are NOT cancelled by the per-ref concurrency groups (cancel-in-progress only covers in_progress), so a 20-push session queued ~260 runs that starved real work (release CI waited behind 73 queued, #5795 incident lineage). Owner policy 2026-11-15: intermediate pushes must not trigger CI; the verified final head push (marker-free) is the single CI pass. Semantics: marker in the commit MESSAGE (subject or body) — GitHub only exposes head_commit.message at trigger time. Non-PR events are unaffected (schedule/workflow_dispatch/empty head_commit => guard true). A held run completes with all jobs skipped; branch-protection required checks stay unsatisfied until the final unmarked run goes green, which is the intended signal that "CI has not been asked yet". No config surface added (owner policy: marker convention, not a knob). (ework-agent, policy: 推一堆后确定没问题再触发 — m17242)
153 lines
6.5 KiB
YAML
153 lines
6.5 KiB
YAML
name: e2e-native-opencode
|
|
|
|
on:
|
|
# three-layer CI (#3295): pull_request feeds the ci:full label gate + the
|
|
# paths filter (where present) only — the pre-#3295 "#3085: every PR by
|
|
# default" rule no longer holds; plain PRs are covered by ci.yml's core
|
|
# matrix, master by ci.yml core runs + the gated scheduled full runs.
|
|
pull_request:
|
|
types: [opened, synchronize, reopened, labeled]
|
|
schedule:
|
|
- cron: '8/30 * * * *'
|
|
# three-layer CI: 30-min smart cron — gate skips when master HEAD is unchanged since the last green scheduled run
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
# #2637 plan #3: schedule-safe group — master pushes must not cancel the
|
|
# day's nightly run; same-ref pushes still supersede each other.
|
|
# #3772: a non-ci:full `labeled` run is skip-scoped by its gate job below —
|
|
# keep it in its own group so it can never cancel the in-flight real run.
|
|
group: e2e-native-opencode-${{ github.event_name == 'schedule' && 'nightly' || github.ref }}${{ (github.event_name == 'pull_request' && github.event.action == 'labeled' && github.event.label.name != 'ci:full') && '-skip' || '' }}
|
|
# #3331: cancel-in-progress applies WITHIN the group too — a 30-min cron whose
|
|
# run outlives the interval would kill its predecessor mid-suite (tokens spent,
|
|
# no green recorded, gate can never skip). Cancel only same-ref superseded
|
|
# runs; scheduled runs queue behind each other instead.
|
|
cancel-in-progress: ${{ github.event_name != 'schedule' }}
|
|
|
|
jobs:
|
|
# three-layer CI: this lane only runs on demand (ci:full label / dispatch)
|
|
# or on the 30-min cron when master moved since the last green scheduled run.
|
|
gate:
|
|
if: ${{ !contains(github.event.head_commit.message, '[ework:ci-held]') }} # #CI-hold: [ework:ci-held] in commit message -> hold CI until final unmarked push
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
actions: read
|
|
outputs:
|
|
run: ${{ steps.g.outputs.run }}
|
|
steps:
|
|
- id: g
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
EVENT: ${{ github.event_name }}
|
|
PR_LABELS: ${{ join(github.event.pull_request.labels.*.name, ' ') }}
|
|
LABEL_EVENT: ${{ github.event.label.name }}
|
|
HEAD_SHA: ${{ github.sha }}
|
|
run: |
|
|
set -euo pipefail
|
|
run=true
|
|
if [ "$EVENT" = "pull_request" ]; then
|
|
# only the ci:full label itself may trigger; other label events skip
|
|
if [ -n "$LABEL_EVENT" ] && [ "$LABEL_EVENT" != "ci:full" ]; then run=false
|
|
elif ! grep -qw ci:full <<<"$PR_LABELS"; then run=false; fi
|
|
elif [ "$EVENT" = "schedule" ]; then
|
|
LAST=$(gh api "repos/${GITHUB_REPOSITORY}/actions/workflows/ci-e2e-native-opencode.yml/runs?event=schedule&status=success&per_page=1" --jq '.workflow_runs[0].head_sha // ""' 2>/dev/null || echo "")
|
|
echo "last green scheduled head: ${LAST:-none}; current: $HEAD_SHA"
|
|
if [ "$LAST" = "$HEAD_SHA" ]; then run=false; fi
|
|
fi
|
|
echo "run=$run" >> "$GITHUB_OUTPUT"
|
|
e2e-native-opencode:
|
|
needs: [gate]
|
|
if: ${{ !contains(github.event.head_commit.message, '[ework:ci-held]') && (needs.gate.outputs.run == 'true') }}
|
|
name: real opencode native lane vs deterministic fake upstream (zero tokens)
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
# Transient runner↔registry blips (ECONNRESET) must not red a PR (#2611):
|
|
# raise npm's built-in fetch retry (default 2) so a ~10s jitter rides out
|
|
# instead of aborting setup. Job-level → covers every registry op here
|
|
# (global CLI install AND `npm ci`). Bounded: worst case ~+2 min before a
|
|
# genuine sustained outage still fails fast.
|
|
env:
|
|
npm_config_fetch_retries: '5'
|
|
npm_config_fetch_retry_mintimeout: '5000'
|
|
npm_config_fetch_retry_maxtimeout: '60000'
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: npm
|
|
|
|
# Pinned like pi/codex (#815): opencode's plugin/config API surface must
|
|
# not drift under this suite. Bump deliberately after re-running the
|
|
# suite locally on the new version. 2.0.3 = V2 `setup` lane, verified
|
|
# end-to-end (the same suite drives 1.x via E2E_OC_BIN).
|
|
- name: Install opencode CLI
|
|
run: npm i -g @opencode/cli@2.0.3
|
|
|
|
- name: Print opencode version
|
|
run: opencode --version
|
|
|
|
- name: Install deps
|
|
run: npm ci
|
|
|
|
- name: Build
|
|
run: npm run build
|
|
|
|
- name: Run real-opencode native-lane compression E2E
|
|
env:
|
|
E2E_OC_BIN: opencode
|
|
run: ACP_TEST_E2E_OC_NATIVE=1 node --import tsx --test tests/e2e/e2e-native-opencode.test.ts
|
|
|
|
- name: Collect E2E artifacts
|
|
if: failure()
|
|
run: |
|
|
mkdir -p tmp/e2e-artifacts
|
|
for d in tmp/e2e-native-opencode-*; do [ -d "$d" ] && cp -r "$d" tmp/e2e-artifacts/ || true; done
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
if: failure()
|
|
with:
|
|
name: e2e-native-opencode-artifacts
|
|
path: tmp/e2e-artifacts
|
|
if-no-files-found: ignore
|
|
|
|
e2e-opencode-responses-ws:
|
|
needs: [gate]
|
|
if: ${{ !contains(github.event.head_commit.message, '[ework:ci-held]') && (needs.gate.outputs.run == 'true') }}
|
|
name: OpenCode V2 Responses WebSocket ACP (zero tokens)
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
# Transient runner↔registry blips (ECONNRESET) must not red a PR (#2611):
|
|
# raise npm's built-in fetch retry (default 2) so a ~10s jitter rides out
|
|
# instead of aborting setup. Job-level → covers every registry op here
|
|
# (global CLI install AND `npm ci`). Bounded: worst case ~+2 min before a
|
|
# genuine sustained outage still fails fast.
|
|
env:
|
|
npm_config_fetch_retries: '5'
|
|
npm_config_fetch_retry_mintimeout: '5000'
|
|
npm_config_fetch_retry_maxtimeout: '60000'
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: npm
|
|
- name: Install WebSocket-capable OpenCode V2
|
|
run: npm i -g @opencode/cli@2.0.20
|
|
- name: Install deps
|
|
run: npm ci
|
|
- name: Build
|
|
run: npm run build
|
|
- name: Run native Responses WebSocket ACP regression
|
|
env:
|
|
E2E_OC_BIN: opencode
|
|
run: ACP_TEST_E2E_OC_WS=1 node --import tsx --test tests/e2e/e2e-opencode-responses-ws.test.ts
|
|
- uses: actions/upload-artifact@v4
|
|
if: failure()
|
|
with:
|
|
name: e2e-opencode-responses-ws-artifacts
|
|
path: /tmp/bili-oc-ws-e2e-*
|
|
if-no-files-found: ignore
|