Skip to content

Commit 0dd2495

Browse files
ci: build swift helper before bun test
The Swift helper binary is imported at module-load time via Bun's `with { type: "file" }` attribute in `src/mac/helper.ts`. Tests that spawn the swrag CLI as a subprocess (tests/cli.test.ts) or import the helper module directly (tests/mac/*, tests/bootstrap.test.ts, tests/doctor.test.ts) fail with "Cannot find module" if the binary isn't on disk when `bun test` boots. Locally this works because the developer ran `bun run build` (or `scripts/build-swift-helper.sh`) at least once. CI never did — both `ci.yml` and `release.yml` only built the helper inside `bun run build` which executes AFTER `bun test`. The v0.7.0 release workflow run exposed this: 10 fail / 7 unhandled-error tests with "Cannot find module '../../vendor/swrag-helper-darwin-universal'". Build the helper explicitly between the fixture / dylib steps and the test step in both workflows.
1 parent 188fac2 commit 0dd2495

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,10 @@ jobs:
2121
run: bun run tests/fixtures/make-fixtures.ts
2222
- name: fetch sqlite-vec vendor dylibs
2323
run: bun run scripts/fetch-vec-dylibs.ts
24+
- name: build swift helper
25+
# Same rationale as release.yml: src/mac/helper.ts imports the
26+
# helper binary at module-load time, so any test that imports it
27+
# (directly or via spawning the swrag CLI) needs the binary on
28+
# disk before `bun test` runs.
29+
run: bash scripts/build-swift-helper.sh
2430
- run: bun test

.github/workflows/release.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,16 @@ jobs:
4646
- name: fetch vendor dylibs
4747
if: steps.check.outputs.skip != 'true'
4848
run: bun run scripts/fetch-vec-dylibs.ts
49+
- name: build swift helper
50+
# The Swift helper binary is imported at module-load time via Bun's
51+
# `with { type: "file" }` attribute (src/mac/helper.ts). Any test
52+
# that spawns the swrag CLI as a subprocess (tests/cli.test.ts) or
53+
# imports the helper module (tests/mac/*, tests/bootstrap.test.ts,
54+
# tests/doctor.test.ts) fails with "Cannot find module" if the
55+
# binary isn't on disk. Build it before the test phase rather
56+
# than only inside `bun run build`.
57+
if: steps.check.outputs.skip != 'true'
58+
run: bash scripts/build-swift-helper.sh
4959
- if: steps.check.outputs.skip != 'true'
5060
run: bun test
5161
- if: steps.check.outputs.skip != 'true'

0 commit comments

Comments
 (0)