Skip to content

Commit 5a9f460

Browse files
AbhiPrasadmydea
authored andcommitted
build: Only run profiling e2e test if bindings have changed (#10542)
In CI currently on develop, we are stuck in a situation where we don't build bindings which means that the e2e tests always fail. Let's only run the profiling e2e tests whenever we change bindings, and make it a little more liberal for when we do run CI for changing bindings.
1 parent 17a5d38 commit 5a9f460

File tree

1 file changed

+96
-33
lines changed

1 file changed

+96
-33
lines changed

.github/workflows/build.yml

Lines changed: 96 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ jobs:
117117
- *shared
118118
- *browser
119119
- 'packages/ember/**'
120+
node:
121+
- *shared
122+
- 'packages/node/**'
123+
- 'packages/node-experimental/**'
124+
- 'dev-packages/node-integration-tests/**'
120125
nextjs:
121126
- *shared
122127
- *browser
@@ -129,20 +134,15 @@ jobs:
129134
- 'packages/remix/**'
130135
- 'packages/node/**'
131136
- 'packages/react/**'
132-
node:
133-
- *shared
134-
- 'packages/node/**'
135-
- 'packages/node-experimental/**'
136-
- 'packages/profiling-node/**'
137-
- 'dev-packages/node-integration-tests/**'
138137
profiling_node:
139138
- *shared
140139
- 'packages/node/**'
140+
- 'packages/node-experimental/**'
141141
- 'packages/profiling-node/**'
142142
- 'dev-packages/e2e-tests/test-applications/node-profiling/**'
143143
profiling_node_bindings:
144144
- *workflow
145-
- 'packages/profiling-node/bindings/**'
145+
- 'packages/profiling-node/**'
146146
- 'dev-packages/e2e-tests/test-applications/node-profiling/**'
147147
deno:
148148
- *shared
@@ -559,7 +559,7 @@ jobs:
559559
job_profiling_node_unit_tests:
560560
name: Node Profiling Unit Tests
561561
needs: [job_get_metadata, job_build]
562-
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'
563563
runs-on: ubuntu-latest
564564
timeout-minutes: 10
565565
steps:
@@ -1069,7 +1069,6 @@ jobs:
10691069
'node-experimental-fastify-app',
10701070
'node-hapi-app',
10711071
'node-exports-test-app',
1072-
'node-profiling',
10731072
'vue-3'
10741073
]
10751074
build-command:
@@ -1091,7 +1090,6 @@ jobs:
10911090
- test-application: 'nextjs-app-dir'
10921091
build-command: 'test:build-13'
10931092
label: 'nextjs-app-dir (next@13)'
1094-
10951093
steps:
10961094
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
10971095
uses: actions/checkout@v4
@@ -1112,29 +1110,6 @@ jobs:
11121110
env:
11131111
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
11141112

1115-
# Rebuild profiling by compiling TS and pull the precompiled binary artifacts
1116-
- name: Build Profiling Node
1117-
if: |
1118-
(needs.job_get_metadata.outputs.changed_profiling_node_bindings == 'true') ||
1119-
(needs.job_get_metadata.outputs.is_release == 'true') ||
1120-
(github.event_name != 'pull_request')
1121-
run: yarn lerna run build:lib --scope @sentry/profiling-node
1122-
1123-
- name: Extract Profiling Node Prebuilt Binaries
1124-
# @TODO: v4 breaks convenient merging of same name artifacts
1125-
# https://github.com/actions/upload-artifact/issues/478
1126-
if: |
1127-
(needs.job_get_metadata.outputs.changed_profiling_node_bindings == 'true') ||
1128-
(github.event_name != 'pull_request')
1129-
uses: actions/download-artifact@v3
1130-
with:
1131-
name: profiling-node-binaries-${{ github.sha }}
1132-
path: ${{ github.workspace }}/packages/profiling-node/lib/
1133-
1134-
- name: Build Profiling tarball
1135-
run: yarn build:tarball --scope @sentry/profiling-node
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,

0 commit comments

Comments
 (0)