Repository navigation
152 lines (140 loc) · 6.51 KB
/
Copy pathci-e2e-native-opencode.yml
File metadata and controls
152 lines (140 loc) · 6.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
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