Deploy e2e test page #36
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Deploy e2e test page' | |
on: | |
schedule: | |
- cron: '0 6 * * 3' # Run every Wednesday at 6am UTC | |
workflow_dispatch: | |
inputs: | |
use-branch: | |
description: 'Enable if you want to test data from your selected branch instead of the scheduled test runs from Main' | |
type: boolean | |
version: | |
description: 'Version of Next.js (most recent test run must have included this version)' | |
type: choice | |
options: | |
- 'latest' | |
- 'canary' | |
- '13.5.1' | |
default: 'latest' | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ vars.E2E_PAGE_SITE_ID }} | |
GH_TOKEN: ${{ github.token }} | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get run id | |
id: get-run-id | |
run: | | |
if [ "${{ inputs.use-branch }}" == "true" ]; then | |
E2E_RUN_ID=$(gh run list -w test-e2e.yml -e workflow_dispatch -s success -b $GITHUB_REF_NAME --json databaseId --jq ".[0].databaseId" --repo $GITHUB_REPOSITORY) | |
else | |
E2E_RUN_ID=$(gh run list -w test-e2e.yml -e schedule -s success --json databaseId --jq ".[0].databaseId" --repo $GITHUB_REPOSITORY) | |
fi | |
echo "runId=$E2E_RUN_ID" >> $GITHUB_OUTPUT | |
- name: Download e2e results | |
if: ${{ steps.get-run-id.outputs.runId }} | |
run: | | |
version="${{ inputs.version }}" | |
version=${version:-latest} | |
OUTPUT_DIR="e2e-report/data" | |
OUTPUT_FILENAME="test-results.json" | |
echo "Downloading ${version} test results from run https://github.com/netlify/next-runtime/actions/runs/${{ steps.get-run-id.outputs.runId }}" | |
rm "${OUTPUT_DIR}/${OUTPUT_FILENAME}" | |
artifact_name="${version}-test-results.json" | |
# NOTE: The artifact name is not necessarily the artifact *file* name. The file name here | |
# must be `test-results.json`, but this is defined at the artifact upload step. | |
gh run download ${{ steps.get-run-id.outputs.runId }} -n "${artifact_name}" -D "${OUTPUT_DIR}" --repo $GITHUB_REPOSITORY | |
- name: Install site dependencies | |
if: success() | |
run: | | |
npm ci | |
working-directory: e2e-report | |
- name: Deploy e2e page | |
if: success() | |
run: | | |
ntl deploy --build --cwd e2e-report |