Skip to content

Commit cfb281e

Browse files
joaoh82claude
andcommitted
[.github/workflows/ci.yml,sdk/nodejs/package.json] fix CI: macOS PyO3 linker + Windows node test glob
First CI run on this PR surfaced two environment-specific issues that didn't repro on my macOS dev box: 1. `rust (macos-latest)` — `cargo build --workspace --all-targets` failed linking the test binary for `sqlrite-python` + `sqlrite-nodejs`. Those are PyO3 / napi-rs extension-module cdylibs; `extension-module` on PyO3 tells rustc not to link libpython, and napi-rs does the same for the Node symbols. On macOS the auto-generated `cargo test` binary for their rlib targets then fails at link time with unresolved Python symbols (`pyo3::err::panic_after_error` et al). Fix: exclude both crates from the rust-build-and-test + rust- lint jobs. Their test coverage lives in the per-SDK jobs (python-sdk + nodejs-sdk), which exercise them through maturin / napi-rs — the native tooling knows how to handle the extension-module link. Added an explanatory comment at the exclude block so the next person doesn't accidentally re-include them. 2. `nodejs-sdk (windows-latest)` — `npm test` failed with "Could not find 'D:\…\sdk\nodejs\test\*.mjs'". Git Bash on Windows doesn't glob-expand `*.mjs` the way bash on Linux/macOS does; the literal string is passed through to node's `--test` runner, which then can't find a file named `*.mjs`. Fix: hardcode the one test file path in `scripts.test`: `node --test test/test.mjs`. Works identically on all three OSes. If/when we add a second test file, we'll switch to a glob-expansion helper (maybe `find test -name '*.mjs' -exec node --test {} +`) or native Node.js directory discovery. Verified locally with the corrected commands: - `cargo build --workspace --exclude sqlrite-desktop --exclude sqlrite-python --exclude sqlrite-nodejs --all-targets` ✓ - `cargo test` with same exclusions ✓ (183 pass) - `cargo clippy` with same exclusions ✓ - `cargo doc` with same exclusions ✓ - `cd sdk/nodejs && npm ci && npm run build && npm test` ✓ (11 pass) The other two Rust SDKs (ffi + wasm) still get built + tested via their own workspace memberships — only extension- module crates need the exclusion. Desktop stays excluded for the existing frontend-build reason (no change there). No functional code changes — CI config + one package.json script tweak. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 63a62e8 commit cfb281e

2 files changed

Lines changed: 42 additions & 7 deletions

File tree

.github/workflows/ci.yml

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,33 @@ jobs:
7171
# doesn't steal macOS's target dir and vice versa.
7272
shared-key: rust-build-and-test
7373

74-
- name: cargo build --workspace --exclude sqlrite-desktop
75-
run: cargo build --workspace --exclude sqlrite-desktop --all-targets
74+
# Exclusions explained:
75+
#
76+
# - `sqlrite-desktop` needs the Svelte frontend built first
77+
# (handled in the `desktop-build` job).
78+
#
79+
# - `sqlrite-python` + `sqlrite-nodejs` are PyO3/napi-rs
80+
# extension-module cdylibs. Their `extension-module` feature
81+
# tells the Rust toolchain not to link libpython / libnode at
82+
# compile time, so `--all-targets` fails on macOS when it
83+
# tries to build the auto-generated test binary for their
84+
# rlib targets (unresolved Python/Node symbols). The per-SDK
85+
# `python-sdk` + `nodejs-sdk` jobs below exercise these
86+
# crates through their native tooling (maturin / napi-rs).
87+
- name: cargo build
88+
run: |
89+
cargo build --workspace \
90+
--exclude sqlrite-desktop \
91+
--exclude sqlrite-python \
92+
--exclude sqlrite-nodejs \
93+
--all-targets
7694
77-
- name: cargo test --workspace --exclude sqlrite-desktop
78-
run: cargo test --workspace --exclude sqlrite-desktop
95+
- name: cargo test
96+
run: |
97+
cargo test --workspace \
98+
--exclude sqlrite-desktop \
99+
--exclude sqlrite-python \
100+
--exclude sqlrite-nodejs
79101
80102
# ---------------------------------------------------------------------------
81103
# Rust: lint — fmt + clippy + doc. One cell (ubuntu) because these
@@ -103,12 +125,25 @@ jobs:
103125
# No `-D warnings` for now — see the top-level env comment.
104126
# Deny-by-default lints (the ones that surface real bugs,
105127
# e.g. `approx_constant`) still fail without the flag.
106-
run: cargo clippy --workspace --exclude sqlrite-desktop --all-targets
128+
# Exclude the extension-module SDK cdylibs for the same
129+
# reason as `rust-build-and-test` — their test binaries
130+
# can't link standalone.
131+
run: |
132+
cargo clippy --workspace \
133+
--exclude sqlrite-desktop \
134+
--exclude sqlrite-python \
135+
--exclude sqlrite-nodejs \
136+
--all-targets
107137
108138
- name: cargo doc
109139
# `--no-deps` skips deps docs (they build on docs.rs, not here).
110140
# Not warnings-as-errors yet — same rationale as clippy above.
111-
run: cargo doc --workspace --exclude sqlrite-desktop --no-deps
141+
run: |
142+
cargo doc --workspace \
143+
--exclude sqlrite-desktop \
144+
--exclude sqlrite-python \
145+
--exclude sqlrite-nodejs \
146+
--no-deps
112147
113148
# ---------------------------------------------------------------------------
114149
# Python SDK: build the PyO3 extension, install into a venv, run pytest.

sdk/nodejs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"scripts": {
3333
"build": "napi build --platform --release",
3434
"build:debug": "napi build --platform",
35-
"test": "node --test test/*.mjs"
35+
"test": "node --test test/test.mjs"
3636
},
3737
"devDependencies": {
3838
"@napi-rs/cli": "^2.18.4"

0 commit comments

Comments
 (0)