Skip to content

Commit 10caf39

Browse files
committed
repo: port profiling-node
1 parent 48519f9 commit 10caf39

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+11729
-3
lines changed

.craft.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ targets:
4040
- name: npm
4141
id: '@sentry/node'
4242
includeNames: /^sentry-node-\d.*\.tgz$/
43+
- name: npm
44+
id: '@sentry/profiling-node'
45+
includeNames: /^sentry-profiling-node-\d.*\.tgz$/
4346

4447
## 3 Browser-based Packages
4548
- name: npm

.github/workflows/build.yml

Lines changed: 236 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,222 @@ jobs:
262262
# `job_build` can't see `job_install_deps` and what it returned)
263263
dependency_cache_key: ${{ needs.job_install_deps.outputs.dependency_cache_key }}
264264

265+
job_build_bindings_profiling_node:
266+
name: ${{ matrix.os }} (${{ matrix.target_platform }} node=${{ matrix.node || matrix.container }}, arch=${{ matrix.arch || matrix.container }}, compiler=${{ contains(matrix.container, 'alpine') && 'musl' || 'glibc' }})
267+
needs: [job_get_metadata, job_install_deps]
268+
runs-on: ${{ matrix.os }}
269+
container: ${{ matrix.container }}
270+
strategy:
271+
fail-fast: false
272+
matrix:
273+
include:
274+
# x64 glibc
275+
- os: ubuntu-20.04
276+
node: 16
277+
- os: ubuntu-20.04
278+
node: 18
279+
- os: ubuntu-20.04
280+
node: 20
281+
282+
# x64 musl
283+
- os: ubuntu-20.04
284+
container: node:16-alpine3.16
285+
node: 16
286+
- os: ubuntu-20.04
287+
container: node:18-alpine3.17
288+
node: 18
289+
- os: ubuntu-20.04
290+
container: node:20-alpine3.17
291+
node: 20
292+
293+
# arm64 glibc
294+
- os: ubuntu-20.04
295+
arch: arm64
296+
node: 16
297+
- os: ubuntu-20.04
298+
arch: arm64
299+
node: 18
300+
- os: ubuntu-20.04
301+
arch: arm64
302+
node: 20
303+
304+
# arm64 musl
305+
- os: ubuntu-20.04
306+
container: node:16-alpine3.16
307+
arch: arm64
308+
node: 16
309+
- os: ubuntu-20.04
310+
arch: arm64
311+
container: node:18-alpine3.17
312+
node: 18
313+
- os: ubuntu-20.04
314+
arch: arm64
315+
container: node:20-alpine3.17
316+
node: 20
317+
318+
# macos x64
319+
- os: macos-11
320+
node: 16
321+
arch: x64
322+
- os: macos-11
323+
node: 18
324+
arch: x64
325+
- os: macos-11
326+
node: 20
327+
arch: x64
328+
329+
# macos arm64
330+
- os: macos-12
331+
arch: arm64
332+
node: 16
333+
target_platform: darwin
334+
335+
- os: macos-12
336+
arch: arm64
337+
node: 18
338+
target_platform: darwin
339+
340+
- os: macos-12
341+
arch: arm64
342+
node: 20
343+
target_platform: darwin
344+
345+
# windows x64
346+
- os: windows-2019
347+
node: 16
348+
arch: x64
349+
350+
- os: windows-2019
351+
node: 18
352+
arch: x64
353+
354+
- os: windows-2019
355+
node: 20
356+
arch: x64
357+
steps:
358+
- name: setup (alpine)
359+
if: contains(matrix.container, 'alpine')
360+
run: apk add --no-cache build-base python3 g++ make curl
361+
362+
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
363+
uses: actions/checkout@v4
364+
with:
365+
ref: ${{ env.HEAD_COMMIT }}
366+
367+
- uses: actions/setup-node@v4
368+
with:
369+
node-version: ${{ matrix.node }}
370+
371+
- uses: actions/setup-python@v4
372+
name: Setup python
373+
374+
- name: Install dependencies
375+
run: |
376+
cd packages/profiling-node
377+
yarn install --ignore-scripts --frozen-lockfile
378+
379+
# configure build test copy x64
380+
- name: Configure gyp
381+
if: matrix.arch != 'arm64'
382+
run: |
383+
cd packages/profiling-node
384+
yarn build:bindings:configure
385+
386+
- name: Build bindings
387+
if: matrix.arch != 'arm64'
388+
run: |
389+
cd packages/profiling-node
390+
yarn build:bindings
391+
392+
- name: setup (arm64, ${{ contains(matrix.container, 'alpine') && 'musl' || 'glibc' }})
393+
if: matrix.arch == 'arm64' && !contains(matrix.container, 'alpine') && matrix.target_platform != 'darwin'
394+
run: |
395+
sudo apt-get update
396+
sudo apt install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
397+
398+
- name: "Configure gyp (arm64, ${{ contains(matrix.container, 'alpine') && 'musl' || 'glibc' }})"
399+
if: matrix.arch == 'arm64' && matrix.target_platform != 'darwin'
400+
run: |
401+
cd packages/profiling-node
402+
yarn build:bindings:configure:arm64
403+
404+
- name: Setup musl cross compiler
405+
if: contains(matrix.container, 'alpine')
406+
run: |
407+
cd packages/profiling-node
408+
curl -OL https://musl.cc/aarch64-linux-musl-cross.tgz
409+
tar -xzvf aarch64-linux-musl-cross.tgz
410+
$(pwd)/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc --version
411+
412+
- name: "Build bindings (arm64, ${{ contains(matrix.container, 'alpine') && 'musl' || 'glibc' }})"
413+
if: matrix.arch == 'arm64' && contains(matrix.container, 'alpine') && matrix.target_platform != 'darwin'
414+
run: |
415+
cd packages/profiling-node
416+
CC=$(pwd)/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc \
417+
CXX=$(pwd)/aarch64-linux-musl-cross/bin/aarch64-linux-musl-g++ \
418+
BUILD_ARCH=arm64 yarn build:bindings
419+
420+
- name: "Build bindings (arm64, ${{ contains(matrix.container, 'alpine') && 'musl' || 'glibc' }})"
421+
if: matrix.arch == 'arm64' && !contains(matrix.container, 'alpine') && matrix.target_platform != 'darwin'
422+
run: |
423+
cd packages/profiling-node
424+
CC=aarch64-linux-gnu-gcc \
425+
CXX=aarch64-linux-gnu-g++ \
426+
BUILD_ARCH=arm64 yarn build:bindings:arm64
427+
428+
- name: "Configure gyp (arm64, darwin)"
429+
if: matrix.arch == 'arm64' && matrix.target_platform == 'darwin'
430+
run: |
431+
cd packages/profiling-node
432+
yarn build:bindings:configure:arm64
433+
434+
- name: "Build bindings (arm64, darwin)"
435+
if: matrix.arch == 'arm64' && matrix.target_platform == 'darwin'
436+
run: |
437+
cd packages/profiling-node
438+
BUILD_PLATFORM=darwin BUILD_ARCH=arm64 yarn build:bindings:arm64
439+
440+
- name: Archive binary
441+
uses: actions/[email protected]
442+
with:
443+
name: profiling-node-binaries-${{ github.sha }}
444+
path: |
445+
${{ github.workspace }}/packages/profiling-node/lib/*.node
446+
447+
job_pack_profiling_node:
448+
runs-on: ubuntu-latest
449+
needs: [job_get_metadata, job_build_bindings_profiling_node]
450+
timeout-minutes: 5
451+
steps:
452+
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
453+
uses: actions/checkout@v4
454+
with:
455+
ref: ${{ env.HEAD_COMMIT }}
456+
457+
- uses: actions/setup-node@v4
458+
with:
459+
node-version-file: 'package.json'
460+
461+
- run: |
462+
cd packages/profiling-node
463+
yarn install --frozen-lockfile
464+
465+
- run: |
466+
cd packages/profiling-node
467+
yarn build:lib
468+
469+
- uses: actions/[email protected]
470+
with:
471+
name: profiling-node-binaries-${{ github.sha }}
472+
path: packages/profiling-node/lib/
473+
474+
- run: |
475+
cd packages/profiling-node
476+
yarn pack
477+
265478
job_size_check:
266479
name: Size Check
267-
needs: [job_get_metadata, job_build]
480+
needs: [job_get_metadata, job_build, job_build_bindings_profiling_node]
268481
timeout-minutes: 15
269482
runs-on: ubuntu-20.04
270483
if:
@@ -299,7 +512,7 @@ jobs:
299512
name: Lint
300513
# Even though the linter only checks source code, not built code, it needs the built code in order check that all
301514
# inter-package dependencies resolve cleanly.
302-
needs: [job_get_metadata, job_build]
515+
needs: [job_get_metadata, job_build, job_build_bindings_profiling_node]
303516
timeout-minutes: 10
304517
runs-on: ubuntu-20.04
305518
steps:
@@ -317,6 +530,8 @@ jobs:
317530
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
318531
- name: Lint source files
319532
run: yarn lint
533+
- name: Lint C++ files
534+
run: yarn lint:clang
320535
- name: Validate ES5 builds
321536
run: yarn validate:es5
322537

@@ -343,7 +558,7 @@ jobs:
343558

344559
job_artifacts:
345560
name: Upload Artifacts
346-
needs: [job_get_metadata, job_build]
561+
needs: [job_get_metadata, job_build, job_build_bindings_profiling_node]
347562
runs-on: ubuntu-20.04
348563
# Build artifacts are only needed for releasing workflow.
349564
if: needs.job_get_metadata.outputs.is_release == 'true'
@@ -398,6 +613,24 @@ jobs:
398613
- name: Compute test coverage
399614
uses: codecov/codecov-action@v3
400615

616+
job_profiling_node_unit_tests:
617+
name: Profiling Node Unit Tests
618+
needs: [job_get_metadata, job_build]
619+
runs-on: ubuntu-latest
620+
steps:
621+
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
622+
uses: actions/checkout@v4
623+
with:
624+
ref: ${{ env.HEAD_COMMIT }}
625+
- uses: actions/setup-node@v4
626+
with:
627+
node-version: 'package.json'
628+
- uses: actions/setup-python@v4
629+
- run: yarn install --frozen-lockfile
630+
- run: yarn build:bindings:configure
631+
- run: yarn build
632+
- run: yarn test
633+
401634
job_bun_unit_tests:
402635
name: Bun Unit Tests
403636
needs: [job_get_metadata, job_build]

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"link:yarn": "lerna exec yarn link",
2727
"lint": "run-p lint:lerna lint:biome lint:prettier",
2828
"lint:lerna": "lerna run lint",
29+
"lint:clang": "lerna run lint:clang",
2930
"lint:biome": "biome check .",
3031
"lint:prettier": "prettier **/*.md **/*.css --check",
3132
"validate:es5": "lerna run validate:es5",
@@ -63,6 +64,7 @@
6364
"packages/node-experimental",
6465
"packages/opentelemetry-node",
6566
"packages/opentelemetry",
67+
"packages/profiling-node",
6668
"packages/react",
6769
"packages/remix",
6870
"packages/replay",
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module.exports = {
2+
env: {
3+
node: true,
4+
},
5+
extends: ['../../.eslintrc.js'],
6+
7+
ignorePatterns: [
8+
'lib/**/*',
9+
'demo_app/**/*',
10+
'jest.co'
11+
],
12+
rules: {
13+
'@sentry-internal/sdk/no-optional-chaining': 'off',
14+
'@sentry-internal/sdk/no-nullish-coalescing': 'off',
15+
'@sentry-internal/sdk/no-unsupported-es6-methods': 'off',
16+
'@sentry-internal/sdk/no-class-field-initializers': 'off',
17+
},
18+
};

packages/profiling-node/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# See https://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# compiled output
4+
/node_modules/
5+
/lib/
6+

0 commit comments

Comments
 (0)