Skip to content

Commit e04e49f

Browse files
authored
Merge pull request #438 from os2display/feature/mariadb-10-and-11-matrix
feat: support MariaDB 10 and 11; default local to 11 LTS, matrix CI
2 parents c0f0586 + 14dae5f commit e04e49f

7 files changed

Lines changed: 68 additions & 10 deletions

File tree

.env

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,17 @@ TRUSTED_PROXIES=127.0.0.1,REMOTE_ADDR
3030
###< symfony/framework-bundle ###
3131

3232
###> doctrine/doctrine-bundle ###
33+
# Doctrine `serverVersion` for dialect selection — must match the running
34+
# MariaDB. Default tracks the docker-compose default (mariadb:11.4);
35+
# override MARIADB_VERSION (and the matching MARIADB_IMAGE in compose) to
36+
# test against 10.11.
37+
MARIADB_VERSION=11.4.4-MariaDB
3338
# Database connection string for MariaDB/MySQL.
3439
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
3540
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
3641
#
3742
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
38-
DATABASE_URL="mysql://db:db@mariadb:3306/db?serverVersion=10.11.5-MariaDB"
43+
DATABASE_URL="mysql://db:db@mariadb:3306/db?serverVersion=${MARIADB_VERSION}"
3944
#DATABASE_URL="postgresql://db_user:db_password@127.0.0.1:5432/db_name?serverVersion=13&charset=utf8"
4045
###< doctrine/doctrine-bundle ###
4146

.env.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ SYMFONY_DEPRECATIONS_HELPER=999999
55
PANTHER_APP_ENV=panther
66
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots
77

8-
DATABASE_URL="mysql://root:password@mariadb:3306/db_test?serverVersion=mariadb-10.5.13"
8+
DATABASE_URL="mysql://root:password@mariadb:3306/db_test?serverVersion=${MARIADB_VERSION}"
99

1010
###> lexik/jwt-authentication-bundle ###
1111
JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem

.github/workflows/doctrine.yaml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,20 @@ env:
1919
jobs:
2020
validate-doctrine-shema:
2121
runs-on: ubuntu-latest
22-
name: Validate Schema
22+
strategy:
23+
# Don't cancel the 11.x leg if 10.x fails (or vice versa); we want to
24+
# see version-specific failures rather than mask one with the other.
25+
fail-fast: false
26+
matrix:
27+
mariadb:
28+
- image: mariadb:10.11
29+
version: 10.11.13-MariaDB
30+
- image: mariadb:11.4
31+
version: 11.4.4-MariaDB
32+
name: Validate Schema (${{ matrix.mariadb.image }})
33+
env:
34+
MARIADB_IMAGE: ${{ matrix.mariadb.image }}
35+
MARIADB_VERSION: ${{ matrix.mariadb.version }}
2336
steps:
2437
- name: Checkout
2538
uses: actions/checkout@v6
@@ -38,7 +51,7 @@ jobs:
3851
run: docker compose run --rm -e APP_ENV=prod phpfpm composer install --no-dev -o
3952

4053
- name: Run Doctrine Migrations
41-
run: docker compose run --rm -e APP_ENV=prod phpfpm bin/console doctrine:migrations:migrate --no-interaction
54+
run: docker compose run --rm -e APP_ENV=prod -e MARIADB_VERSION phpfpm bin/console doctrine:migrations:migrate --no-interaction
4255

4356
- name: Validate Doctrine schema
44-
run: docker compose run --rm -e APP_ENV=prod phpfpm bin/console doctrine:schema:validate
57+
run: docker compose run --rm -e APP_ENV=prod -e MARIADB_VERSION phpfpm bin/console doctrine:schema:validate

.github/workflows/phpunit.yaml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,23 @@ env:
1919
jobs:
2020
phpunit:
2121
runs-on: ubuntu-latest
22-
name: PHP Unit tests
22+
strategy:
23+
# Don't cancel the 11.x leg if 10.x fails (or vice versa); we want to
24+
# see version-specific failures rather than mask one with the other.
25+
fail-fast: false
26+
matrix:
27+
mariadb:
28+
- image: mariadb:10.11
29+
version: 10.11.13-MariaDB
30+
- image: mariadb:11.4
31+
version: 11.4.4-MariaDB
32+
name: PHP Unit tests (${{ matrix.mariadb.image }})
33+
env:
34+
# Picked up by docker-compose.yml's `image: ${MARIADB_IMAGE:-…}`.
35+
MARIADB_IMAGE: ${{ matrix.mariadb.image }}
36+
# Forwarded into phpfpm via `-e MARIADB_VERSION` below; .env then
37+
# interpolates it into Doctrine's `serverVersion` URL parameter.
38+
MARIADB_VERSION: ${{ matrix.mariadb.version }}
2339
steps:
2440
- name: Checkout
2541
uses: actions/checkout@v6
@@ -38,7 +54,7 @@ jobs:
3854
run: docker compose run --rm phpfpm composer install
3955

4056
- name: PHP Unit - Test setup
41-
run: docker compose run --rm phpfpm composer run test-setup
57+
run: docker compose run --rm -e MARIADB_VERSION phpfpm composer run test-setup
4258

4359
- name: PHP Unit - Run tests
44-
run: docker compose run --rm phpfpm composer run test
60+
run: docker compose run --rm -e MARIADB_VERSION phpfpm composer run test

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ All notable changes to this project will be documented in this file.
1616
`SESSION_HANDLER_DSN=` empty to fall back to PHP's native file handler. Removes the per-session
1717
`flock` that serialised parallel session-touching requests and lets sessions survive container
1818
restarts; multi-pod deployments now share session state without sticky routing.
19+
- Switched local dev MariaDB to upstream `mariadb:11.4` LTS (was `itkdev/mariadb:latest`); both 10.11
20+
and 11.4 LTS are now exercised by a CI matrix in the PHPUnit and Doctrine schema-validate workflows.
21+
`MARIADB_IMAGE` and `MARIADB_VERSION` env vars override the compose image and Doctrine
22+
`serverVersion`. Drops the previously-commented `ENCRYPT=1` toggle inherited from the itkdev wrapper.
1923

2024
## [3.0.0-rc2] - 2026-05-05
2125

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,22 @@ The fixtures have an editor user: <editor@example.com> with the password: "apass
145145

146146
The fixtures have the image-text template, and two screen layouts: "full screen" and "two boxes".
147147

148+
### Database (MariaDB)
149+
150+
Local dev defaults to `mariadb:11.4` (LTS until May 2029). CI also exercises `mariadb:10.11` (LTS until
151+
Feb 2028) via a matrix in `phpunit.yaml` and `doctrine.yaml`. Two env vars control the version:
152+
153+
- `MARIADB_IMAGE` — the docker image used by the `mariadb` compose service.
154+
- `MARIADB_VERSION` — the Doctrine `serverVersion` interpolated into `DATABASE_URL` in `.env` /
155+
`.env.test`. Must match the running server, or Doctrine will emit dialect-incompatible SQL.
156+
157+
To run the local stack against 10.11:
158+
159+
```shell
160+
docker compose down -v
161+
MARIADB_IMAGE=mariadb:10.11 MARIADB_VERSION=10.11.13-MariaDB docker compose up -d
162+
```
163+
148164
## Production setup
149165

150166
A JWT Auth keypair should be generated. See [JWT Auth](#jwt-auth).

docker-compose.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ networks:
88

99
services:
1010
mariadb:
11-
image: itkdev/mariadb:latest
11+
# 11.4 is MariaDB's LTS series (supported until May 2029); 10.11 (LTS
12+
# until Feb 2028) is also tested in CI via the matrix in
13+
# .github/workflows/{phpunit,doctrine}.yaml. Override MARIADB_IMAGE
14+
# locally to test against 10.11; remember to set MARIADB_VERSION to
15+
# match (Doctrine uses it for dialect detection — see .env).
16+
image: ${MARIADB_IMAGE:-mariadb:11.4}
1217
networks:
1318
- app
1419
ports:
@@ -24,7 +29,6 @@ services:
2429
- MYSQL_USER=db
2530
- MYSQL_PASSWORD=db
2631
- MYSQL_DATABASE=db
27-
#- ENCRYPT=1 # Uncomment to enable database encryption.
2832

2933
phpfpm:
3034
image: itkdev/php8.4-fpm:latest

0 commit comments

Comments
 (0)