Skip to content

Commit f795ba5

Browse files
committed
fixup! ci: check the prebuilt addon binds on every supported Node major
1 parent f457739 commit f795ba5

3 files changed

Lines changed: 32 additions & 45 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ jobs:
3131
runs-on: "ubuntu-latest"
3232
name: Native addon ABI compatibility
3333
env:
34-
# The flags the runner passes in a real benchmark process.
34+
# The flags the runner passes in a real benchmark process. They cannot go
35+
# through NODE_OPTIONS (--allow-natives-syntax is rejected there), so jest
36+
# runs in-band under a flagged node instead of forking workers.
3537
NODE_OPTS: "--interpreted-frames-native-stack --allow-natives-syntax"
3638
steps:
3739
- uses: "actions/checkout@v4"
@@ -49,26 +51,21 @@ jobs:
4951
key-suffix: native-abi
5052
- run: pnpm install --frozen-lockfile --prefer-offline
5153
# Build one prebuild set, then load it without rebuilding under each
52-
# runtime. The other jobs compile the addon with the Node version that
53-
# loads it, so they cannot detect an ABI mismatch.
54+
# runtime via the jest integ test. The other jobs compile the addon
55+
# with the Node version that loads it, so they cannot detect an ABI
56+
# mismatch.
5457
- run: pnpm turbo run build --filter=@codspeed/core
5558

5659
- uses: actions/setup-node@v6
5760
with:
58-
node-version: "22.0.0"
59-
- run: node ${{ env.NODE_OPTS }} scripts/assert-native-binding.cjs
61+
node-version: "22"
62+
- run: node ${{ env.NODE_OPTS }} "$(node -p 'require.resolve("jest/bin/jest")')" -c jest.config.integ.js --runInBand tests/index.integ.test.ts
63+
working-directory: packages/core
6064
- uses: actions/setup-node@v6
6165
with:
62-
node-version: "22.23.2"
63-
- run: node ${{ env.NODE_OPTS }} scripts/assert-native-binding.cjs
64-
- uses: actions/setup-node@v6
65-
with:
66-
node-version: "24.0.0"
67-
- run: node ${{ env.NODE_OPTS }} scripts/assert-native-binding.cjs
68-
- uses: actions/setup-node@v6
69-
with:
70-
node-version: "24.20.0"
71-
- run: node ${{ env.NODE_OPTS }} scripts/assert-native-binding.cjs
66+
node-version: "24"
67+
- run: node ${{ env.NODE_OPTS }} "$(node -p 'require.resolve("jest/bin/jest")')" -c jest.config.integ.js --runInBand tests/index.integ.test.ts
68+
working-directory: packages/core
7269

7370
list-examples:
7471
runs-on: "ubuntu-latest"

‎packages/core/tests/index.integ.test.ts‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable @typescript-eslint/no-require-imports */
2-
export {}; // Make this a module
2+
import fs from "fs";
33

44
beforeEach(() => {
55
jest.resetModules();
@@ -10,6 +10,25 @@ describe("with bindings", () => {
1010
const isBound = require("..").isBound as boolean;
1111
expect(isBound).toBe(true);
1212
});
13+
14+
// Symbols in the addon are bound lazily, so a prebuild built against another
15+
// ABI loads without complaint and only dies once a V8 entry point runs.
16+
it("should write the perf map when the core is set up", () => {
17+
const { setupCore, teardownCore } = require("..") as {
18+
setupCore: () => void;
19+
teardownCore: () => void;
20+
};
21+
setupCore();
22+
teardownCore();
23+
24+
const perfMap = `/tmp/perf-${process.pid}.map`;
25+
const entries = fs
26+
.readFileSync(perfMap, "utf8")
27+
.split("\n")
28+
.filter(Boolean);
29+
fs.unlinkSync(perfMap);
30+
expect(entries.length).toBeGreaterThan(0);
31+
});
1332
});
1433

1534
describe("without bindings", () => {

‎scripts/assert-native-binding.cjs‎

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)