Skip to content

feat: Support Node 24 #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 72 additions & 43 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'CI: Build & Test'
name: "CI: Build & Test"
on:
push:
branches:
Expand All @@ -16,7 +16,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
node-version-file: "package.json"
- name: Install dependencies
run: yarn install --ignore-engines --ignore-scripts --frozen-lockfile
- name: Lint
Expand All @@ -32,7 +32,7 @@ jobs:
fail-fast: false
matrix:
include:
# x64 glibc
# x64 glibc
- os: ubuntu-22.04
node: 18
binary: linux-x64-glibc-108
Expand All @@ -42,6 +42,9 @@ jobs:
- os: ubuntu-22.04
node: 22
binary: linux-x64-glibc-127
- os: ubuntu-22.04
node: 24
binary: linux-x64-glibc-137

# x64 musl
- os: ubuntu-22.04
Expand All @@ -56,6 +59,10 @@ jobs:
container: node:22-alpine3.18
node: 22
binary: linux-x64-musl-127
- os: ubuntu-22.04
container: node:24-alpine3.20
node: 24
binary: linux-x64-musl-137

# arm64 glibc
- os: ubuntu-22.04
Expand All @@ -70,6 +77,10 @@ jobs:
arch: arm64
node: 22
binary: linux-arm64-glibc-127
- os: ubuntu-22.04
arch: arm64
node: 24
binary: linux-arm64-glibc-137

# arm64 musl
- os: ubuntu-22.04
Expand All @@ -87,6 +98,11 @@ jobs:
container: node:22-alpine3.18
node: 22
binary: linux-arm64-musl-127
- os: ubuntu-22.04
arch: arm64
container: node:24-alpine3.20
node: 24
binary: linux-arm64-musl-137

# macos x64
- os: macos-13
Expand All @@ -101,6 +117,10 @@ jobs:
node: 22
arch: x64
binary: darwin-x64-127
- os: macos-13
node: 24
arch: x64
binary: darwin-x64-137

# macos arm64
- os: macos-13
Expand All @@ -118,6 +138,11 @@ jobs:
node: 22
target_platform: darwin
binary: darwin-arm64-127
- os: macos-13
arch: arm64
node: 24
target_platform: darwin
binary: darwin-arm64-137

# windows x64
- os: windows-2022
Expand All @@ -132,6 +157,10 @@ jobs:
node: 22
arch: x64
binary: win32-x64-127
- os: windows-2022
node: 24
arch: x64
binary: win32-x64-137

steps:
- name: Setup (alpine)
Expand Down Expand Up @@ -169,7 +198,7 @@ jobs:
if: ${{ !contains(matrix.container, 'alpine') }}
id: python-setup
with:
python-version: '3.9.13'
python-version: "3.9.13"

- name: Setup (arm64| ${{ contains(matrix.container, 'alpine') && 'musl' || 'glibc' }})
if: matrix.arch == 'arm64' && !contains(matrix.container, 'alpine') && matrix.target_platform != 'darwin'
Expand Down Expand Up @@ -241,35 +270,35 @@ jobs:
needs: [job_compile]
runs-on: ubuntu-latest
steps:
- name: Check out current commit
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version-file: 'package.json'

- name: Install dependencies
run: yarn install --ignore-engines --ignore-scripts --frozen-lockfile

- name: Build TypeScript
run: yarn build:lib

- name: Extract Prebuilt Binaries
uses: actions/download-artifact@v4
with:
pattern: profiling-node-binaries-*
path: ${{ github.workspace }}/lib/
merge-multiple: true

- name: Pack tarball
run: yarn build:tarball

- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ github.sha }}
retention-days: 90
path: ${{ github.workspace }}/*.tgz
- name: Check out current commit
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version-file: "package.json"

- name: Install dependencies
run: yarn install --ignore-engines --ignore-scripts --frozen-lockfile

- name: Build TypeScript
run: yarn build:lib

- name: Extract Prebuilt Binaries
uses: actions/download-artifact@v4
with:
pattern: profiling-node-binaries-*
path: ${{ github.workspace }}/lib/
merge-multiple: true

- name: Pack tarball
run: yarn build:tarball

- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ github.sha }}
retention-days: 90
path: ${{ github.workspace }}/*.tgz

job_test_bindings:
name: Test Bindings (v${{ matrix.node }}) ${{ matrix.os }}
Expand All @@ -279,14 +308,14 @@ jobs:
fail-fast: false
matrix:
os: [
ubuntu-24.04,
ubuntu-22.04,
ubuntu-22.04-arm,
macos-latest, # macOS arm64
macos-13, # macOS x64
windows-latest
]
node: [18, 20, 22]
ubuntu-24.04,
ubuntu-22.04,
ubuntu-22.04-arm,
macos-latest, # macOS arm64
macos-13, # macOS x64
windows-latest,
]
node: [18, 20, 22, 24]
steps:
- name: Check out current commit
uses: actions/checkout@v4
Expand Down Expand Up @@ -317,7 +346,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
node-version-file: "package.json"
- name: Install dependencies
run: yarn install --ignore-engines --ignore-scripts --frozen-lockfile
- name: Download Tarball
Expand All @@ -337,7 +366,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
node-version-file: "package.json"
- name: Install dependencies
run: yarn install --ignore-engines --ignore-scripts --frozen-lockfile
- name: Download Tarball
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,13 @@
"clang-format": "^1.8.0",
"cross-env": "^7.0.3",
"eslint": "^7.0.0",
"node-gyp": "^9.4.1",
"node-gyp": "^11.2.0",
"typescript": "^5.7.3",
"vitest": "^3.0.5"
},
"sideEffects": false,
"volta": {
"node": "22.13.1"
"node": "24.0.0",
"yarn": "1.22.22"
}
}
21 changes: 21 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ export function importCppBindingsModule(): PrivateV8CpuProfilerBindings {
if (abi === '127') {
return require('./sentry_cpu_profiler-darwin-x64-127.node');
}
if (abi === '137') {
return require('./sentry_cpu_profiler-darwin-x64-137.node');
}
}

if (arch === 'arm64') {
Expand All @@ -71,6 +74,9 @@ export function importCppBindingsModule(): PrivateV8CpuProfilerBindings {
if (abi === '127') {
return require('./sentry_cpu_profiler-darwin-arm64-127.node');
}
if (abi === '137') {
return require('./sentry_cpu_profiler-darwin-arm64-137.node');
}
}
}

Expand All @@ -85,6 +91,9 @@ export function importCppBindingsModule(): PrivateV8CpuProfilerBindings {
if (abi === '127') {
return require('./sentry_cpu_profiler-win32-x64-127.node');
}
if (abi === '137') {
return require('./sentry_cpu_profiler-win32-x64-137.node');
}
}
}

Expand All @@ -100,6 +109,9 @@ export function importCppBindingsModule(): PrivateV8CpuProfilerBindings {
if (abi === '127') {
return require('./sentry_cpu_profiler-linux-x64-musl-127.node');
}
if (abi === '137') {
return require('./sentry_cpu_profiler-linux-x64-musl-137.node');
}
}
if (stdlib === 'glibc') {
if (abi === '108') {
Expand All @@ -111,6 +123,9 @@ export function importCppBindingsModule(): PrivateV8CpuProfilerBindings {
if (abi === '127') {
return require('./sentry_cpu_profiler-linux-x64-glibc-127.node');
}
if (abi === '137') {
return require('./sentry_cpu_profiler-linux-x64-glibc-137.node');
}
}
}
if (arch === 'arm64') {
Expand All @@ -124,6 +139,9 @@ export function importCppBindingsModule(): PrivateV8CpuProfilerBindings {
if (abi === '127') {
return require('./sentry_cpu_profiler-linux-arm64-musl-127.node');
}
if (abi === '137') {
return require('./sentry_cpu_profiler-linux-arm64-musl-137.node');
}
}

if (stdlib === 'glibc') {
Expand All @@ -136,6 +154,9 @@ export function importCppBindingsModule(): PrivateV8CpuProfilerBindings {
if (abi === '127') {
return require('./sentry_cpu_profiler-linux-arm64-glibc-127.node');
}
if (abi === '137') {
return require('./sentry_cpu_profiler-linux-arm64-glibc-137.node');
}
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions test/prepare.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { fileURLToPath } from 'node:url';

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

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

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

Expand Down
Loading