-
-
Notifications
You must be signed in to change notification settings - Fork 653
156 lines (135 loc) · 4.95 KB
/
Copy pathe2e.yml
File metadata and controls
156 lines (135 loc) · 4.95 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
name: Run E2E Tests
on:
pull_request:
paths:
- "frontend/**"
- "backend/**"
- ".github/workflows/e2e.yml"
- ".github/scripts/**"
- pyproject.toml
- uv.lock
push:
branches:
- "master"
paths:
- "frontend/**"
- "backend/**"
- ".github/workflows/e2e.yml"
- ".github/scripts/**"
- pyproject.toml
- uv.lock
permissions: read-all
jobs:
e2e:
runs-on: ubuntu-latest
services:
mariadb:
image: mariadb:10.11
ports:
- 3306
env:
MYSQL_USER: romm_e2e
MYSQL_PASSWORD: passwd
MYSQL_DATABASE: romm_e2e
MYSQL_ROOT_PASSWORD: passwd
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
valkey:
image: valkey/valkey:7.2
ports:
- 6379
options: >-
--health-cmd="redis-cli ping" --health-interval=5s --health-timeout=2s --health-retries=3
env:
DEV_PORT: 5000
DB_HOST: 127.0.0.1
DB_NAME: romm_e2e
DB_USER: romm_e2e
DB_PASSWD: passwd
ROMM_DB_DRIVER: mariadb
REDIS_HOST: 127.0.0.1
# Throwaway signing key for an ephemeral runner
ROMM_AUTH_SECRET_KEY: "e2e0000000000000000000000000000000000000000000000000000000000000"
# Fixture-user password, shared by the seeder and the specs
E2E_PASSWORD: e2e-Passw0rd!
steps:
- name: Checkout repository
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
- name: Install mariadb connectors
run: |
sudo apt-get update
sudo apt-get install -y libmariadb3 libmariadb-dev
- name: Install uv
uses: astral-sh/setup-uv@b75a909f75acd358c2196fb9a5f1299a9a8868a4 # v6.7.0
- name: Install python
run: uv python install 3.13
# pyproject.toml lives at the repo root, so sync from there
- name: Install backend dependencies
run: uv sync
- name: Set up Node.js
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version-file: frontend/.nvmrc
cache: "npm"
cache-dependency-path: frontend/package-lock.json
- name: Install frontend dependencies
run: npm ci
working-directory: frontend
- name: Install Playwright browser
run: npx playwright install --with-deps chromium
working-directory: frontend
# ROMM_BASE_PATH must be writable (the app creates config/, resources/ and
# assets/ under it), so copy the fixture library out of the repo rather
# than scanning it in place.
- name: Stage the library fixture
run: |
mkdir -p "$RUNNER_TEMP/romm/resources" "$RUNNER_TEMP/romm/assets"
cp -R backend/romm_test/library "$RUNNER_TEMP/romm/library"
echo "ROMM_BASE_PATH=$RUNNER_TEMP/romm" >> "$GITHUB_ENV"
echo "DB_PORT=${{ job.services.mariadb.ports['3306'] }}" >> "$GITHUB_ENV"
echo "REDIS_PORT=${{ job.services.valkey.ports['6379'] }}" >> "$GITHUB_ENV"
# A migration failure is its own red step rather than a confusing server-start failure.
- name: Apply migrations
run: uv run alembic upgrade head
working-directory: backend
- name: Seed the library
run: uv run python .github/scripts/seed_e2e_library.py
# Seed user and clear the setup wizard
- name: Seed the e2e fixture users
run: uv run python .github/scripts/seed_e2e_users.py
- name: Start the backend
run: |
uv run main.py > "$RUNNER_TEMP/backend.log" 2>&1 &
echo "Waiting for the API to answer..."
for i in $(seq 1 60); do
if curl -sf "http://127.0.0.1:${DEV_PORT}/api/heartbeat" > /dev/null; then
echo "Backend up after ${i}s"
exit 0
fi
sleep 1
done
echo "Backend did not come up; last 100 log lines:"
tail -100 "$RUNNER_TEMP/backend.log"
exit 1
working-directory: backend
# Starts the Vite dev server and waits for port 3000.
- name: Run Playwright tests
run: npm run test:e2e
working-directory: frontend
- name: Upload Playwright report
if: failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: playwright-report
path: |
frontend/playwright-report/
frontend/test-results/
retention-days: 7
- name: Dump backend log
if: failure()
run: tail -200 "$RUNNER_TEMP/backend.log" || true
# `uv run` holds the uv cache lock for as long as it lives, so leaving the
# backend up makes setup-uv's post-job `uv cache prune` block until the
# runner kills cleanup after 5 minutes, failing an otherwise green job.
- name: Stop the backend
if: always()
run: pkill -f "main.py" || true