Repository navigation
126 lines (108 loc) · 4.73 KB
/
Copy pathembedding-backend.yml
File metadata and controls
126 lines (108 loc) · 4.73 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
name: Embedding Backend Verification
# Verifies the local @huggingface/transformers embedding backend installs and
# runs across platforms — specifically that the native ONNX runtime + prebuilt
# sharp (@img/*) load under a script-skipping install on macOS, Linux and
# Windows. The migration off @xenova/transformers was previously reverted
# (8fb0836) due to native ONNX crashes under Windows + Bun, so Windows is a
# first-class target here, not an afterthought.
on:
pull_request:
paths:
- "package.json"
- "bun.lock"
- "src/services/embedding.ts"
- "src/services/onnxruntime-resolve.ts"
- "src/services/runtime-require.ts"
- "scripts/verify-embedding-backend.mjs"
- "scripts/verify-nested-onnxruntime-fixture.mjs"
- "scripts/fixtures/compiled-host-entry.mjs"
- "tests/runtime-require.test.ts"
- "tests/onnxruntime-resolve.test.ts"
- ".github/workflows/embedding-backend.yml"
workflow_dispatch:
jobs:
verify:
name: ${{ matrix.os }} / bun
strategy:
fail-fast: false
matrix:
# Apple Silicon only for macOS: @tursodatabase/database and
# onnxruntime-node@1.30.0 ship no darwin/x64 binding. Intel Mac unsupported.
# Apple Silicon: macos-15 / macos-26 (darwin/arm64).
# Explicit Ubuntu pins (ubuntu-latest → 26.04 starting 2026-10-19).
# Keep 24.04 + 26.04 like macos-15 / macos-26.
os:
[
ubuntu-24.04,
ubuntu-26.04,
macos-15,
macos-26,
windows-latest,
]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- uses: oven-sh/setup-bun@v2
# Mimic OpenCode's plugin install, which does not run lifecycle scripts.
# The whole point is that prebuilt @img/sharp-* and onnxruntime-node
# binaries must arrive without a postinstall build step.
- name: Install (no scripts — mimics OpenCode plugin install)
run: bun install --ignore-scripts
- name: Assert native binaries present without postinstall
shell: bash
run: |
set -e
echo "Checking prebuilt sharp (@img) ..."
ls node_modules/@img/sharp-*/lib/*.node
echo "Checking onnxruntime-node native binding ..."
# path varies by platform/napi version — just require at least one .node
found=$(find node_modules/onnxruntime-node/bin -name '*.node' | head -1)
test -n "$found" && echo "onnxruntime binding: $found"
# This workflow deliberately does NOT run `bun run build` or the full
# `bun test` suite. Those have pre-existing cross-platform issues unrelated
# to the embedding backend (the build script uses `cp -r`, which fails on
# Windows; one config test asserts a macOS-shaped storagePath). They belong
# in a general CI workflow, not here. This job's single purpose is to prove
# the @huggingface/transformers embedding backend installs and runs across
# platforms, which needs neither the built plugin nor the unit tests.
# The revert-critical check: load the ONNX runtime and run a real
# feature-extraction embedding under Bun on this platform.
- name: Embedding smoke (Bun)
run: bun scripts/verify-embedding-backend.mjs
# Node path too — OpenCode's plugin sidecar is Node-based in 1.15.x.
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: "24"
package-manager-cache: false
- name: Embedding smoke (Node)
run: node scripts/verify-embedding-backend.mjs
# Targeted #210 / #225 regression: OpenCode-shaped nested install on Apple Silicon,
# using the reporter's Bun/Node versions. Compiled host must run real inference
# and exit 0 (no Ort::Env SIGILL). Intel Mac runners are no longer in the matrix.
nested-opencode-regression:
name: macos-15 / nested OpenCode fixture
runs-on: macos-15
steps:
- uses: actions/checkout@v7
- uses: oven-sh/setup-bun@v2
with:
bun-version: "1.3.14"
- uses: actions/setup-node@v7
with:
node-version: "22"
package-manager-cache: false
- name: Install source dependencies
run: bun install
- name: Install web dependencies
working-directory: web
run: bun install
- name: Build package
run: bun run build
- name: Nested fixture + compiled host inference/exit (Bun 1.3.14)
run: bun scripts/verify-nested-onnxruntime-fixture.mjs
- name: Nested fixture + embedding (Node 22)
# Node cannot Bun --compile; the compiled-host check is Bun-only above.
run: node scripts/verify-nested-onnxruntime-fixture.mjs
env:
SKIP_COMPILE_HOST: "1"