Skip to content

Next 2.0 version configuration improvements #446

Next 2.0 version configuration improvements

Next 2.0 version configuration improvements #446

name: "Continuous Integration"
on:
pull_request:
paths:
- .github/workflows/continuous-integration.yml
- composer.*
- phpunit.xml.dist
- src/**
- tests/**
push:
branches:
- "main"
paths:
- .github/workflows/continuous-integration.yml
- composer.*
- phpunit.xml.dist
- src/**
- tests/**
jobs:
phpunit-smoke-tests:
name: "PHPUnit with PHP version matrix"
runs-on: ubuntu-latest
container:
image: simonmellerin/db-tools-bundle-ci:main
strategy:
matrix:
php-version:
- "8.1"
- "8.2"
- "8.3"
postgres-version:
- "16"
extension:
- "pdo_pgsql"
dependencies:
- "lowest"
- "highest"
services:
postgres:
image: "postgres:${{ matrix.postgres-version }}"
env:
POSTGRES_PASSWORD: "postgres"
options: >-
--health-cmd "pg_isready"
ports:
- "5432:5432"
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
with:
fetch-depth: 2
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
extensions: "pgsql pdo_pgsql"
ini-values: "zend.assertions=1"
- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"
with:
dependency-versions: "${{ matrix.dependencies }}"
composer-options: "--ignore-platform-req=php+"
- name: "Run PHPUnit"
env:
DBAL_DRIVER: "${{ matrix.extension }}"
DBAL_DBNAME: "test_db"
DBAL_HOST: "postgres"
DBAL_PASSWORD: "postgres"
DBAL_PORT: "5432"
DBAL_ROOT_PASSWORD: "postgres"
DBAL_ROOT_USER: "postgres"
DBAL_USER: "postgres"
DATABASE_URL: "postgresql://postgres:postgres@postgres:5432/test_db?serverVersion=${{ matrix.postgres-version }}&charset=utf8"
run: "vendor/bin/phpunit"
phpunit-postgres:
name: "PHPUnit with PostgreSQL"
runs-on: ubuntu-latest
container:
image: simonmellerin/db-tools-bundle-ci:main
needs: "phpunit-smoke-tests"
strategy:
matrix:
php-version:
- "8.1"
postgres-version:
- "10"
- "15"
- "16"
extension:
- "pgsql"
- "pdo_pgsql"
services:
postgres:
image: "postgres:${{ matrix.postgres-version }}"
env:
POSTGRES_PASSWORD: "postgres"
options: >-
--health-cmd "pg_isready"
ports:
- "5432:5432"
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
with:
fetch-depth: 2
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
extensions: "pgsql pdo_pgsql"
coverage: "pcov"
ini-values: "zend.assertions=1"
- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"
with:
composer-options: "--ignore-platform-req=php+"
- name: "Run PHPUnit"
env:
DBAL_DRIVER: "${{ matrix.extension }}"
DBAL_DBNAME: "test_db"
DBAL_HOST: "postgres"
DBAL_PASSWORD: "postgres"
DBAL_PORT: "5432"
DBAL_ROOT_PASSWORD: "postgres"
DBAL_ROOT_USER: "postgres"
DBAL_USER: "postgres"
DATABASE_URL: "postgresql://postgres:postgres@postgres:5432/test_db?serverVersion=${{ matrix.postgres-version }}&charset=utf8"
run: "vendor/bin/phpunit"
phpunit-mariadb:
name: "PHPUnit with MariaDB"
runs-on: ubuntu-latest
container:
image: simonmellerin/db-tools-bundle-ci:main
needs: "phpunit-smoke-tests"
strategy:
matrix:
php-version:
- "8.1"
mariadb-version:
- "10.11.6" # LTS (Feb 2028)
- "11.0.4" # STS (Jun 2024)
- "11.1.3" # STS (Aug 2024)
extension:
- "mysqli"
include:
- php-version: "8.1"
mariadb-version: "10.11.6"
extension: "pdo_mysql"
services:
mariadb:
image: "mariadb:${{ matrix.mariadb-version }}"
env:
MARIADB_ROOT_PASSWORD: "password"
MYSQL_DATABASE: "test_db"
options: >-
--health-cmd "mariadb-admin ping --silent || mysqladmin ping --silent"
ports:
- "3306:3306"
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
with:
fetch-depth: 2
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
ini-values: "zend.assertions=1"
extensions: "${{ matrix.extension }}"
- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"
with:
composer-options: "--ignore-platform-req=php+"
- name: "Run PHPUnit"
env:
DBAL_DRIVER: "${{ matrix.extension }}"
DBAL_DBNAME: "test_db"
DBAL_HOST: "mariadb"
DBAL_PASSWORD: "password"
DBAL_PORT: "3306"
DBAL_ROOT_PASSWORD: "password"
DBAL_ROOT_USER: "root"
DBAL_USER: "root"
DATABASE_URL: "mysql://root:password@mariadb:3306/test_db?serverVersion=mariadb-${{ matrix.mariadb-version }}"
run: "vendor/bin/phpunit"
phpunit-mysql:
name: "PHPUnit with MySQL"
runs-on: ubuntu-latest
container:
image: simonmellerin/db-tools-bundle-ci:main
needs: "phpunit-smoke-tests"
strategy:
matrix:
php-version:
- "8.1"
mysql-version:
- "5.7"
- "8.0"
- "8.2"
- "8.3"
extension:
- "mysqli"
- "pdo_mysql"
services:
mysql:
image: "mysql:${{ matrix.mysql-version }}"
options: >-
--health-cmd "mysqladmin ping --silent"
-e MYSQL_ROOT_PASSWORD=password
-e MYSQL_DATABASE=test_db
ports:
- "3306:3306"
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
with:
fetch-depth: 2
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
ini-values: "zend.assertions=1"
extensions: "${{ matrix.extension }}"
- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"
with:
composer-options: "--ignore-platform-req=php+"
- name: "Run PHPUnit"
env:
DBAL_DRIVER: "${{ matrix.extension }}"
DBAL_DBNAME: "test_db"
DBAL_HOST: "mysql"
DBAL_PASSWORD: "password"
DBAL_PORT: "3306"
DBAL_ROOT_PASSWORD: "password"
DBAL_ROOT_USER: "root"
DBAL_USER: "root"
DATABASE_URL: "mysql://root:password@mysql:3306/test_db"
run: "vendor/bin/phpunit"
phpunit-mssql:
name: "PHPUnit with SQL Server"
runs-on: ubuntu-latest
container:
image: simonmellerin/db-tools-bundle-ci:main
needs: "phpunit-smoke-tests"
strategy:
matrix:
php-version:
- "8.1"
mssql-version:
- "2019"
- "2022"
extension:
- "pdo_sqlsrv"
services:
mssql:
image: "mcr.microsoft.com/mssql/server:${{ matrix.mssql-version }}-latest"
env:
ACCEPT_EULA: "Y"
SA_PASSWORD: "P@ssword123"
options: >-
--health-cmd "echo quit | /opt/mssql-tools/bin/sqlcmd -S 127.0.0.1 -l 1 -U sa -P P@ssword123"
ports:
- "1433:1433"
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
with:
fetch-depth: 2
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
ini-values: "zend.assertions=1"
extensions: "${{ matrix.extension }}-5.10.0"
- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"
with:
composer-options: "--ignore-platform-req=php+"
- name: "Run PHPUnit"
env:
DBAL_DRIVER: "${{ matrix.extension }}"
DBAL_DBNAME: "test_db"
DBAL_HOST: "mssql"
DBAL_PASSWORD: "P@ssword123"
DBAL_PORT: "1433"
DBAL_ROOT_PASSWORD: "P@ssword123"
DBAL_ROOT_USER: "sa"
DBAL_USER: "sa"
DATABASE_URL: "mssql://sa:P%40ssword123@mssql:1433/test_db?serverVersion=2019&driverOptions[TrustServerCertificate]=true"
run: "vendor/bin/phpunit"
phpunit-sqlite:
name: "PHPUnit with SQLite"
runs-on: ubuntu-latest
container:
image: simonmellerin/db-tools-bundle-ci:main
needs: "phpunit-smoke-tests"
strategy:
matrix:
os:
- "ubuntu-22.04"
php-version:
- "8.1"
extension:
- "pdo_sqlite"
- "sqlite3"
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
with:
fetch-depth: 2
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
extensions: "${{ matrix.extension }}"
ini-values: "zend.assertions=1"
- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"
with:
composer-options: "--ignore-platform-req=php+"
- name: "Run PHPUnit"
env:
DBAL_DRIVER: "${{ matrix.extension }}"
DBAL_DBNAME: "test_db"
DBAL_HOST: "127.0.0.1"
DBAL_PATH: "test_db.sqlite"
DATABASE_URL: "sqlite:///test_db.sqlite"
run: "vendor/bin/phpunit"