-
Notifications
You must be signed in to change notification settings - Fork 364
112 lines (90 loc) · 3.08 KB
/
Copy pathe2e-tests.yml
File metadata and controls
112 lines (90 loc) · 3.08 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
name: E2E Tests
on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- develop
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
permissions:
contents: read
jobs:
e2e:
runs-on: ubuntu-latest
services:
mariadb:
image: mirror.gcr.io/library/mariadb:11.4
env:
MARIADB_ROOT_PASSWORD: root
MARIADB_DATABASE: librebooking_test
ports:
- 3306:3306
options: >-
--health-cmd="mariadb-admin ping -h 127.0.0.1"
--health-interval=10s
--health-timeout=5s
--health-retries=5
steps:
- name: Checkout code
uses: actions/checkout@v6.0.3
- name: Set up PHP 8.5
uses: shivammathur/setup-php@v2
with:
php-version: '8.5'
extensions: intl, mysqli, pdo_mysql
- name: Install Composer dependencies
uses: ramsey/composer-install@v4
- name: Load database schema
run: mysql -h 127.0.0.1 -u root -proot librebooking_test < database_schema/create-schema.sql
- name: Apply database upgrades
run: php phing-tasks/UpgradeDbTask.php root root 127.0.0.1 librebooking_test database_schema
- name: Load base data
run: mysql -h 127.0.0.1 -u root -proot librebooking_test < database_schema/create-data.sql
- name: Load sample data
run: mysql -h 127.0.0.1 -u root -proot librebooking_test < database_schema/sample-data-utf8.sql
- name: Generate test config
env:
CI: 'true'
LB_TEST_DB_HOST: '127.0.0.1'
LB_TEST_DB_PORT: '3306'
LB_TEST_DB_NAME: 'librebooking_test'
LB_TEST_DB_USER: 'root'
LB_TEST_DB_PASSWORD: 'root'
LB_TEST_BASE_URL: 'http://localhost:8080'
run: php tests/Integration/create-test-config.php
- name: Create template cache directory
run: mkdir -p tpl_c
- name: Start PHP development server
run: php -S localhost:8080 -t Web &
- name: Wait for PHP server to be ready
run: |
for i in $(seq 1 15); do
STATUS=$(curl -s -o /dev/null -w '%{http_code}' http://localhost:8080/ || true)
if [ "$STATUS" != "000" ]; then
echo "Server ready (HTTP $STATUS)"
break
fi
echo "Waiting for server... ($i/15)"
sleep 1
done
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Install npm dependencies
run: npm ci
- name: Install Playwright browsers
run: npx playwright install chromium --with-deps
- name: Create Playwright auth directory
run: mkdir -p tests/playwright/.auth
- name: Run E2E tests
run: npx playwright test
- name: Upload Playwright report
uses: actions/upload-artifact@v4
if: failure()
with:
name: playwright-report
path: playwright-report/
retention-days: 7