feat(embedding): migrate to @huggingface/transformers@^4 (fixes sharp ARM64 install, #94/#97) #2
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | |
| - "scripts/verify-embedding-backend.mjs" | |
| - ".github/workflows/embedding-backend.yml" | |
| workflow_dispatch: | |
| jobs: | |
| verify: | |
| name: ${{ matrix.os }} / bun | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - 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@v4 | |
| with: | |
| node-version: "24" | |
| - name: Embedding smoke (Node) | |
| run: node scripts/verify-embedding-backend.mjs |