-
-
Notifications
You must be signed in to change notification settings - Fork 112
230 lines (203 loc) · 6.93 KB
/
run-table-tests.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
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
225
226
227
228
229
230
name: run-table-tests
on: [push, pull_request]
jobs:
table-test:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: [8.4, 8.3, 8.2]
laravel: [11.0, 10.0]
db: [mysql, postgres, sqlite]
ssr: [true, false]
dependency-version: [prefer-lowest, prefer-stable]
include:
- laravel: 11.0
testbench: 9.*
- laravel: 10.0
testbench: 8.*
exclude:
- dependency-version: prefer-lowest
ssr: true
- php: 8.3
ssr: true
- php: 8.2
ssr: true
- laravel: 10.0
ssr: true
- db: mysql
ssr: true
- db: postgres
ssr: true
- php: 8.4
laravel: 10.0
name: Test P${{ matrix.php }} - L${{ matrix.laravel }} - DB ${{ matrix.db }} - SSR ${{ matrix.ssr }} - ${{ matrix.dependency-version }}
services:
mysql:
image: mysql:8.0
env:
MYSQL_ALLOW_EMPTY_PASSWORD: no
MYSQL_USER: protone_media_db_test
MYSQL_DATABASE: protone_media_db_test_mysql
MYSQL_PASSWORD: secret
MYSQL_ROOT_PASSWORD: secret
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
postgres:
image: postgres:15.0
env:
POSTGRES_USER: protone_media_db_test
POSTGRES_PASSWORD: secret
POSTGRES_DB: protone_media_db_test_postgres
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Cache node modules
id: cache-npm
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- if: ${{ steps.cache-npm.outputs.cache-hit == 'false' }}
name: List the state of node modules
continue-on-error: true
run: npm list
- name: "Install locked dependencies with npm"
run: |
npm ci --ignore-scripts
- name: Build package
run: |
npm run build
npm pack
rm -rf node_modules
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, mysql, mysqli, pdo_mysql
coverage: none
- name: Prepare environment file (MySQL)
if: ${{ matrix.db == 'mysql' }}
run: |
cd app
cp .env.example.mysql .env
- name: Prepare environment file (PostgreSQL)
if: ${{ matrix.db == 'postgres' }}
run: |
cd app
cp .env.example.postgres .env
- name: Prepare environment file (SQLite)
if: ${{ matrix.db == 'sqlite' }}
run: |
cd app
cp .env.example .env
touch database/database.sqlite
- name: Prepare demo app
run: |
cd app
npm upgrade
composer require laravel/framework:^${{ matrix.laravel }} --no-interaction --no-suggest
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
- name: Prepare tests
run: |
cd app
npm run build
php artisan dusk:chrome-driver --detect
- name: Start Chrome Driver
run: |
cd app
./vendor/laravel/dusk/bin/chromedriver-linux --port=9515 &
- name: Start SSR server
run: |
cd app
sed -i -e "s|SPLADE_SSR_ENABLED=false|SPLADE_SSR_ENABLED=true|g" .env
node bootstrap/ssr/ssr.mjs &
if: matrix.ssr == true
- name: Migrate DB and Run Laravel Server (MySQL)
run: |
cd app
php artisan storage:link
php artisan migrate:fresh --seed
php artisan serve &
if: ${{ matrix.db == 'mysql' }}
env:
DB_PORT: ${{ job.services.mysql.ports[3306] }}
- name: Migrate DB and Run Laravel Server (PostgreSQL)
run: |
cd app
php artisan storage:link
php artisan migrate:fresh --seed
php artisan serve &
if: ${{ matrix.db == 'postgres' }}
env:
DB_PORT: ${{ job.services.postgres.ports[5432] }}
- name: Migrate DB and Run Laravel Server (SQLite)
if: ${{ matrix.db == 'sqlite' }}
run: |
cd app
php artisan storage:link
php artisan migrate:fresh --seed
php artisan serve &
- name: Execute Dusk tests (only table tests - MySQL)
if: ${{ matrix.db == 'mysql' }}
uses: nick-invision/retry@v3
with:
timeout_minutes: 10
max_attempts: 3
command: cd app && php artisan dusk --stop-on-error --stop-on-failure --group=table
on_retry_command: cd app && php artisan migrate:fresh --seed
env:
DB_PORT: ${{ job.services.mysql.ports[3306] }}
- name: Execute Dusk tests (only table tests - PostgreSQL)
if: ${{ matrix.db == 'postgres' }}
uses: nick-invision/retry@v3
with:
timeout_minutes: 10
max_attempts: 3
command: cd app && php artisan dusk --stop-on-error --stop-on-failure --group=table
on_retry_command: cd app && php artisan migrate:fresh --seed
env:
DB_PORT: ${{ job.services.postgres.ports[5432] }}
- name: Execute Dusk tests (only table tests - SQLite)
if: ${{ matrix.db == 'sqlite' }}
uses: nick-invision/retry@v3
with:
timeout_minutes: 10
max_attempts: 3
command: cd app && php artisan dusk --stop-on-error --stop-on-failure --group=table
on_retry_command: cd app && php artisan migrate:fresh --seed
- name: Upload Screenshots
if: failure()
uses: actions/upload-artifact@v4
with:
name: screenshots
path: app/tests/Browser/screenshots
- name: Upload Snapshots
if: failure()
uses: actions/upload-artifact@v4
with:
name: snapshots
path: app/tests/Browser/__snapshots__
- name: Upload Console Logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: console
path: app/tests/Browser/console
- name: Upload Logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: logs
path: app/storage/logs