Skip to content

Commit bdb73c7

Browse files
authored
Merge pull request #10546 from getsentry/fn/backport-v7
Backport fixes to v7
2 parents 821537c + 11576d6 commit bdb73c7

File tree

6 files changed

+262
-66
lines changed

6 files changed

+262
-66
lines changed

.github/workflows/build.yml

Lines changed: 102 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,12 @@ jobs:
8787
id: changed
8888
with:
8989
filters: |
90+
workflow: &workflow
91+
- '.github/**'
9092
shared: &shared
93+
- *workflow
9194
- '*.{js,ts,json,yml,lock}'
9295
- 'CHANGELOG.md'
93-
- '.github/**'
9496
- 'jest/**'
9597
- 'scripts/**'
9698
- 'packages/core/**'
@@ -115,6 +117,11 @@ jobs:
115117
- *shared
116118
- *browser
117119
- 'packages/ember/**'
120+
node:
121+
- *shared
122+
- 'packages/node/**'
123+
- 'packages/node-experimental/**'
124+
- 'dev-packages/node-integration-tests/**'
118125
nextjs:
119126
- *shared
120127
- *browser
@@ -127,18 +134,16 @@ jobs:
127134
- 'packages/remix/**'
128135
- 'packages/node/**'
129136
- 'packages/react/**'
130-
node:
131-
- *shared
132-
- 'packages/node/**'
133-
- 'packages/node-experimental/**'
134-
- 'packages/profiling-node/**'
135-
- 'dev-packages/node-integration-tests/**'
136137
profiling_node:
137138
- *shared
138139
- 'packages/node/**'
140+
- 'packages/node-experimental/**'
139141
- 'packages/profiling-node/**'
142+
- 'dev-packages/e2e-tests/test-applications/node-profiling/**'
140143
profiling_node_bindings:
141-
- 'packages/profiling-node/bindings/**'
144+
- *workflow
145+
- 'packages/profiling-node/**'
146+
- 'dev-packages/e2e-tests/test-applications/node-profiling/**'
142147
deno:
143148
- *shared
144149
- *browser
@@ -554,7 +559,7 @@ jobs:
554559
job_profiling_node_unit_tests:
555560
name: Node Profiling Unit Tests
556561
needs: [job_get_metadata, job_build]
557-
if: needs.job_get_metadata.outputs.changed_node =='true' || needs.job_get_metadata.outputs.changed_profiling_node == 'true' || github.event_name != 'pull_request'
562+
if: needs.job_get_metadata.outputs.changed_node == 'true' || needs.job_get_metadata.outputs.changed_profiling_node == 'true' || github.event_name != 'pull_request'
558563
runs-on: ubuntu-latest
559564
timeout-minutes: 10
560565
steps:
@@ -1064,7 +1069,6 @@ jobs:
10641069
'node-experimental-fastify-app',
10651070
'node-hapi-app',
10661071
'node-exports-test-app',
1067-
'node-profiling',
10681072
'vue-3'
10691073
]
10701074
build-command:
@@ -1086,7 +1090,6 @@ jobs:
10861090
- test-application: 'nextjs-app-dir'
10871091
build-command: 'test:build-13'
10881092
label: 'nextjs-app-dir (next@13)'
1089-
10901093
steps:
10911094
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
10921095
uses: actions/checkout@v4
@@ -1107,34 +1110,6 @@ jobs:
11071110
env:
11081111
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
11091112

1110-
# Rebuild profiling by compiling TS and pull the precompiled binary artifacts
1111-
- name: Build Profiling Node
1112-
if: |
1113-
(needs.job_get_metadata.outputs.changed_profiling_node_bindings == 'true') ||
1114-
(needs.job_get_metadata.outputs.is_release == 'true') ||
1115-
(github.event_name != 'pull_request')
1116-
run: yarn lerna run build:lib --scope @sentry/profiling-node
1117-
1118-
- name: Extract Profiling Node Prebuilt Binaries
1119-
# @TODO: v4 breaks convenient merging of same name artifacts
1120-
# https://github.com/actions/upload-artifact/issues/478
1121-
if: |
1122-
(needs.job_get_metadata.outputs.changed_profiling_node_bindings == 'true') ||
1123-
(github.event_name != 'pull_request')
1124-
uses: actions/download-artifact@v3
1125-
with:
1126-
name: profiling-node-binaries-${{ github.sha }}
1127-
path: ${{ github.workspace }}/packages/profiling-node/lib/
1128-
1129-
- name: Build Profiling tarball
1130-
run: yarn build:tarball --scope @sentry/profiling-node
1131-
1132-
- name: Install esbuild
1133-
if: ${{ matrix.test-application == 'node-profiling' }}
1134-
working-directory: dev-packages/e2e-tests/test-applications/${{ matrix.test-application }}
1135-
run: yarn add [email protected]
1136-
# End rebuild profiling
1137-
11381113
- name: Restore tarball cache
11391114
uses: actions/cache/restore@v4
11401115
with:
@@ -1176,6 +1151,93 @@ jobs:
11761151
directory: dist
11771152
workingDirectory: dev-packages/e2e-tests/test-applications/${{ matrix.test-application }}
11781153

1154+
job_profiling_e2e_tests:
1155+
name: E2E ${{ matrix.label || matrix.test-application }} Test
1156+
# We only run E2E tests for non-fork PRs because the E2E tests require secrets to work and they can't be accessed from forks
1157+
# Dependabot PRs sadly also don't have access to secrets, so we skip them as well
1158+
# We need to add the `always()` check here because the previous step has this as well :(
1159+
# See: https://github.com/actions/runner/issues/2205
1160+
if:
1161+
# Only run profiling e2e tests if profiling node bindings have changed
1162+
always() && needs.job_e2e_prepare.result == 'success' &&
1163+
(github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) &&
1164+
github.actor != 'dependabot[bot]' && (
1165+
(needs.job_get_metadata.outputs.changed_profiling_node_bindings == 'true') ||
1166+
(needs.job_get_metadata.outputs.is_release == 'true') ||
1167+
(github.event_name != 'pull_request')
1168+
)
1169+
needs: [job_get_metadata, job_build, job_e2e_prepare]
1170+
runs-on: ubuntu-20.04
1171+
timeout-minutes: 10
1172+
env:
1173+
E2E_TEST_AUTH_TOKEN: ${{ secrets.E2E_TEST_AUTH_TOKEN }}
1174+
E2E_TEST_DSN: ${{ secrets.E2E_TEST_DSN }}
1175+
E2E_TEST_SENTRY_ORG_SLUG: 'sentry-javascript-sdks'
1176+
E2E_TEST_SENTRY_TEST_PROJECT: 'sentry-javascript-e2e-tests'
1177+
strategy:
1178+
fail-fast: false
1179+
matrix:
1180+
test-application: ['node-profiling']
1181+
build-command:
1182+
- false
1183+
label:
1184+
- false
1185+
steps:
1186+
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
1187+
uses: actions/checkout@v4
1188+
with:
1189+
ref: ${{ env.HEAD_COMMIT }}
1190+
- uses: pnpm/action-setup@v2
1191+
with:
1192+
version: 8.3.1
1193+
- name: Set up Node
1194+
uses: actions/setup-node@v4
1195+
with:
1196+
node-version-file: 'dev-packages/e2e-tests/package.json'
1197+
- name: Restore caches
1198+
uses: ./.github/actions/restore-cache
1199+
env:
1200+
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
1201+
- name: Build Profiling Node
1202+
run: yarn lerna run build:lib --scope @sentry/profiling-node
1203+
- name: Extract Profiling Node Prebuilt Binaries
1204+
uses: actions/download-artifact@v3
1205+
with:
1206+
name: profiling-node-binaries-${{ github.sha }}
1207+
path: ${{ github.workspace }}/packages/profiling-node/lib/
1208+
- name: Build Profiling tarball
1209+
run: yarn build:tarball --scope @sentry/profiling-node
1210+
- name: Restore tarball cache
1211+
uses: actions/cache/restore@v4
1212+
with:
1213+
path: ${{ github.workspace }}/packages/*/*.tgz
1214+
key: ${{ env.BUILD_PROFILING_NODE_CACHE_TARBALL_KEY }}
1215+
1216+
- name: Get node version
1217+
id: versions
1218+
run: |
1219+
echo "echo node=$(jq -r '.volta.node' dev-packages/e2e-tests/package.json)" >> $GITHUB_OUTPUT
1220+
1221+
- name: Validate Verdaccio
1222+
run: yarn test:validate
1223+
working-directory: dev-packages/e2e-tests
1224+
1225+
- name: Prepare Verdaccio
1226+
run: yarn test:prepare
1227+
working-directory: dev-packages/e2e-tests
1228+
env:
1229+
E2E_TEST_PUBLISH_SCRIPT_NODE_VERSION: ${{ steps.versions.outputs.node }}
1230+
1231+
- name: Build E2E app
1232+
working-directory: dev-packages/e2e-tests/test-applications/${{ matrix.test-application }}
1233+
timeout-minutes: 5
1234+
run: yarn ${{ matrix.build-command || 'test:build' }}
1235+
1236+
- name: Run E2E test
1237+
working-directory: dev-packages/e2e-tests/test-applications/${{ matrix.test-application }}
1238+
timeout-minutes: 5
1239+
run: yarn test:assert
1240+
11791241
job_required_jobs_passed:
11801242
name: All required jobs passed or were skipped
11811243
needs:
@@ -1195,6 +1257,7 @@ jobs:
11951257
job_browser_loader_tests,
11961258
job_remix_integration_tests,
11971259
job_e2e_tests,
1260+
job_profiling_e2e_tests,
11981261
job_artifacts,
11991262
job_lint,
12001263
job_check_format,

dev-packages/e2e-tests/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"dotenv": "16.0.3",
2323
"glob": "8.0.3",
2424
"ts-node": "10.9.1",
25-
"yaml": "2.2.2"
25+
"yaml": "2.2.2",
26+
"esbuild": "0.20.0"
2627
},
2728
"volta": {
2829
"node": "18.17.1",
Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,12 @@
11
import commonjs from '@rollup/plugin-commonjs';
22
import resolve from '@rollup/plugin-node-resolve';
33
import typescript from '@rollup/plugin-typescript';
4-
import { makeBaseNPMConfig, makeNPMConfigVariants, plugins } from '@sentry-internal/rollup-utils';
5-
6-
const configs = makeNPMConfigVariants(makeBaseNPMConfig());
7-
const cjsConfig = configs.find(config => config.output.format === 'cjs');
8-
9-
if (!cjsConfig) {
10-
throw new Error('CJS config is required for profiling-node.');
11-
}
12-
13-
const config = {
14-
...cjsConfig,
15-
input: 'src/index.ts',
16-
output: { ...cjsConfig.output, file: 'lib/index.js', format: 'cjs', dir: undefined, preserveModules: false },
17-
plugins: [
18-
plugins.makeLicensePlugin('Sentry Node Profiling'),
19-
resolve(),
20-
commonjs(),
21-
typescript({ tsconfig: './tsconfig.json' }),
22-
],
23-
};
24-
25-
export default config;
4+
import { makeBaseNPMConfig } from '@sentry-internal/rollup-utils';
5+
6+
export default makeBaseNPMConfig({
7+
packageSpecificConfig: {
8+
input: 'src/index.ts',
9+
output: { file: 'lib/index.js', format: 'cjs', dir: undefined, preserveModules: false },
10+
plugins: [resolve(), commonjs(), typescript({ tsconfig: './tsconfig.json' })],
11+
},
12+
});

packages/replay/src/coreHandlers/util/addFeedbackBreadcrumb.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { EventType } from '@sentry-internal/rrweb';
22
import type { FeedbackEvent } from '@sentry/types';
33

4-
import type { ReplayContainer } from '../../types';
4+
import type { ReplayBreadcrumbFrameEvent, ReplayContainer } from '../../types';
55

66
/**
77
* Add a feedback breadcrumb event to replay.
@@ -21,16 +21,17 @@ export function addFeedbackBreadcrumb(replay: ReplayContainer, event: FeedbackEv
2121
type: EventType.Custom,
2222
timestamp: event.timestamp * 1000,
2323
data: {
24-
timestamp: event.timestamp,
2524
tag: 'breadcrumb',
2625
payload: {
26+
timestamp: event.timestamp,
27+
type: 'default',
2728
category: 'sentry.feedback',
2829
data: {
2930
feedbackId: event.event_id,
3031
},
3132
},
3233
},
33-
});
34+
} as ReplayBreadcrumbFrameEvent);
3435

3536
return false;
3637
});

packages/replay/src/types/replayFrame.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ interface ReplayOptionFrame {
128128
}
129129

130130
interface ReplayFeedbackFrameData {
131-
feedback_id: string;
131+
feedbackId: string;
132132
}
133133

134134
interface ReplayFeedbackFrame extends ReplayBaseBreadcrumbFrame {

0 commit comments

Comments
 (0)