Skip to content

Commit 8976d61

Browse files
authored
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 f01e884 commit 8976d61

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
@@ -551,7 +551,7 @@ jobs:
551551
job_profiling_node_unit_tests:
552552
name: Node Profiling Unit Tests
553553
needs: [job_get_metadata, job_build]
554-
if: needs.job_get_metadata.outputs.changed_node =='true' || needs.job_get_metadata.outputs.changed_profiling_node == 'true' || github.event_name != 'pull_request'
554+
if: needs.job_get_metadata.outputs.changed_node == 'true' || needs.job_get_metadata.outputs.changed_profiling_node == 'true' || github.event_name != 'pull_request'
555555
runs-on: ubuntu-latest
556556
timeout-minutes: 10
557557
steps:
@@ -1061,7 +1061,6 @@ jobs:
10611061
'node-experimental-fastify-app',
10621062
'node-hapi-app',
10631063
'node-exports-test-app',
1064-
'node-profiling',
10651064
'vue-3'
10661065
]
10671066
build-command:
@@ -1083,7 +1082,6 @@ jobs:
10831082
- test-application: 'nextjs-app-dir'
10841083
build-command: 'test:build-13'
10851084
label: 'nextjs-app-dir (next@13)'
1086-
10871085
steps:
10881086
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
10891087
uses: actions/checkout@v4
@@ -1104,29 +1102,6 @@ jobs:
11041102
env:
11051103
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
11061104

1107-
# Rebuild profiling by compiling TS and pull the precompiled binary artifacts
1108-
- name: Build Profiling Node
1109-
if: |
1110-
(needs.job_get_metadata.outputs.changed_profiling_node_bindings == 'true') ||
1111-
(needs.job_get_metadata.outputs.is_release == 'true') ||
1112-
(github.event_name != 'pull_request')
1113-
run: yarn lerna run build:lib --scope @sentry/profiling-node
1114-
1115-
- name: Extract Profiling Node Prebuilt Binaries
1116-
# @TODO: v4 breaks convenient merging of same name artifacts
1117-
# https://github.com/actions/upload-artifact/issues/478
1118-
if: |
1119-
(needs.job_get_metadata.outputs.changed_profiling_node_bindings == 'true') ||
1120-
(github.event_name != 'pull_request')
1121-
uses: actions/download-artifact@v3
1122-
with:
1123-
name: profiling-node-binaries-${{ github.sha }}
1124-
path: ${{ github.workspace }}/packages/profiling-node/lib/
1125-
1126-
- name: Build Profiling tarball
1127-
run: yarn build:tarball --scope @sentry/profiling-node
1128-
# End rebuild profiling
1129-
11301105
- name: Restore tarball cache
11311106
uses: actions/cache/restore@v4
11321107
with:
@@ -1168,6 +1143,93 @@ jobs:
11681143
directory: dist
11691144
workingDirectory: dev-packages/e2e-tests/test-applications/${{ matrix.test-application }}
11701145

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

0 commit comments

Comments
 (0)