|
14 | 14 | # TODO(serhalp) Ideally this would simply accept bare quotes but we're having trouble |
15 | 15 | # parsing that so this will do for now. |
16 | 16 | 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 | + |
17 | 22 | concurrency: |
18 | 23 | group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }} |
19 | 24 | cancel-in-progress: true |
@@ -52,24 +57,38 @@ jobs: |
52 | 57 | version_spec: ${{ steps.set-matrix.outputs.version_spec }} |
53 | 58 | group: ${{ steps.set-matrix.outputs.group }} |
54 | 59 | total: ${{ steps.set-matrix.outputs.total }} |
| 60 | + runTestsArgs: ${{ steps.set-matrix.outputs.runTestsArgs }} |
| 61 | + skipCleanup: ${{ steps.set-matrix.outputs.skipCleanup }} |
55 | 62 | steps: |
56 | 63 |
|
57 | 64 | - name: Set Next.js versions to test |
58 | 65 | id: set-matrix |
59 | 66 | run: | |
| 67 | + SKIP_CLEANUP="" |
60 | 68 | if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then |
61 | 69 | 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 |
64 | 80 | elif [ "${{ github.event_name }}" == "pull_request" ]; then |
65 | 81 | VERSION_SELECTORS=[\"latest\"] |
66 | 82 | echo "group=[1, 2, 3, 4, 5, 6, 7, 8]" >> $GITHUB_OUTPUT |
67 | 83 | echo "total=8" >> $GITHUB_OUTPUT |
| 84 | + echo "runTestsArgs=''" >> $GITHUB_OUTPUT |
68 | 85 | else |
69 | 86 | VERSION_SELECTORS=[\"latest\",\"canary\"] |
70 | 87 | echo "group=[1, 2, 3, 4, 5, 6, 7, 8]" >> $GITHUB_OUTPUT |
71 | 88 | echo "total=8" >> $GITHUB_OUTPUT |
| 89 | + echo "runTestsArgs=''" >> $GITHUB_OUTPUT |
72 | 90 | fi |
| 91 | + echo "skipCleanup=$SKIP_CLEANUP" >> $GITHUB_OUTPUT |
73 | 92 |
|
74 | 93 | VERSION_SPEC="[" |
75 | 94 | for QUOTED_SELECTOR in $(echo $VERSION_SELECTORS | jq -c '.[]'); do |
@@ -205,7 +224,8 @@ jobs: |
205 | 224 | # one job may wait for deploys in other jobs (only one deploy may be in progress for |
206 | 225 | # a given alias at a time), resulting in cascading timeouts. |
207 | 226 | 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 }} |
209 | 229 | working-directory: ${{ env.next-path }} |
210 | 230 |
|
211 | 231 | - name: Upload Test Results |
|
0 commit comments