-
Notifications
You must be signed in to change notification settings - Fork 7
74 lines (72 loc) · 2.6 KB
/
netlify-e2e.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Netlify E2E
on:
pull_request:
branches: [ main ]
workflow_dispatch:
inputs:
deploymentUrl:
description: 'Deployment URL to test with:'
required: true
prNumber:
description: 'Pull request number (optional):'
required: false
shouldUpdateBaseline:
description: 'Should the baseline be updated to reflect updates to the UI?'
required: false
default: "false"
jobs:
check_config:
runs-on: ubuntu-latest
outputs:
proceed: ${{ steps.should_run.outputs.proceed }}
site_name: ${{ steps.should_run.outputs.site_name }}
steps:
- uses: actions/checkout@v3
- name: Preliminary checks
id: should_run
env:
DEPLOYMENT_URL: ${{ github.event.inputs.deploymentUrl }}
DEPLOYMENT_STATUS: ${{ github.event.deployment_status.state }}
TARGET_URL: ${{ github.event.deployment_status.target_url }}
run: |
SITE_NAME=$(jq -r '.netlifySiteName // empty' ci.config.json)
if [[ -n "$DEPLOYMENT_URL" || -n "$SITE_NAME" ]]; then
echo "proceed=true" >> $GITHUB_OUTPUT
else
echo "proceed=false" >> $GITHUB_OUTPUT
fi
echo site_name="$SITE_NAME" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
netlify-e2e:
needs: check_config
if: needs.check_config.outputs.proceed == 'true'
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
cache: 'npm'
- name: Install dependencies
run: npm install
- uses: ./.github/actions/setup-playwright
- name: Waiting for 200 from the Netlify Preview
if: ${{ !github.event.inputs.deploymentUrl }}
uses: jakepartusch/[email protected]
id: waitFor200
with:
site_name: ${{ needs.check_config.outputs.site_name }}
max_timeout: 120 # 2 Minutes, depends on your build pipeline duration
- name: Set Run with URL
run: |
echo "DEPLOYMENT_URL=${{ github.event.inputs.deploymentUrl || steps.waitFor200.outputs.url }}" >> $GITHUB_ENV
- uses: ./.github/actions/run-playwright
id: runPlaywright
with:
provider: 'netlify'
githubToken: ${{ secrets.GITHUB_TOKEN }}
prNumber: ${{ github.event.inputs.prNumber || github.event.pull_request.number }}
provider-deployment-url: ${{ env.DEPLOYMENT_URL }}
shouldUpdateBaseline: ${{ github.event.inputs.shouldUpdateBaseline }}
actor: ${{ github.actor }}