Skip to content

Commit 52ef7fd

Browse files
committed
Generate E2E matrix programmatically
1 parent 1f09f99 commit 52ef7fd

File tree

14 files changed

+260
-240
lines changed

14 files changed

+260
-240
lines changed

.github/workflows/build.yml

Lines changed: 29 additions & 167 deletions
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,15 @@ jobs:
801801
needs: [job_get_metadata, job_build, job_compile_bindings_profiling_node]
802802
runs-on: ubuntu-20.04-large-js
803803
timeout-minutes: 15
804+
outputs:
805+
matrix: ${{ steps.matrix.outputs.matrix }}
806+
matrix-optional: ${{ steps.matrix-optional.outputs.matrix }}
804807
steps:
808+
- name: Check out base commit (${{ github.event.pull_request.base.sha }})
809+
uses: actions/checkout@v4
810+
if: github.event_name == 'pull_request'
811+
with:
812+
ref: ${{ github.event.pull_request.base.sha }}
805813
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
806814
uses: actions/checkout@v4
807815
with:
@@ -851,6 +859,18 @@ jobs:
851859
path: ${{ github.workspace }}/packages/*/*.tgz
852860
key: ${{ env.BUILD_CACHE_TARBALL_KEY }}
853861

862+
- name: Determine which E2E test applications should be run
863+
id: matrix
864+
if: github.event_name == 'pull_request'
865+
run: yarn --silent test:build-matrix --base=${{ github.event.pull_request.base.sha }} >> $GITHUB_OUTPUT
866+
working-directory: dev-packages/e2e-tests
867+
868+
- name: Determine which optional E2E test applications should be run
869+
id: matrix-optional
870+
if: github.event_name == 'pull_request'
871+
run: yarn --silent test:build-matrix-optional --base=${{ github.event.pull_request.base.sha }} >> $GITHUB_OUTPUT
872+
working-directory: dev-packages/e2e-tests
873+
854874
job_e2e_tests:
855875
name: E2E ${{ matrix.label || matrix.test-application }} Test
856876
# We need to add the `always()` check here because the previous step has this as well :(
@@ -870,100 +890,7 @@ jobs:
870890
E2E_TEST_SENTRY_PROJECT: 'sentry-javascript-e2e-tests'
871891
strategy:
872892
fail-fast: false
873-
matrix:
874-
is_dependabot:
875-
- ${{ github.actor == 'dependabot[bot]' }}
876-
test-application:
877-
[
878-
'angular-17',
879-
'angular-18',
880-
'astro-4',
881-
'aws-lambda-layer-cjs',
882-
'aws-serverless-esm',
883-
'node-express',
884-
'create-react-app',
885-
'create-next-app',
886-
'create-remix-app',
887-
'create-remix-app-legacy',
888-
'create-remix-app-v2',
889-
'create-remix-app-v2-legacy',
890-
'create-remix-app-express',
891-
'create-remix-app-express-legacy',
892-
'create-remix-app-express-vite-dev',
893-
'default-browser',
894-
'node-express-esm-loader',
895-
'node-express-esm-preload',
896-
'node-express-esm-without-loader',
897-
'node-express-cjs-preload',
898-
'node-otel-sdk-node',
899-
'node-otel-custom-sampler',
900-
'node-otel-without-tracing',
901-
'ember-classic',
902-
'ember-embroider',
903-
'nextjs-app-dir',
904-
'nextjs-13',
905-
'nextjs-14',
906-
'nextjs-15',
907-
'nextjs-turbo',
908-
'nextjs-t3',
909-
'react-17',
910-
'react-19',
911-
'react-create-hash-router',
912-
'react-router-6-use-routes',
913-
'react-router-5',
914-
'react-router-6',
915-
'solid',
916-
'solidstart',
917-
'solidstart-spa',
918-
'svelte-5',
919-
'sveltekit',
920-
'sveltekit-2',
921-
'sveltekit-2-svelte-5',
922-
'sveltekit-2-twp',
923-
'tanstack-router',
924-
'generic-ts3.8',
925-
'node-fastify',
926-
'node-fastify-5',
927-
'node-hapi',
928-
'node-nestjs-basic',
929-
'node-nestjs-distributed-tracing',
930-
'nestjs-basic',
931-
'nestjs-8',
932-
'nestjs-distributed-tracing',
933-
'nestjs-with-submodules',
934-
'nestjs-with-submodules-decorator',
935-
'nestjs-basic-with-graphql',
936-
'nestjs-graphql',
937-
'node-exports-test-app',
938-
'node-koa',
939-
'node-connect',
940-
'nuxt-3',
941-
'nuxt-3-min',
942-
'nuxt-4',
943-
'vue-3',
944-
'webpack-4',
945-
'webpack-5'
946-
]
947-
build-command:
948-
- false
949-
label:
950-
- false
951-
# Add any variations of a test app here
952-
# You should provide an alternate build-command as well as a matching label
953-
include:
954-
- test-application: 'create-react-app'
955-
build-command: 'test:build-ts3.8'
956-
label: 'create-react-app (TS 3.8)'
957-
- test-application: 'react-router-6'
958-
build-command: 'test:build-ts3.8'
959-
label: 'react-router-6 (TS 3.8)'
960-
- test-application: 'create-next-app'
961-
build-command: 'test:build-13'
962-
label: 'create-next-app (next@13)'
963-
- test-application: 'nextjs-app-dir'
964-
build-command: 'test:build-13'
965-
label: 'nextjs-app-dir (next@13)'
966-
893+
matrix: ${{ fromJson(needs.job_e2e_prepare.outputs.matrix) }}
967894
steps:
968895
- name: Check out base commit (${{ github.event.pull_request.base.sha }})
969896
uses: actions/checkout@v4
@@ -999,47 +926,40 @@ jobs:
999926
- name: Restore tarball cache
1000927
uses: actions/cache/restore@v4
1001928
id: restore-tarball-cache
1002-
if: steps.should-skip.outputs.SKIP != 'true'
1003929
with:
1004930
path: ${{ github.workspace }}/packages/*/*.tgz
1005931
key: ${{ env.BUILD_CACHE_TARBALL_KEY }}
1006932

1007933
- name: Build tarballs if not cached
1008-
if: steps.restore-tarball-cache.outputs.cache-hit != 'true' && steps.should-skip.outputs.SKIP != 'true'
934+
if: steps.restore-tarball-cache.outputs.cache-hit != 'true'
1009935
run: yarn build:tarball
1010936

1011937
- name: Install Playwright
1012-
if: steps.should-skip.outputs.SKIP != 'true'
1013938
uses: ./.github/actions/install-playwright
1014939
with:
1015940
browsers: chromium
1016941

1017942
- name: Get node version
1018-
if: steps.should-skip.outputs.SKIP != 'true'
1019943
id: versions
1020944
run: |
1021945
echo "echo node=$(jq -r '.volta.node' dev-packages/e2e-tests/package.json)" >> $GITHUB_OUTPUT
1022946
1023947
- name: Validate Verdaccio
1024-
if: steps.should-skip.outputs.SKIP != 'true'
1025948
run: yarn test:validate
1026949
working-directory: dev-packages/e2e-tests
1027950

1028951
- name: Prepare Verdaccio
1029-
if: steps.should-skip.outputs.SKIP != 'true'
1030952
run: yarn test:prepare
1031953
working-directory: dev-packages/e2e-tests
1032954
env:
1033955
E2E_TEST_PUBLISH_SCRIPT_NODE_VERSION: ${{ steps.versions.outputs.node }}
1034956

1035957
- name: Build E2E app
1036-
if: steps.should-skip.outputs.SKIP != 'true'
1037958
working-directory: dev-packages/e2e-tests/test-applications/${{ matrix.test-application }}
1038959
timeout-minutes: 7
1039960
run: pnpm ${{ matrix.build-command || 'test:build' }}
1040961

1041962
- name: Run E2E test
1042-
if: steps.should-skip.outputs.SKIP != 'true'
1043963
working-directory: dev-packages/e2e-tests/test-applications/${{ matrix.test-application }}
1044964
timeout-minutes: 10
1045965
run: pnpm test:assert
@@ -1054,13 +974,13 @@ jobs:
1054974
retention-days: 7
1055975

1056976
- name: Pre-process E2E Test Dumps
1057-
if: always() && steps.should-skip.outputs.SKIP != 'true'
977+
if: always()
1058978
run: |
1059979
node ./scripts/normalize-e2e-test-dump-transaction-events.js
1060980
1061981
- name: Upload E2E Test Event Dumps
1062982
uses: actions/upload-artifact@v4
1063-
if: always() && steps.should-skip.outputs.SKIP != 'true'
983+
if: always()
1064984
with:
1065985
name: E2E Test Dump (${{ matrix.label || matrix.test-application }})
1066986
path: dev-packages/e2e-tests/test-applications/${{ matrix.test-application }}/event-dumps
@@ -1069,7 +989,7 @@ jobs:
1069989
if-no-files-found: ignore
1070990

1071991
- name: Upload test results to Codecov
1072-
if: cancelled() == false && steps.should-skip.outputs.SKIP != 'true'
992+
if: cancelled() == false
1073993
continue-on-error: true
1074994
uses: codecov/test-results-action@v1
1075995
with:
@@ -1099,58 +1019,7 @@ jobs:
10991019
E2E_TEST_SENTRY_PROJECT: 'sentry-javascript-e2e-tests'
11001020
strategy:
11011021
fail-fast: false
1102-
matrix:
1103-
test-application:
1104-
[
1105-
'cloudflare-astro',
1106-
'cloudflare-workers',
1107-
'react-send-to-sentry',
1108-
'node-express-send-to-sentry',
1109-
'debug-id-sourcemaps',
1110-
]
1111-
build-command:
1112-
- false
1113-
assert-command:
1114-
- false
1115-
label:
1116-
- false
1117-
include:
1118-
- test-application: 'create-remix-app'
1119-
assert-command: 'test:assert-sourcemaps'
1120-
label: 'create-remix-app (sourcemaps)'
1121-
- test-application: 'create-remix-app-legacy'
1122-
assert-command: 'test:assert-sourcemaps'
1123-
label: 'create-remix-app-legacy (sourcemaps)'
1124-
- test-application: 'nextjs-app-dir'
1125-
build-command: 'test:build-canary'
1126-
label: 'nextjs-app-dir (canary)'
1127-
- test-application: 'nextjs-app-dir'
1128-
build-command: 'test:build-latest'
1129-
label: 'nextjs-app-dir (latest)'
1130-
- test-application: 'nextjs-13'
1131-
build-command: 'test:build-canary'
1132-
label: 'nextjs-13 (canary)'
1133-
- test-application: 'nextjs-13'
1134-
build-command: 'test:build-latest'
1135-
label: 'nextjs-13 (latest)'
1136-
- test-application: 'nextjs-14'
1137-
build-command: 'test:build-canary'
1138-
label: 'nextjs-14 (canary)'
1139-
- test-application: 'nextjs-14'
1140-
build-command: 'test:build-latest'
1141-
label: 'nextjs-14 (latest)'
1142-
- test-application: 'nextjs-15'
1143-
build-command: 'test:build-canary'
1144-
label: 'nextjs-15 (canary)'
1145-
- test-application: 'nextjs-15'
1146-
build-command: 'test:build-latest'
1147-
label: 'nextjs-15 (latest)'
1148-
- test-application: 'nextjs-turbo'
1149-
build-command: 'test:build-canary'
1150-
label: 'nextjs-turbo (canary)'
1151-
- test-application: 'nextjs-turbo'
1152-
build-command: 'test:build-latest'
1153-
label: 'nextjs-turbo (latest)'
1022+
matrix: ${{ fromJson(needs.job_e2e_prepare.outputs.matrix-optional) }}
11541023

11551024
steps:
11561025
- name: Check out base commit (${{ github.event.pull_request.base.sha }})
@@ -1181,7 +1050,6 @@ jobs:
11811050
working-directory: dev-packages/e2e-tests
11821051

11831052
- name: Restore tarball cache
1184-
if: steps.should-skip.outputs.SKIP != 'true'
11851053
uses: actions/cache/restore@v4
11861054
id: restore-tarball-cache
11871055
with:
@@ -1193,49 +1061,43 @@ jobs:
11931061
run: yarn build:tarball
11941062

11951063
- name: Install Playwright
1196-
if: steps.should-skip.outputs.SKIP != 'true'
11971064
uses: ./.github/actions/install-playwright
11981065
with:
11991066
browsers: chromium
12001067

12011068
- name: Get node version
12021069
id: versions
1203-
if: steps.should-skip.outputs.SKIP != 'true'
12041070
run: |
12051071
echo "echo node=$(jq -r '.volta.node' dev-packages/e2e-tests/package.json)" >> $GITHUB_OUTPUT
12061072
12071073
- name: Validate Verdaccio
1208-
if: steps.should-skip.outputs.SKIP != 'true'
12091074
run: yarn test:validate
12101075
working-directory: dev-packages/e2e-tests
12111076

12121077
- name: Prepare Verdaccio
1213-
if: steps.should-skip.outputs.SKIP != 'true'
12141078
run: yarn test:prepare
12151079
working-directory: dev-packages/e2e-tests
12161080
env:
12171081
E2E_TEST_PUBLISH_SCRIPT_NODE_VERSION: ${{ steps.versions.outputs.node }}
12181082

12191083
- name: Build E2E app
1220-
if: steps.should-skip.outputs.SKIP != 'true'
12211084
working-directory: dev-packages/e2e-tests/test-applications/${{ matrix.test-application }}
12221085
timeout-minutes: 7
12231086
run: pnpm ${{ matrix.build-command || 'test:build' }}
12241087

12251088
- name: Run E2E test
1226-
if: steps.should-skip.outputs.SKIP != 'true'
12271089
working-directory: dev-packages/e2e-tests/test-applications/${{ matrix.test-application }}
12281090
timeout-minutes: 10
12291091
run: pnpm ${{ matrix.assert-command || 'test:assert' }}
12301092

12311093
- name: Pre-process E2E Test Dumps
1232-
if: always() && steps.should-skip.outputs.SKIP != 'true'
1094+
if: always()
12331095
run: |
12341096
node ./scripts/normalize-e2e-test-dump-transaction-events.js
12351097
12361098
- name: Upload E2E Test Event Dumps
12371099
uses: actions/upload-artifact@v4
1238-
if: always() && steps.should-skip.outputs.SKIP != 'true'
1100+
if: always()
12391101
with:
12401102
name: E2E Test Dump (${{ matrix.label || matrix.test-application }})
12411103
path: dev-packages/e2e-tests/test-applications/${{ matrix.test-application }}/event-dumps
@@ -1245,7 +1107,7 @@ jobs:
12451107

12461108
- name: Deploy Astro to Cloudflare
12471109
uses: cloudflare/pages-action@v1
1248-
if: matrix.test-application == 'cloudflare-astro' && steps.should-skip.outputs.SKIP != 'true'
1110+
if: matrix.test-application == 'cloudflare-astro'
12491111
with:
12501112
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
12511113
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}

0 commit comments

Comments
 (0)