-
Notifications
You must be signed in to change notification settings - Fork 17
224 lines (205 loc) · 7.09 KB
/
e2e.yml
File metadata and controls
224 lines (205 loc) · 7.09 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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
name: E2E
on:
pull_request:
branches:
- main
workflow_dispatch:
jobs:
changes:
permissions:
pull-requests: read
runs-on: ubuntu-latest
outputs:
e2e: ${{ steps.filter.outputs.e2e || steps.manual.outputs.e2e }}
steps:
- name: Determine changed paths
if: github.event_name == 'pull_request'
id: filter
uses: dorny/paths-filter@v3
with:
filters: |
e2e:
- '.github/workflows/e2e.yml'
- '.github/workflows/tern.conf'
- 'Cargo.lock'
- 'Cargo.toml'
- 'database/**'
- 'docs/**'
- 'ocg-server/**'
- 'tests/e2e/**'
- name: Mark manual run as e2e-relevant
if: github.event_name == 'workflow_dispatch'
id: manual
run: echo "e2e=true" >> "$GITHUB_OUTPUT"
e2e-tests:
name: ${{ matrix.suite }}
needs: changes
if: github.event_name == 'workflow_dispatch' || needs.changes.outputs.e2e == 'true'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- suite: Smoke
command: npx playwright test --config playwright.config.js --project=chromium-smoke --project=firefox-smoke --project=webkit-smoke
artifact_name: playwright-artifacts-smoke
- suite: Functional
command: npx playwright test --config playwright.config.js --project=chromium-deep --project=chromium-mobile-deep
artifact_name: playwright-artifacts-deep
- suite: Visual
command: npx playwright test --config playwright.config.js --grep @visual --project=chromium-deep --project=chromium-mobile-deep
artifact_name: playwright-artifacts-visual
permissions:
contents: read
services:
postgres:
image: postgis/postgis:17-3.5
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: ocg_tests_e2e
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres -d ocg_tests_e2e"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
OCG_DB_HOST: 127.0.0.1
OCG_DB_NAME_TESTS_E2E: ocg_tests_e2e
OCG_DB_PASSWORD: postgres
OCG_E2E_BASE_URL: http://127.0.0.1:9001
OCG_E2E_MEETINGS_ENABLED: "true"
OCG_E2E_PAYMENTS_ENABLED: "true"
OCG_PG_BIN: /usr/bin
PGPASSWORD: postgres
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.95.0
- name: Cache Cargo dependencies
uses: actions/cache@v5
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Set up Node.js
uses: actions/setup-node@v5
with:
node-version: "22"
- name: Install Node.js dependencies
working-directory: tests/e2e
run: npm ci
- name: Install Playwright browsers
working-directory: tests/e2e
run: npx playwright install --with-deps
- name: Install Tailwind CSS
run: |
curl -sL https://github.com/tailwindlabs/tailwindcss/releases/download/v4.1.10/tailwindcss-linux-x64 -o tailwindcss
chmod +x tailwindcss
sudo mv tailwindcss /usr/local/bin/tailwindcss
- name: Install tern
run: |
curl -sL https://github.com/jackc/tern/releases/download/v2.3.2/tern_2.3.2_linux_amd64.tar.gz -o tern.tar.gz
tar -xzf tern.tar.gz
sudo mv tern /usr/local/bin/tern
- name: Create e2e tern config
run: |
cat <<EOF >/tmp/ocg-tern-e2e.conf
[database]
host = 127.0.0.1
port = 5432
database = ocg_tests_e2e
user = postgres
password = postgres
EOF
- name: Recreate and migrate e2e database
working-directory: database/migrations
run: |
dropdb -h 127.0.0.1 -p 5432 -U postgres --if-exists --force ocg_tests_e2e
createdb -h 127.0.0.1 -p 5432 -U postgres ocg_tests_e2e
psql -h 127.0.0.1 -p 5432 -U postgres ocg_tests_e2e -c "CREATE EXTENSION IF NOT EXISTS pgcrypto"
psql -h 127.0.0.1 -p 5432 -U postgres ocg_tests_e2e -c "CREATE EXTENSION IF NOT EXISTS postgis"
TERN_CONF=/tmp/ocg-tern-e2e.conf ./migrate.sh
- name: Load e2e seed data
run: |
psql -h 127.0.0.1 -p 5432 -U postgres ocg_tests_e2e -f database/tests/data/e2e.sql
psql -h 127.0.0.1 -p 5432 -U postgres ocg_tests_e2e -c "update \"user\" set password = '\$argon2id\$v=19\$m=19456,t=2,p=1\$q55jlxUx8bffhFM3xN36ZA\$te6OiWkZ/q35lpSEAZbd/A3iJyCByxbive9F61sTp7g' where username like 'e2e-%'"
- name: Create e2e server config
run: |
cat <<EOF >/tmp/ocg-e2e.yml
db:
host: 127.0.0.1
port: 5432
dbname: ocg_tests_e2e
user: postgres
password: "postgres"
email:
from_address: noreply@test.com
from_name: Test
smtp:
host: localhost
port: 1025
username: ""
password: ""
images:
provider: db
payments:
provider: stripe
mode: test
publishable_key: pk_test_e2e
secret_key: sk_test_e2e
webhook_secret: whsec_e2e
meetings:
zoom:
account_id: account-id
client_id: client-id
client_secret: client-secret
enabled: true
host_pool_users:
- host@example.com
max_participants: 100
max_simultaneous_meetings_per_host: 1
webhook_secret_token: whsec_zoom_e2e
server:
addr: 127.0.0.1:9001
base_url: http://127.0.0.1:9001
cookie:
secure: false
disable_referer_checks: false
login:
email: true
github: false
linuxfoundation: false
oauth2: {}
oidc: {}
EOF
- name: Build e2e server binary
run: cargo build --bin ocg-server
- name: Start server and wait for it to be ready
uses: JarvusInnovations/background-action@v1
with:
run: ./target/debug/ocg-server -c /tmp/ocg-e2e.yml &
wait-on: http://127.0.0.1:9001
tail: true
log-output: "stdout,stderr"
log-output-if: true
- name: Run Playwright ${{ matrix.suite }} suite
working-directory: tests/e2e
run: ${{ matrix.command }}
- name: Upload Playwright artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: |
tests/e2e/playwright-report/
tests/e2e/test-results/