Skip to content

Commit 9882f5d

Browse files
authored
fix(publish): build native addon from source in preflight (#954)
The preflight job ran `npm install && npm test` against the last-published native binary, while WASM ran from current source. When a PR updated both extractors in lockstep, the parity test would pass on CI (which rebuilds native from source) but fail on every subsequent publish run until the next release caught up. Mirror the ci.yml `parity` job pattern: compile the native addon from the current Rust source, copy it over the installed platform binary via ci-install-native.mjs, then run tests. WASM and native now come from the same commit.
1 parent fe62f5c commit 9882f5d

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,31 @@ jobs:
3131
- uses: actions/setup-node@v6
3232
with:
3333
node-version: "22"
34+
35+
# Build the native addon from the current Rust source so build-parity
36+
# tests compare WASM and native engines built from the same commit.
37+
# Without this, npm install pulls the last-published binary, which lags
38+
# behind PR changes that touch both the TS and Rust extractors.
39+
- name: Setup Rust
40+
uses: dtolnay/rust-toolchain@stable
41+
42+
- name: Rust cache
43+
uses: Swatinem/rust-cache@v2
44+
with:
45+
workspaces: crates/codegraph-core
46+
47+
- name: Install napi-rs CLI
48+
run: npm install -g @napi-rs/cli@3
49+
3450
- run: npm install
51+
52+
- name: Build native addon from current source
53+
working-directory: crates/codegraph-core
54+
run: napi build --release
55+
56+
- name: Install native addon over published binary
57+
run: node scripts/ci-install-native.mjs
58+
3559
- run: npm test
3660

3761
compute-version:

0 commit comments

Comments
 (0)