Skip to content

Commit 5ddee88

Browse files
committed
ci: allow specyfing test patterns and keep deploys around for debugging
1 parent 7dbd0a8 commit 5ddee88

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

.github/workflows/test-e2e.yml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ on:
1414
# TODO(serhalp) Ideally this would simply accept bare quotes but we're having trouble
1515
# parsing that so this will do for now.
1616
default: "\\\"latest\\\""
17+
testPatterns:
18+
description: 'Leave empty to run all tests. To run just selected tests, specify a regex (for example "test/e2e/app-dir/dynamic/dynamic.test.ts|test/e2e/app-dir/fallback-shells/fallback-shells.test.ts").'
19+
required: false
20+
default: ""
21+
1722
concurrency:
1823
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
1924
cancel-in-progress: true
@@ -52,24 +57,38 @@ jobs:
5257
version_spec: ${{ steps.set-matrix.outputs.version_spec }}
5358
group: ${{ steps.set-matrix.outputs.group }}
5459
total: ${{ steps.set-matrix.outputs.total }}
60+
runTestsArgs: ${{ steps.set-matrix.outputs.runTestsArgs }}
61+
skipCleanup: ${{ steps.set-matrix.outputs.skipCleanup }}
5562
steps:
5663

5764
- name: Set Next.js versions to test
5865
id: set-matrix
5966
run: |
67+
SKIP_CLEANUP=""
6068
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
6169
VERSION_SELECTORS=[${{ github.event.inputs.versions }}]
62-
echo "group=[1, 2, 3, 4, 5, 6, 7, 8]" >> $GITHUB_OUTPUT
63-
echo "total=8" >> $GITHUB_OUTPUT
70+
if [ -n "${{ github.event.inputs.testPatterns }}" ]; then
71+
echo "group=[1]" >> $GITHUB_OUTPUT
72+
echo "total=1" >> $GITHUB_OUTPUT
73+
echo "runTestsArgs='--test-pattern \"${{ github.event.inputs.testPatterns }}\" >> $GITHUB_OUTPUT
74+
SKIP_CLEANUP="1"
75+
else
76+
echo "group=[1, 2, 3, 4, 5, 6, 7, 8]" >> $GITHUB_OUTPUT
77+
echo "total=8" >> $GITHUB_OUTPUT
78+
echo "runTestsArgs=''" >> $GITHUB_OUTPUT
79+
fi
6480
elif [ "${{ github.event_name }}" == "pull_request" ]; then
6581
VERSION_SELECTORS=[\"latest\"]
6682
echo "group=[1, 2, 3, 4, 5, 6, 7, 8]" >> $GITHUB_OUTPUT
6783
echo "total=8" >> $GITHUB_OUTPUT
84+
echo "runTestsArgs=''" >> $GITHUB_OUTPUT
6885
else
6986
VERSION_SELECTORS=[\"latest\",\"canary\"]
7087
echo "group=[1, 2, 3, 4, 5, 6, 7, 8]" >> $GITHUB_OUTPUT
7188
echo "total=8" >> $GITHUB_OUTPUT
89+
echo "runTestsArgs=''" >> $GITHUB_OUTPUT
7290
fi
91+
echo "skipCleanup=$SKIP_CLEANUP" >> $GITHUB_OUTPUT
7392
7493
VERSION_SPEC="["
7594
for QUOTED_SELECTOR in $(echo $VERSION_SELECTORS | jq -c '.[]'); do
@@ -205,7 +224,8 @@ jobs:
205224
# one job may wait for deploys in other jobs (only one deploy may be in progress for
206225
# a given alias at a time), resulting in cascading timeouts.
207226
DEPLOY_ALIAS: vercel-next-e2e-${{ matrix.version_spec.selector }}-${{ matrix.group }}
208-
run: node run-tests.js -g ${{ matrix.group }}/${{ needs.setup.outputs.total }} -c ${TEST_CONCURRENCY} --type e2e
227+
NEXT_TEST_SKIP_CLEANUP: ${{ needs.setup.outputs.skipCleanup }}
228+
run: node run-tests.js -g ${{ matrix.group }}/${{ needs.setup.outputs.total }} -c ${TEST_CONCURRENCY} --type e2e ${{ needs.setup.outputs.runTestsArgs }}
209229
working-directory: ${{ env.next-path }}
210230

211231
- name: Upload Test Results

0 commit comments

Comments
 (0)