-
Notifications
You must be signed in to change notification settings - Fork 1
149 lines (136 loc) · 4.59 KB
/
playwright.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: Playwright Tests
on:
workflow_call:
inputs:
repository:
default: Kingstinct/schedulist-app
description: The repository where the tests are
required: false
type: string
PLAYWRIGHT_TEST_URL:
default: https://master.schedulist-app.pages.dev/
type: string
required: false
package_manager:
required: false
type: string
default: yarn
description: The package manager to use
pnpm_version:
required: false
type: string
default: "8"
description: If using pnpm - which version to use
shard_count:
required: false
type: number
default: 1
description: Number of shards to split the tests into
shard_index:
required: false
type: number
description: Which shard is this, starting from 1
env_file:
required: false
type: string
description: The .env file to use
working_directory:
required: false
type: string
default: .
description: The working directory to run the tests in
secrets:
GITHUB_PAT:
required: false
description: Personal access token to access the repo with tests
SLACK_WEBHOOK:
description: The Slack Webhook to use for notifications
required: false
DISCORD_WEBHOOK:
description: The Discord Webhook to use for notifications
required: false
workflow_dispatch:
inputs:
PLAYWRIGHT_TEST_URL:
description: URL to run playwright tests towards
default: https://master.schedulist-app.pages.dev/
type: string
required: false
repository:
default: Kingstinct/schedulist-app
description: The repository where the tests are
required: false
type: string
package_manager:
required: false
type: string
default: yarn
description: The package manager to use
pnpm_version:
required: false
type: string
default: "8"
description: If using pnpm - which version to use
working_directory:
required: false
type: string
default: .
description: The working directory to run the tests in
jobs:
e2e:
timeout-minutes: 20
runs-on: ubuntu-latest
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
npx: ${{ inputs.package_manager == 'bun' && 'bunx' || 'npx' }}
steps:
- uses: actions/checkout@v4
with:
repository: ${{ inputs.repository }}
token: ${{ secrets.GITHUB_PAT }}
- uses: cardinalby/export-env-action@v2
if: ${{ inputs.env_file }}
with:
envFile: ${{ inputs.env_file }}
- uses: oven-sh/setup-bun@v2
if: ${{ inputs.package_manager == 'bun' }}
with:
bun-version: ${{ inputs.bun-version || env.BUN_VERSION }}
- uses: pnpm/action-setup@v3
if: ${{ inputs.package_manager == 'pnpm' }}
with:
version: ${{ inputs.pnpm_version }}
- uses: actions/setup-node@v4
if: ${{ inputs.package_manager == 'node' }}
with:
node-version-file: .nvmrc
cache: ${{ inputs.package_manager }}
- name: Install dependencies (npm)
run: npm ci
if: ${{ inputs.package_manager == 'npm' }}
working-directory: ${{ inputs.working_directory }}
- name: Install dependencies (others)
run: ${{ inputs.package_manager }} install --frozen-lockfile
if: ${{ inputs.package_manager != 'npm' }}
working-directory: ${{ inputs.working_directory }}
- name: Install Playwright Browsers
run: ${{ env.npx }} playwright install --with-deps
- name: Run Playwright tests
if: ${{ inputs.shard_count == 1 }}
run: PLAYWRIGHT_TEST_URL=${{ inputs.PLAYWRIGHT_TEST_URL }} ${{ env.npx }} playwright test
- name: Run Playwright tests sharded
if: ${{ inputs.shard_count > 1 }}
run: PLAYWRIGHT_TEST_URL=${{ inputs.PLAYWRIGHT_TEST_URL }} ${{ env.npx }} playwright test --shard=${{ inputs.shard_index }}/${{ inputs.shard_count }}
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
- uses: sarisia/actions-status-discord@v1
if: ${{ failure() && env.DISCORD_WEBHOOK }}
with:
webhook: ${{ env.DISCORD_WEBHOOK }}
- uses: rtCamp/action-slack-notify@v2
if: ${{ failure() && env.SLACK_WEBHOOK }}