Skip to content

Commit ba96c4f

Browse files
serhalppieh
andauthored
ci(e2e-report): support version other than latest (#2540)
This replaces the hardcoded Next.js "latest" version with an optional selector input. While I was at it, I clarified some confusing aspects of this setup. It's tripped up multiple people already. Co-authored-by: Michal Piechowiak <[email protected]>
1 parent 167d6bc commit ba96c4f

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

Diff for: .github/workflows/e2e-report.yml

+19-4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ on:
77
use-branch:
88
description: 'Enable if you want to test data from your selected branch instead of the scheduled test runs from Main'
99
type: boolean
10+
version:
11+
description: 'Version of Next.js (most recent test run must have included this version)'
12+
type: choice
13+
options:
14+
- 'latest'
15+
- 'canary'
16+
- '13.5.1'
17+
default: 'latest'
1018

1119
env:
1220
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
@@ -27,12 +35,19 @@ jobs:
2735
E2E_RUN_ID=$(gh run list -w test-e2e.yml -e schedule -s success --json databaseId --jq ".[0].databaseId" --repo $GITHUB_REPOSITORY)
2836
fi
2937
echo "runId=$E2E_RUN_ID" >> $GITHUB_OUTPUT
30-
- name: Download latest e2e results
38+
- name: Download e2e results
3139
if: ${{ steps.get-run-id.outputs.runId }}
3240
run: |
33-
echo "Downloading latest test results from run https://github.com/netlify/next-runtime/actions/runs/${{ steps.get-run-id.outputs.runId }}"
34-
rm e2e-report/data/test-results.json
35-
gh run download ${{ steps.get-run-id.outputs.runId }} -n "latest-test-results.json" -D e2e-report/data/ --repo $GITHUB_REPOSITORY
41+
version="${{ inputs.version }}"
42+
version=${version:-latest}
43+
OUTPUT_DIR="e2e-report/data"
44+
OUTPUT_FILENAME="test-results.json"
45+
echo "Downloading ${version} test results from run https://github.com/netlify/next-runtime/actions/runs/${{ steps.get-run-id.outputs.runId }}"
46+
rm "${OUTPUT_DIR}/${OUTPUT_FILENAME}"
47+
artifact_name="${version}-test-results.json"
48+
# NOTE: The artifact name is not necessarily the artifact *file* name. The file name here
49+
# must be `test-results.json`, but this is defined at the artifact upload step.
50+
gh run download ${{ steps.get-run-id.outputs.runId }} -n "${artifact_name}" -D "${OUTPUT_DIR}" --repo $GITHUB_REPOSITORY
3651
- name: Install site dependencies
3752
if: success()
3853
run: |

Diff for: .github/workflows/test-e2e.yml

+3
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,9 @@ jobs:
259259
- name: Upload Test JSON
260260
uses: actions/upload-artifact@v4
261261
with:
262+
# TODO(serhalp) Consider renaming this. It's misleading, since it's just an identifier,
263+
# but it's formatted like a filename, and happens to be almost - but not quite - the
264+
# actual filename.
262265
name: ${{matrix.version_spec.selector}}-test-results.json
263266
path: report/test-results.json
264267

0 commit comments

Comments
 (0)