-
Notifications
You must be signed in to change notification settings - Fork 0
300 lines (255 loc) · 8.79 KB
/
Copy pathci.yml
File metadata and controls
300 lines (255 loc) · 8.79 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
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
# ── Dev mode: bun run src/cli.ts ──────────────────────────
bun-dev:
name: "Bun dev mode (${{ matrix.os }})"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2.2.0
with:
bun-version: latest
- run: bun install
- name: CLI help
shell: bash
run: bun run src/cli.ts --help
- name: CLI list
shell: bash
run: bun run src/cli.ts list
- name: CLI doctor
shell: bash
run: bun run src/cli.ts doctor || true # agents not installed in CI
- name: CLI config get/set
shell: bash
run: |
bun run src/cli.ts config get
bun run src/cli.ts config set default codex
bun run src/cli.ts config get default_agent | grep codex
bun run src/cli.ts config set default claude
bun run src/cli.ts config get default_agent | grep claude
- name: CLI missing prompt exits 1
shell: bash
run: |
! bun run src/cli.ts run 2>&1
- name: CLI unknown command exits 1
shell: bash
run: |
! bun run src/cli.ts bogus 2>&1
- name: State directory created
shell: bash
run: |
ls ~/.harnessctl/config.yaml
ls ~/.harnessctl/agents/claude.yaml
ls ~/.harnessctl/agents/codex.yaml
ls ~/.harnessctl/agents/opencode.yaml
# ── Unit tests ───────────────────────────────────────────
unit-tests:
name: "Unit tests"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2.2.0
with:
bun-version: latest
- run: bun install
- name: Run unit tests
run: bun test
# ── Fallback simulation tests ───────────────────────────
sim-fallback:
name: "Fallback simulations (${{ matrix.os }})"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2.2.0
with:
bun-version: latest
- run: bun install
- name: Install expect
if: runner.os == 'Linux'
run: sudo apt-get install -y expect
- name: Run fallback simulations
run: bash test/sim-fallback.sh
# ── Compiled binary ──────────────────────────────────────
compiled-binary:
name: "Compiled binary (${{ matrix.os }})"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2.2.0
with:
bun-version: latest
- run: bun install
- name: Build binary
shell: bash
run: |
VERSION=$(node -p "require('./package.json').version")
if [ "${{ matrix.os }}" = "windows-latest" ]; then
bun build --compile src/cli.ts --outfile harnessctl.exe --define HARNESSCTL_VERSION='"'$VERSION'"'
else
bun build --compile src/cli.ts --outfile harnessctl --define HARNESSCTL_VERSION='"'$VERSION'"'
fi
- name: Smoke test binary
shell: bash
run: |
if [ "${{ matrix.os }}" = "windows-latest" ]; then
BIN=./harnessctl.exe
else
BIN=./harnessctl
fi
$BIN --version
$BIN --help | head -4
$BIN list
$BIN doctor || true
$BIN config get
# ── npm install with bun runtime ─────────────────────────
npm-install-bun:
name: "npm install (bun runtime)"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2.2.0
with:
bun-version: latest
- run: bun install
- name: Bundle for npm
run: bun run bundle
- name: Verify bundle
run: |
test -f dist/cli.js
head -1 dist/cli.js | grep "#!/usr/bin/env node"
- name: Pack and install globally
run: |
bun pm pack
npm install -g ./harnessctl-*.tgz
- name: Smoke test global install
run: |
harnessctl --help | head -4
harnessctl list
harnessctl config get
harnessctl config set default codex
harnessctl config get default_agent | grep codex
- name: Cleanup
run: npm uninstall -g harnessctl
# ── npm install with Node 22 (no bun) ───────────────────
npm-install-node22:
name: "npm install (Node 22, no bun)"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2.2.0
with:
bun-version: latest
- uses: actions/setup-node@v6
with:
node-version: "22"
- run: bun install
- name: Bundle for npm
run: bun run bundle
- name: Pack
run: bun pm pack
- name: Install globally with npm (Node only)
run: |
# Remove bun from PATH so the shim can only use node
npm install -g ./harnessctl-*.tgz
- name: Smoke test with Node runtime
env:
PATH: /usr/local/bin:/usr/bin:/bin # exclude bun
run: |
which node
harnessctl --help | head -4
harnessctl list
harnessctl config get
# ── npm install with the current Node LTS/runtime floor ──
npm-install-node24:
name: "npm install (Node 24)"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2.2.0
with:
bun-version: latest
- uses: actions/setup-node@v6
with:
node-version: "24"
- run: bun install
- name: Bundle for npm
run: bun run bundle
- name: Pack
run: bun pm pack
- name: Install and test
run: |
npm install -g ./harnessctl-*.tgz
harnessctl --help | head -4
harnessctl list
harnessctl config get
# ── Piped stdin ──────────────────────────────────────────
piped-stdin:
name: "Piped stdin"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2.2.0
with:
bun-version: latest
- run: bun install
# We can't test actual agent invocation in CI (no API keys),
# but we can verify the CLI accepts piped input without errors
# by using a nonexistent agent that will fail at auth check (not at arg parsing)
- name: Piped stdin is accepted
run: |
# Verify piped input doesn't cause a crash — auth check fails gracefully
OUTPUT=$(echo "some context" | bun run src/cli.ts run --agent claude "test" 2>&1 || true)
echo "$OUTPUT"
echo "$OUTPUT" | grep "harnessctl"
echo "$OUTPUT" | grep "claude"
# ── Install script syntax check ─────────────────────────
install-scripts:
name: "Install scripts (syntax check)"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Shell script syntax
run: bash -n install/install.sh
- name: PowerShell script syntax
run: |
pwsh -Command "Get-Content install/install.ps1 | Out-Null" 2>/dev/null || \
echo "pwsh not available, skipping PS1 syntax check"
# ── Bundle integrity ─────────────────────────────────────
bundle-integrity:
name: "Bundle integrity"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2.2.0
with:
bun-version: latest
- run: bun install
- name: Bundle
run: bun run bundle
- name: Verify shebang
run: head -1 dist/cli.js | grep "#!/usr/bin/env node"
- name: Verify bundle is self-contained (no require of src/)
run: |
! grep 'require("\.\./' dist/cli.js
! grep "from '\.\./" dist/cli.js
- name: Verify bundle runs
run: node dist/cli.js --help | head -4
- name: Verify all commands work
run: |
node dist/cli.js list
node dist/cli.js config get
node dist/cli.js doctor || true