4343 runs-on : ubuntu-latest
4444 if : ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'run-e2e-tests')) }}
4545 outputs :
46- version : ${{ steps.set-matrix.outputs.version }}
46+ version_spec : ${{ steps.set-matrix.outputs.version_spec }}
4747 group : ${{ steps.set-matrix.outputs.group }}
4848 total : ${{ steps.set-matrix.outputs.total }}
4949 steps :
@@ -52,56 +52,60 @@ jobs:
5252 id : set-matrix
5353 run : |
5454 if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
55- echo 'version =[${{ github.event.inputs.versions }}]' >> $GITHUB_OUTPUT
55+ VERSION_SELECTORS =[${{ github.event.inputs.versions }}]
5656 echo "group=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]" >> $GITHUB_OUTPUT
5757 echo "total=12" >> $GITHUB_OUTPUT
5858 elif [ "${{ github.event_name }}" == "pull_request" ]; then
59- echo "version =[\"latest\"]" >> $GITHUB_OUTPUT
59+ VERSION_SELECTORS =[\"latest\"]
6060 echo "group=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]" >> $GITHUB_OUTPUT
6161 echo "total=12" >> $GITHUB_OUTPUT
6262 else
63- echo "version =[\"canary \",\"latest \",\"13.5.1\"]" >> $GITHUB_OUTPUT
63+ VERSION_SELECTORS =[\"latest \",\"canary \",\"13.5.1\"]
6464 echo "group=[1, 2, 3, 4]" >> $GITHUB_OUTPUT
6565 echo "total=4" >> $GITHUB_OUTPUT
6666 fi
67+
68+ VERSION_SPEC="["
69+ for QUOTED_SELECTOR in $(echo $VERSION_SELECTORS | jq -c '.[]'); do
70+ SELECTOR=$(echo $QUOTED_SELECTOR | xargs)
71+ if [ "${VERSION_SPEC}" != "[" ]; then
72+ VERSION_SPEC+=","
73+ fi
74+ VERSION_SPEC+="{\"selector\":\"$SELECTOR\""
75+
76+ if [ "$SELECTOR" == "latest" ]; then
77+ VERSION_SPEC+=",\"tag\":\"$(curl -s https://api.github.com/repos/vercel/next.js/releases/latest | jq -r .tag_name)\""
78+ elif [ "$SELECTOR" == "canary" ]; then
79+ VERSION_SPEC+=",\"tag\":\"$(curl -s https://api.github.com/repos/vercel/next.js/releases | jq -r '.[] | select(.prerelease == true) | .tag_name' | head -n 1)\""
80+ else
81+ VERSION_SPEC+=",\"tag\":\"v$SELECTOR\""
82+ fi
83+
84+ VERSION_SPEC+=",\"version\":\"$(npm view next@$SELECTOR version)\""
85+
86+ VERSION_SPEC+="}"
87+ done
88+ VERSION_SPEC+="]"
89+ echo "version_spec=$VERSION_SPEC" >> $GITHUB_OUTPUT
90+
6791 e2e :
6892 needs : setup
6993 runs-on : ubuntu-latest
70- name : Test next@${{ matrix.version }} group ${{ matrix.group }}/${{ needs.setup.outputs.total }}
94+ name : Test next@${{ matrix.version_spec.selector }} group ${{ matrix.group }}/${{ needs.setup.outputs.total }}
7195 timeout-minutes : 120
7296 strategy :
7397 fail-fast : false
7498 matrix :
75- version : ${{ fromJson(needs.setup.outputs.version ) }}
99+ version_spec : ${{ fromJson(needs.setup.outputs.version_spec ) }}
76100 group : ${{ fromJson(needs.setup.outputs.group) }}
77101
78- outputs :
79- tag : ${{ steps.next-release.outputs.tag }}
80-
81102 steps :
82- - name : Get Latest Next.js Release
83- id : next-release
84- run : |
85- if [ "${{ matrix.version }}" == "latest" ]; then
86- LATEST_RELEASE_TAG=$(curl -s https://api.github.com/repos/vercel/next.js/releases/latest | jq -r .tag_name)
87- echo "Latest release tag is $LATEST_RELEASE_TAG"
88- echo "tag=$LATEST_RELEASE_TAG" >> $GITHUB_OUTPUT
89- echo "version=$(npm view next@latest version)" >> $GITHUB_OUTPUT
90- elif [ "${{ matrix.version }}" == "canary" ]; then
91- LATEST_CANARY_TAG=$(curl -s https://api.github.com/repos/vercel/next.js/releases | jq -r '.[] | select(.prerelease == true) | .tag_name' | head -n 1)
92- echo "Latest canary tag is $LATEST_CANARY_TAG"
93- echo "tag=$LATEST_CANARY_TAG" >> $GITHUB_OUTPUT
94- echo "version=$(npm view next@canary version)" >> $GITHUB_OUTPUT
95- else
96- echo "tag=v${{ matrix.version }}" >> $GITHUB_OUTPUT
97- echo "version=$(npm view next@${{ matrix.version }} version)" >> $GITHUB_OUTPUT
98- fi
99103 - name : checkout Next.js repo
100104 uses : actions/checkout@v4
101105 with :
102106 repository : ${{ env.NEXT_REPO }}
103107 path : ${{ env.next-path }}
104- ref : ${{ steps.next-release.outputs .tag }}
108+ ref : ${{ matrix.version_spec .tag }}
105109
106110 - name : checkout runtime repo
107111 uses : actions/checkout@v4
@@ -155,7 +159,7 @@ jobs:
155159 working-directory : ${{ env.next-path }}
156160
157161 - name : install swc
158- run : pnpm add --workspace-root @next/swc-linux-x64-gnu@${{ steps.next-release.outputs .version }}
162+ run : pnpm add --workspace-root @next/swc-linux-x64-gnu@${{ matrix.version_spec .version }}
159163 working-directory : ${{ env.next-path }}
160164
161165 - name : Install Deno
@@ -183,7 +187,7 @@ jobs:
183187 id : test-filters
184188 run : |
185189 # This is when the manifest version was changed
186- if [ `npx semver -p -r ">=14.0.4-canary.26" ${{ steps.next-release.outputs .version }}` ]; then
190+ if [ `npx semver -p -r ">=14.0.4-canary.26" ${{ matrix.version_spec .version }}` ]; then
187191 echo "filters=../next-runtime-minimal/tests/netlify-e2e.cjs" >> $GITHUB_OUTPUT
188192 echo "skip-retry=../next-runtime-minimal/tests/e2e-skip-retry.json" >> $GITHUB_OUTPUT
189193 else
@@ -203,10 +207,10 @@ jobs:
203207 if : success() || failure()
204208 uses : actions/upload-artifact@v4
205209 with :
206- name : test-result-${{matrix.version }}-${{ matrix.group }}
210+ name : test-result-${{matrix.version_spec.selector }}-${{ matrix.group }}
207211 path : ${{ env.next-path }}/test/test-junit-report/*.xml
208212 publish-test-results :
209- name : ' E2E Test Summary (${{matrix.version }})'
213+ name : ' E2E Test Summary (${{matrix.version_spec.selector }})'
210214 needs :
211215 - e2e
212216 - setup
@@ -218,7 +222,7 @@ jobs:
218222 if : success() || failure()
219223 strategy :
220224 matrix :
221- version : ${{ fromJson(needs.setup.outputs.version ) }}
225+ version_spec : ${{ fromJson(needs.setup.outputs.version_spec ) }}
222226
223227 steps :
224228 - name : checkout runtime repo
@@ -230,29 +234,29 @@ jobs:
230234 - name : Download Artifacts
231235 uses : actions/download-artifact@v4
232236 with :
233- pattern : test-result-${{matrix.version }}-*
237+ pattern : test-result-${{matrix.version_spec.selector }}-*
234238 path : artifacts
235239
236240 - name : Publish Test Report
237241 id : publish-test-results
238242 if : success() || failure()
239243 run : |
240244 echo "slackEvent<<NETLIFY_EOF" >> $GITHUB_OUTPUT
241- deno run -A tools/deno/junit2slack.ts --dir artifacts --version ${{matrix.version }} --runUrl ${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}} >> $GITHUB_OUTPUT
245+ deno run -A tools/deno/junit2slack.ts --dir artifacts --version ${{matrix.version_spec.selector }} --runUrl ${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}} >> $GITHUB_OUTPUT
242246 echo "NETLIFY_EOF" >> $GITHUB_OUTPUT
243- deno run -A tools/deno/junit2json.ts artifacts ${{ needs.e2e.outputs .tag }} > report/test-results.json
247+ deno run -A tools/deno/junit2json.ts artifacts ${{ matrix.version_spec .tag }} > report/test-results.json
244248 deno run -A tools/deno/generate-md.ts >> $GITHUB_STEP_SUMMARY
245249
246250 - name : Upload Test JSON
247251 uses : actions/upload-artifact@v4
248252 with :
249- name : ${{matrix.version }}-test-results.json
253+ name : ${{matrix.version_spec.selector }}-test-results.json
250254 path : report/test-results.json
251255 - name : Notify Slack
252- if : success() || failure()
256+ if : ${{ ( success() || failure()) && github.event_name == 'schedule' }}
253257 uses : slackapi/slack-github-action@v1.26.0
254258 env :
255259 SLACK_WEBHOOK_URL : ${{ secrets.SLACK_WEBHOOK_URL }}
256260 SLACK_WEBHOOK_TYPE : INCOMING_WEBHOOK
257261 with :
258- payload : ${{ steps.publish-test-results.outputs.slackEvent }}
262+ payload : ${{ steps.publish-test-results.outputs.slackEvent }}
0 commit comments