Skip to content

Commit 9c804c9

Browse files
authored
feat: Support Node 24 (#12)
1 parent 07f2ba6 commit 9c804c9

File tree

5 files changed

+446
-397
lines changed

5 files changed

+446
-397
lines changed

.github/workflows/build.yml

Lines changed: 72 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 'CI: Build & Test'
1+
name: "CI: Build & Test"
22
on:
33
push:
44
branches:
@@ -16,7 +16,7 @@ jobs:
1616
- name: Set up Node
1717
uses: actions/setup-node@v4
1818
with:
19-
node-version-file: 'package.json'
19+
node-version-file: "package.json"
2020
- name: Install dependencies
2121
run: yarn install --ignore-engines --ignore-scripts --frozen-lockfile
2222
- name: Lint
@@ -32,7 +32,7 @@ jobs:
3232
fail-fast: false
3333
matrix:
3434
include:
35-
# x64 glibc
35+
# x64 glibc
3636
- os: ubuntu-22.04
3737
node: 18
3838
binary: linux-x64-glibc-108
@@ -42,6 +42,9 @@ jobs:
4242
- os: ubuntu-22.04
4343
node: 22
4444
binary: linux-x64-glibc-127
45+
- os: ubuntu-22.04
46+
node: 24
47+
binary: linux-x64-glibc-137
4548

4649
# x64 musl
4750
- os: ubuntu-22.04
@@ -56,6 +59,10 @@ jobs:
5659
container: node:22-alpine3.18
5760
node: 22
5861
binary: linux-x64-musl-127
62+
- os: ubuntu-22.04
63+
container: node:24-alpine3.20
64+
node: 24
65+
binary: linux-x64-musl-137
5966

6067
# arm64 glibc
6168
- os: ubuntu-22.04
@@ -70,6 +77,10 @@ jobs:
7077
arch: arm64
7178
node: 22
7279
binary: linux-arm64-glibc-127
80+
- os: ubuntu-22.04
81+
arch: arm64
82+
node: 24
83+
binary: linux-arm64-glibc-137
7384

7485
# arm64 musl
7586
- os: ubuntu-22.04
@@ -87,6 +98,11 @@ jobs:
8798
container: node:22-alpine3.18
8899
node: 22
89100
binary: linux-arm64-musl-127
101+
- os: ubuntu-22.04
102+
arch: arm64
103+
container: node:24-alpine3.20
104+
node: 24
105+
binary: linux-arm64-musl-137
90106

91107
# macos x64
92108
- os: macos-13
@@ -101,6 +117,10 @@ jobs:
101117
node: 22
102118
arch: x64
103119
binary: darwin-x64-127
120+
- os: macos-13
121+
node: 24
122+
arch: x64
123+
binary: darwin-x64-137
104124

105125
# macos arm64
106126
- os: macos-13
@@ -118,6 +138,11 @@ jobs:
118138
node: 22
119139
target_platform: darwin
120140
binary: darwin-arm64-127
141+
- os: macos-13
142+
arch: arm64
143+
node: 24
144+
target_platform: darwin
145+
binary: darwin-arm64-137
121146

122147
# windows x64
123148
- os: windows-2022
@@ -132,6 +157,10 @@ jobs:
132157
node: 22
133158
arch: x64
134159
binary: win32-x64-127
160+
- os: windows-2022
161+
node: 24
162+
arch: x64
163+
binary: win32-x64-137
135164

136165
steps:
137166
- name: Setup (alpine)
@@ -169,7 +198,7 @@ jobs:
169198
if: ${{ !contains(matrix.container, 'alpine') }}
170199
id: python-setup
171200
with:
172-
python-version: '3.9.13'
201+
python-version: "3.9.13"
173202

174203
- name: Setup (arm64| ${{ contains(matrix.container, 'alpine') && 'musl' || 'glibc' }})
175204
if: matrix.arch == 'arm64' && !contains(matrix.container, 'alpine') && matrix.target_platform != 'darwin'
@@ -241,35 +270,35 @@ jobs:
241270
needs: [job_compile]
242271
runs-on: ubuntu-latest
243272
steps:
244-
- name: Check out current commit
245-
uses: actions/checkout@v4
246-
- name: Set up Node
247-
uses: actions/setup-node@v4
248-
with:
249-
node-version-file: 'package.json'
250-
251-
- name: Install dependencies
252-
run: yarn install --ignore-engines --ignore-scripts --frozen-lockfile
253-
254-
- name: Build TypeScript
255-
run: yarn build:lib
256-
257-
- name: Extract Prebuilt Binaries
258-
uses: actions/download-artifact@v4
259-
with:
260-
pattern: profiling-node-binaries-*
261-
path: ${{ github.workspace }}/lib/
262-
merge-multiple: true
263-
264-
- name: Pack tarball
265-
run: yarn build:tarball
266-
267-
- name: Archive artifacts
268-
uses: actions/upload-artifact@v4
269-
with:
270-
name: ${{ github.sha }}
271-
retention-days: 90
272-
path: ${{ github.workspace }}/*.tgz
273+
- name: Check out current commit
274+
uses: actions/checkout@v4
275+
- name: Set up Node
276+
uses: actions/setup-node@v4
277+
with:
278+
node-version-file: "package.json"
279+
280+
- name: Install dependencies
281+
run: yarn install --ignore-engines --ignore-scripts --frozen-lockfile
282+
283+
- name: Build TypeScript
284+
run: yarn build:lib
285+
286+
- name: Extract Prebuilt Binaries
287+
uses: actions/download-artifact@v4
288+
with:
289+
pattern: profiling-node-binaries-*
290+
path: ${{ github.workspace }}/lib/
291+
merge-multiple: true
292+
293+
- name: Pack tarball
294+
run: yarn build:tarball
295+
296+
- name: Archive artifacts
297+
uses: actions/upload-artifact@v4
298+
with:
299+
name: ${{ github.sha }}
300+
retention-days: 90
301+
path: ${{ github.workspace }}/*.tgz
273302

274303
job_test_bindings:
275304
name: Test Bindings (v${{ matrix.node }}) ${{ matrix.os }}
@@ -279,14 +308,14 @@ jobs:
279308
fail-fast: false
280309
matrix:
281310
os: [
282-
ubuntu-24.04,
283-
ubuntu-22.04,
284-
ubuntu-22.04-arm,
285-
macos-latest, # macOS arm64
286-
macos-13, # macOS x64
287-
windows-latest
288-
]
289-
node: [18, 20, 22]
311+
ubuntu-24.04,
312+
ubuntu-22.04,
313+
ubuntu-22.04-arm,
314+
macos-latest, # macOS arm64
315+
macos-13, # macOS x64
316+
windows-latest,
317+
]
318+
node: [18, 20, 22, 24]
290319
steps:
291320
- name: Check out current commit
292321
uses: actions/checkout@v4
@@ -317,7 +346,7 @@ jobs:
317346
- name: Set up Node
318347
uses: actions/setup-node@v4
319348
with:
320-
node-version-file: 'package.json'
349+
node-version-file: "package.json"
321350
- name: Install dependencies
322351
run: yarn install --ignore-engines --ignore-scripts --frozen-lockfile
323352
- name: Download Tarball
@@ -337,7 +366,7 @@ jobs:
337366
- name: Set up Node
338367
uses: actions/setup-node@v4
339368
with:
340-
node-version-file: 'package.json'
369+
node-version-file: "package.json"
341370
- name: Install dependencies
342371
run: yarn install --ignore-engines --ignore-scripts --frozen-lockfile
343372
- name: Download Tarball

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,13 @@
5656
"clang-format": "^1.8.0",
5757
"cross-env": "^7.0.3",
5858
"eslint": "^7.0.0",
59-
"node-gyp": "^9.4.1",
59+
"node-gyp": "^11.2.0",
6060
"typescript": "^5.7.3",
6161
"vitest": "^3.0.5"
6262
},
6363
"sideEffects": false,
6464
"volta": {
65-
"node": "22.13.1"
65+
"node": "24.0.0",
66+
"yarn": "1.22.22"
6667
}
6768
}

src/index.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ export function importCppBindingsModule(): PrivateV8CpuProfilerBindings {
5959
if (abi === '127') {
6060
return require('./sentry_cpu_profiler-darwin-x64-127.node');
6161
}
62+
if (abi === '137') {
63+
return require('./sentry_cpu_profiler-darwin-x64-137.node');
64+
}
6265
}
6366

6467
if (arch === 'arm64') {
@@ -71,6 +74,9 @@ export function importCppBindingsModule(): PrivateV8CpuProfilerBindings {
7174
if (abi === '127') {
7275
return require('./sentry_cpu_profiler-darwin-arm64-127.node');
7376
}
77+
if (abi === '137') {
78+
return require('./sentry_cpu_profiler-darwin-arm64-137.node');
79+
}
7480
}
7581
}
7682

@@ -85,6 +91,9 @@ export function importCppBindingsModule(): PrivateV8CpuProfilerBindings {
8591
if (abi === '127') {
8692
return require('./sentry_cpu_profiler-win32-x64-127.node');
8793
}
94+
if (abi === '137') {
95+
return require('./sentry_cpu_profiler-win32-x64-137.node');
96+
}
8897
}
8998
}
9099

@@ -100,6 +109,9 @@ export function importCppBindingsModule(): PrivateV8CpuProfilerBindings {
100109
if (abi === '127') {
101110
return require('./sentry_cpu_profiler-linux-x64-musl-127.node');
102111
}
112+
if (abi === '137') {
113+
return require('./sentry_cpu_profiler-linux-x64-musl-137.node');
114+
}
103115
}
104116
if (stdlib === 'glibc') {
105117
if (abi === '108') {
@@ -111,6 +123,9 @@ export function importCppBindingsModule(): PrivateV8CpuProfilerBindings {
111123
if (abi === '127') {
112124
return require('./sentry_cpu_profiler-linux-x64-glibc-127.node');
113125
}
126+
if (abi === '137') {
127+
return require('./sentry_cpu_profiler-linux-x64-glibc-137.node');
128+
}
114129
}
115130
}
116131
if (arch === 'arm64') {
@@ -124,6 +139,9 @@ export function importCppBindingsModule(): PrivateV8CpuProfilerBindings {
124139
if (abi === '127') {
125140
return require('./sentry_cpu_profiler-linux-arm64-musl-127.node');
126141
}
142+
if (abi === '137') {
143+
return require('./sentry_cpu_profiler-linux-arm64-musl-137.node');
144+
}
127145
}
128146

129147
if (stdlib === 'glibc') {
@@ -136,6 +154,9 @@ export function importCppBindingsModule(): PrivateV8CpuProfilerBindings {
136154
if (abi === '127') {
137155
return require('./sentry_cpu_profiler-linux-arm64-glibc-127.node');
138156
}
157+
if (abi === '137') {
158+
return require('./sentry_cpu_profiler-linux-arm64-glibc-137.node');
159+
}
139160
}
140161
}
141162
}

test/prepare.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { fileURLToPath } from 'node:url';
66

77
const __dirname = dirname(fileURLToPath(import.meta.url));
88
const require = createRequire(import.meta.url);
9+
const env = {...process.env, NODE_OPTIONS: "--no-deprecation"};
910

1011
function prepareTest(root) {
1112
const pkgJson = require('../package.json');
@@ -27,10 +28,10 @@ function prepareTest(root) {
2728
rmSync(join(root, 'yarn.lock'), { force: true });
2829

2930
console.log('Clearing yarn cache...');
30-
spawnSync(`yarn cache clean ${pkgJson.name}`, { shell: true, stdio: 'inherit' });
31+
spawnSync(`yarn cache clean ${pkgJson.name}`, { shell: true, stdio: 'inherit', env });
3132
// Yarn has a bug where 'yarn cache clean X' does not remove the temp directory where the tgz is unpacked to.
3233
// This means installing from local tgz does not update when src changes are made https://github.com/yarnpkg/yarn/issues/5357
33-
const dirResult = spawnSync('yarn cache dir', { shell: true });
34+
const dirResult = spawnSync('yarn cache dir', { shell: true, env });
3435
const tmpDir = join(dirResult.output.toString().replace(/[,\n\r]/g, ''), '.tmp');
3536
rmSync(tmpDir, { recursive: true, force: true });
3637

0 commit comments

Comments
 (0)