-
Notifications
You must be signed in to change notification settings - Fork 2.2k
181 lines (153 loc) · 4.86 KB
/
ui-v2-e2e-tests.yml
File metadata and controls
181 lines (153 loc) · 4.86 KB
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
name: UI v2 E2E Tests
on:
pull_request:
paths:
- .github/workflows/ui-v2-e2e-tests.yml
- ui-v2/**
- src/prefect/server/**
push:
branches:
- main
permissions:
contents: read
# Limit concurrency by workflow/branch combination.
#
# For pull request builds, pushing additional changes to the
# branch will cancel prior in-progress and pending builds.
#
# For builds triggered on a branch push, additional changes
# will wait for prior builds to complete before starting.
#
# https://docs.github.com/en/actions/using-jobs/using-concurrency
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
e2e-tests:
name: E2E Tests (Shard ${{ matrix.shard }}/3)
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3]
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: prefect
POSTGRES_PASSWORD: prefect
POSTGRES_DB: prefect
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -U prefect -d prefect"
--health-interval=10s
--health-timeout=5s
--health-retries=10
steps:
- uses: actions/checkout@v6
- name: Set up uv and Python 3.12
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
python-version: "3.12"
cache-dependency-glob: "pyproject.toml"
- name: Install Prefect
run: uv sync --locked
- name: Start Prefect server
run: |
uv run prefect server start --analytics-off --host 0.0.0.0 > server.log 2>&1 &
echo "Server PID: $!"
env:
PREFECT_SERVER_DATABASE_CONNECTION_URL: "postgresql+asyncpg://prefect:prefect@localhost:5432/prefect"
- name: Wait for server health
run: uv run python scripts/wait-for-server.py
env:
PREFECT_API_URL: http://127.0.0.1:4200/api
- uses: actions/setup-node@v6
with:
node-version-file: "ui-v2/.nvmrc"
cache: "npm"
cache-dependency-path: "**/package-lock.json"
- name: Install UI dependencies
working-directory: ./ui-v2
run: npm ci
- name: Install Playwright browsers
working-directory: ./ui-v2
run: npx playwright install chromium
- name: Run Playwright tests
working-directory: ./ui-v2
run: npx playwright test --shard=${{ matrix.shard }}/3
env:
PREFECT_API_URL: http://127.0.0.1:4200/api
CI: true
- name: Upload Playwright report
uses: actions/upload-artifact@v7
if: failure()
with:
name: playwright-report-shard-${{ matrix.shard }}
path: ui-v2/playwright-report/
retention-days: 30
- name: Upload server logs
uses: actions/upload-artifact@v7
if: failure()
with:
name: server-log-shard-${{ matrix.shard }}
path: server.log
retention-days: 30
e2e-tests-auth:
name: E2E Tests (Auth Enabled)
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v6
- name: Set up uv and Python 3.12
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
python-version: "3.12"
cache-dependency-glob: "pyproject.toml"
- name: Install Prefect
run: uv sync --locked
- name: Start Prefect server
run: |
uv run prefect server start --analytics-off --host 0.0.0.0 > server.log 2>&1 &
echo "Server PID: $!"
env:
PREFECT_SERVER_API_AUTH_STRING: admin:secret
- uses: actions/setup-node@v6
with:
node-version-file: "ui-v2/.nvmrc"
cache: "npm"
cache-dependency-path: "**/package-lock.json"
- name: Install UI dependencies
working-directory: ./ui-v2
run: npm ci
- name: Install Playwright browsers
working-directory: ./ui-v2
run: npx playwright install chromium
- name: Wait for server health
run: uv run python scripts/wait-for-server.py
env:
PREFECT_API_URL: http://127.0.0.1:4200/api
- name: Run Playwright tests
working-directory: ./ui-v2
run: npx playwright test e2e/auth/
env:
PREFECT_API_URL: http://127.0.0.1:4200/api
CI: true
- name: Upload Playwright report
uses: actions/upload-artifact@v7
if: failure()
with:
name: playwright-report-auth
path: ui-v2/playwright-report/
retention-days: 30
- name: Upload server logs
uses: actions/upload-artifact@v7
if: failure()
with:
name: server-log-auth
path: server.log
retention-days: 30