-
Notifications
You must be signed in to change notification settings - Fork 1
274 lines (264 loc) · 11.5 KB
/
Copy pathci.yml
File metadata and controls
274 lines (264 loc) · 11.5 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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
name: CI
on:
workflow_dispatch:
push:
branches: [main]
pull_request:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
plugins:
name: Plugin packages
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Set up pnpm
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
with:
version: 11.21.0
- name: Set up Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24
cache: pnpm
cache-dependency-path: |
src/plugins/opencode/content/pnpm-lock.yaml
src/plugins/pi/content/pnpm-lock.yaml
- name: Reject Bun tooling in OpenCode and the shared client
shell: bash
run: |
if git grep -n -E 'bun:test|bun run|bun install|packageManager.*bun' -- \
src/plugins/opencode/content src/runtime/js-daemon-client; then
echo "OpenCode or the shared daemon client still depends on Bun" >&2
exit 1
fi
if find src/plugins/opencode -name 'bun.lock*' -print -quit | grep -q .; then
echo "OpenCode still contains a Bun lockfile" >&2
exit 1
fi
- name: Build and validate plugins
run: make test
js-daemon-client:
name: JavaScript daemon client (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Set up Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24
- name: Test RPC transport contracts
run: node --test src/runtime/js-daemon-client/tests/client.test.ts
- name: Verify generated client preparation
run: |
node scripts/prepare-js-daemon-client.mjs all
node scripts/prepare-js-daemon-client.mjs all --check
opencode-compatibility:
name: OpenCode package (${{ matrix.peer-version }})
strategy:
fail-fast: false
matrix:
peer-version: ["1.2.25", "latest"]
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Set up pnpm
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
with:
version: 11.21.0
- name: Set up Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24
cache: pnpm
cache-dependency-path: src/plugins/opencode/content/pnpm-lock.yaml
- name: Build and validate package
run: make validate-opencode
- name: Install package with OpenCode peers
env:
PEER_VERSION: ${{ matrix.peer-version }}
run: |
set -euo pipefail
package_dir="$(mktemp -d)"
(cd dist/opencode && pnpm pack --pack-destination "$package_dir" >/dev/null)
tarball="$(find "$package_dir" -name 'braintrust-trace-opencode-*.tgz' -print -quit)"
mkdir install-test
npm install --prefix install-test --no-audit --no-fund \
"$tarball" \
"@opencode-ai/plugin@${PEER_VERSION}" \
"@opencode-ai/sdk@${PEER_VERSION}"
node -e 'import(process.argv[1]).then((m) => { if (typeof m.default !== "function") process.exit(1) })' \
"$PWD/install-test/node_modules/@braintrust/trace-opencode/dist/index.mjs"
resolve-pi-compatibility:
name: Resolve Pi compatibility window
runs-on: ubuntu-24.04
timeout-minutes: 10
outputs:
versions: ${{ steps.versions.outputs.versions }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- id: versions
name: Resolve latest patch from five Pi minor lines
env:
PI_VERSION_COUNT: 5
run: node src/plugins/pi/content/scripts/resolve-pi-versions.mjs
pi-compatibility:
name: Pi package (${{ matrix.pi-target.version }})
needs: resolve-pi-compatibility
strategy:
fail-fast: false
matrix:
pi-target: ${{ fromJson(needs.resolve-pi-compatibility.outputs.versions) }}
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Set up pnpm
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
with:
version: 11.21.0
- name: Set up Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24
cache: pnpm
cache-dependency-path: src/plugins/pi/content/pnpm-lock.yaml
- name: Build and validate Pi package
run: make validate-pi
- name: Test resolved Pi compatibility target
shell: bash
run: |
set -euo pipefail
package_dir="$(mktemp -d)"
(cd dist/pi && pnpm pack --pack-destination "$package_dir" >/dev/null)
tarball="$(find "$package_dir" -name 'braintrust-pi-extension-*.tgz' -print -quit)"
mkdir pi-install-test
npm install --prefix pi-install-test --no-audit --no-fund \
"$tarball" \
'${{ matrix.pi-target.piCodingAgentSpec }}'
node -e 'import(process.argv[1]).then((m) => { if (typeof m.default !== "function") process.exit(1) })' \
"$PWD/pi-install-test/node_modules/@braintrust/pi-extension/dist/index.mjs"
daemon:
name: Daemon (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04
agent_suffix: ""
- os: macos-latest
agent_suffix: ""
- os: windows-latest
agent_suffix: ".cmd"
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Install Rust
run: |
rustup toolchain install stable --profile minimal
rustup default stable
rustup component add clippy rustfmt
- name: Install latest coding agents
run: npm install --prefix "${{ runner.temp }}/coding-agents" --no-save --no-package-lock --no-audit --no-fund --cache "${{ runner.temp }}/npm-cache" @openai/codex@latest @anthropic-ai/claude-code@latest opencode-ai@latest @earendil-works/pi-coding-agent@latest
- name: Ensure Codex platform binary is available
shell: bash
run: |
set -euo pipefail
agent_dir="${{ runner.temp }}/coding-agents"
codex_version="$(node -p 'require(process.argv[1]).version' "$(npm root --prefix "$agent_dir")/@openai/codex/package.json")"
codex_platform="$(node -p '`${process.platform}-${process.arch}`')"
platform_dir="$agent_dir/node_modules/@openai/codex-$codex_platform"
platform_spec="@openai/codex-$codex_platform@npm:@openai/codex@$codex_version-$codex_platform"
if test -d "$platform_dir"; then
exit 0
fi
for attempt in 1 2 3 4 5 6; do
if npm install --prefix "$agent_dir" --no-save --no-package-lock --no-audit --no-fund \
--cache "${{ runner.temp }}/npm-cache" \
"@openai/codex@$codex_version" "$platform_spec" \
@anthropic-ai/claude-code@latest opencode-ai@latest \
@earendil-works/pi-coding-agent@latest; then
exit 0
fi
if test "$attempt" = 6; then
echo "Codex platform package remained unavailable: $platform_spec" >&2
exit 1
fi
sleep 10
done
- name: Set up pnpm
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
with:
version: 11.21.0
- name: Set up Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24
cache: pnpm
cache-dependency-path: |
src/plugins/opencode/content/pnpm-lock.yaml
src/plugins/pi/content/pnpm-lock.yaml
- name: Build and install OpenCode plugin for integration harness
shell: bash
run: |
set -euo pipefail
make build-opencode
package_dir="$RUNNER_TEMP/opencode-package"
install_dir="$RUNNER_TEMP/opencode-plugin-install"
mkdir -p "$package_dir" "$install_dir"
(cd dist/opencode && pnpm pack --pack-destination "$package_dir" >/dev/null)
tarball="$(find "$package_dir" -name 'braintrust-trace-opencode-*.tgz' -print -quit)"
npm install --prefix "$install_dir" --no-audit --no-fund \
"$tarball" @opencode-ai/plugin@latest @opencode-ai/sdk@latest
echo "OPENCODE_PLUGIN=$install_dir/node_modules/@braintrust/trace-opencode/dist/index.mjs" \
>> "$GITHUB_ENV"
- name: Build and install Pi extension for integration harness
shell: bash
run: |
set -euo pipefail
make build-pi
package_dir="$RUNNER_TEMP/pi-package"
install_dir="$RUNNER_TEMP/pi-extension"
mkdir -p "$package_dir" "$install_dir"
(cd dist/pi && pnpm pack --pack-destination "$package_dir" >/dev/null)
tarball="$(find "$package_dir" -name 'braintrust-pi-extension-*.tgz' -print -quit)"
npm install --prefix "$install_dir" --no-save --no-package-lock --no-audit --no-fund \
"$tarball"
- name: Report coding-agent versions
run: |
npm exec --prefix "${{ runner.temp }}/coding-agents" -- codex --version
npm exec --prefix "${{ runner.temp }}/coding-agents" -- claude --version
npm exec --prefix "${{ runner.temp }}/coding-agents" -- opencode --version
npm exec --prefix "${{ runner.temp }}/coding-agents" -- pi --version
- name: Check formatting
if: runner.os == 'Linux'
run: cargo fmt --manifest-path bt-daemon/Cargo.toml -- --check
- name: Build daemon
run: cargo build --manifest-path bt-daemon/Cargo.toml --all-features --locked
- name: Test daemon
run: cargo test --manifest-path bt-daemon/Cargo.toml --all-features --locked
- name: Test coding-agent integrations with deterministic inference
env:
BT_AGENT_INFERENCE_MODE: mock
BT_AGENT_INGEST_MODE: mock
CODEX_BIN: ${{ runner.temp }}/coding-agents/node_modules/.bin/codex${{ matrix.agent_suffix }}
CLAUDE_BIN: ${{ runner.temp }}/coding-agents/node_modules/.bin/claude${{ matrix.agent_suffix }}
OPENCODE_BIN: ${{ runner.temp }}/coding-agents/node_modules/.bin/opencode${{ matrix.agent_suffix }}
PI_BIN: ${{ runner.temp }}/coding-agents/node_modules/.bin/pi${{ matrix.agent_suffix }}
PI_EXTENSION_PATH: ${{ runner.temp }}/pi-extension/node_modules/@braintrust/pi-extension/dist/index.mjs
run: cargo test --manifest-path bt-daemon/Cargo.toml --all-features --locked --test agent_integration -- --ignored --nocapture --test-threads=1
- name: Lint daemon
run: cargo clippy --manifest-path bt-daemon/Cargo.toml --all-targets --all-features --locked -- -D warnings