Skip to content

Commit 5c8841e

Browse files
authored
Add CI workflow
Configure GitHub Actions for automated testing
1 parent 8b35c55 commit 5c8841e

File tree

1 file changed

+40
-3
lines changed

1 file changed

+40
-3
lines changed

.github/workflows/symfony.yml

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,41 @@ jobs:
1313
tests:
1414
runs-on: ubuntu-latest
1515

16+
services:
17+
postgres:
18+
image: postgres:15
19+
env:
20+
POSTGRES_PASSWORD: postgres
21+
POSTGRES_DB: test_db
22+
options: >-
23+
--health-cmd pg_isready
24+
--health-interval 10s
25+
--health-timeout 5s
26+
--health-retries 5
27+
ports:
28+
- 5432:5432
29+
30+
mysql:
31+
image: mysql:8.0
32+
env:
33+
MYSQL_ROOT_PASSWORD: root
34+
MYSQL_DATABASE: test_db
35+
options: >-
36+
--health-cmd="mysqladmin ping"
37+
--health-interval=10s
38+
--health-timeout=5s
39+
--health-retries=3
40+
ports:
41+
- 3306:3306
42+
1643
strategy:
1744
fail-fast: false
1845
matrix:
19-
php-version: ['8.1', '8.2', '8.3']
46+
php-version: ['8.2', '8.3', '8.4']
2047
symfony-version: ['6.4', '7.0']
48+
database: ['mysql', 'postgres']
2149

22-
name: PHP ${{ matrix.php-version }} - Symfony ${{ matrix.symfony-version }}
50+
name: PHP ${{ matrix.php-version }} - Symfony ${{ matrix.symfony-version }} - ${{ matrix.database }}
2351

2452
steps:
2553
- uses: actions/checkout@v4
@@ -47,5 +75,14 @@ jobs:
4775
- name: Run PHPStan
4876
run: composer phpstan
4977

50-
- name: Run PHPUnit tests
78+
- name: Run PHPUnit tests (PostgreSQL)
79+
if: matrix.database == 'postgres'
80+
env:
81+
DATABASE_URL: postgresql://postgres:postgres@127.0.0.1:5432/test_db?serverVersion=15&charset=utf8
82+
run: composer test
83+
84+
- name: Run PHPUnit tests (MySQL)
85+
if: matrix.database == 'mysql'
86+
env:
87+
DATABASE_URL: mysql://root:root@127.0.0.1:3306/test_db?serverVersion=8.0
5188
run: composer test

0 commit comments

Comments
 (0)