Skip to content

Commit 97cede7

Browse files
authored
Run tests across MySQL, Postgres and SQLite (#142)
1 parent 10e5af3 commit 97cede7

File tree

1 file changed

+120
-3
lines changed

1 file changed

+120
-3
lines changed

.github/workflows/run-tests.yml

Lines changed: 120 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,131 @@ jobs:
3333
- name: Run PHPStan
3434
run: vendor/bin/phpstan --error-format=github
3535

36-
test:
36+
mysql:
3737
runs-on: ubuntu-latest
38+
39+
services:
40+
mysql:
41+
image: mysql:8.0
42+
env:
43+
MYSQL_ROOT_PASSWORD: root
44+
MYSQL_DATABASE: cachet
45+
MYSQL_USER: cachet
46+
MYSQL_PASSWORD: password
47+
ports:
48+
- 3306:3306
49+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
50+
3851
strategy:
3952
fail-fast: false
4053
matrix:
4154
php: [8.3, 8.2]
4255
laravel: [11.x]
4356
stability: [prefer-lowest, prefer-stable]
4457

45-
name: Tests - P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }}
58+
name: Tests - P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - MySQL 8.0
59+
60+
steps:
61+
- name: Checkout code
62+
uses: actions/checkout@v4
63+
64+
- name: Setup PHP
65+
uses: shivammathur/setup-php@v2
66+
with:
67+
php-version: ${{ matrix.php }}
68+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
69+
coverage: none
70+
71+
- name: Install dependencies
72+
run: |
73+
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update
74+
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
75+
76+
- name: Install frontend dependencies
77+
run: npm ci
78+
79+
- name: Build assets
80+
run: npm run build
81+
82+
- name: Build tests environment
83+
run: composer build
84+
85+
- name: Execute tests
86+
run: composer test
87+
env:
88+
DB_CONNECTION: mysql
89+
DB_HOST: localhost
90+
DB_DATABASE: cachet
91+
DB_USERNAME: cachet
92+
DB_PASSWORD: password
93+
94+
postgres:
95+
runs-on: ubuntu-latest
96+
97+
services:
98+
postgres:
99+
image: postgres:13
100+
env:
101+
POSTGRES_DB: cachet
102+
POSTGRES_USER: cachet
103+
POSTGRES_PASSWORD: password
104+
ports:
105+
- 5432:5432
106+
options: --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3
107+
108+
strategy:
109+
fail-fast: false
110+
matrix:
111+
php: [ 8.3, 8.2 ]
112+
laravel: [ 11.x ]
113+
stability: [ prefer-lowest, prefer-stable ]
114+
115+
name: Tests - P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - PostgreSQL 13
116+
117+
steps:
118+
- name: Checkout code
119+
uses: actions/checkout@v4
120+
121+
- name: Setup PHP
122+
uses: shivammathur/setup-php@v2
123+
with:
124+
php-version: ${{ matrix.php }}
125+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
126+
coverage: none
127+
128+
- name: Install dependencies
129+
run: |
130+
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update
131+
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
132+
133+
- name: Install frontend dependencies
134+
run: npm ci
135+
136+
- name: Build assets
137+
run: npm run build
138+
139+
- name: Build tests environment
140+
run: composer build
141+
142+
- name: Execute tests
143+
run: composer test
144+
env:
145+
DB_CONNECTION: mysql
146+
DB_HOST: localhost
147+
DB_DATABASE: cachet
148+
DB_USERNAME: cachet
149+
DB_PASSWORD: password
150+
151+
sqlite:
152+
runs-on: ubuntu-latest
153+
strategy:
154+
fail-fast: false
155+
matrix:
156+
php: [ 8.3, 8.2 ]
157+
laravel: [ 11.x ]
158+
stability: [ prefer-lowest, prefer-stable ]
159+
160+
name: Tests - P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - SQLite
46161

47162
steps:
48163
- name: Checkout code
@@ -76,7 +191,9 @@ jobs:
76191
if: always()
77192
needs:
78193
- static-analysis
79-
- test
194+
- mysql
195+
- postgres
196+
- sqlite
80197
runs-on: ubuntu-latest
81198

82199
steps:

0 commit comments

Comments
 (0)