Skip to content

Continuous Integration #8229

Continuous Integration

Continuous Integration #8229

name: "Continuous Integration"
on:
pull_request:
branches:
- "*.x"
paths:
- .github/workflows/continuous-integration.yml
- ci/**
- composer.*
- phpunit.xml.dist
- src/**
- tests/**
push:
branches:
- "*.x"
paths:
- .github/workflows/continuous-integration.yml
- ci/**
- composer.*
- phpunit.xml.dist
- src/**
- tests/**
schedule:
- cron: "42 3 * * *"
env:
fail-fast: true
jobs:
phpunit-smoke-check:
name: "PHPUnit with SQLite"
runs-on: "${{ matrix.os }}"
strategy:
matrix:
os:
- "ubuntu-22.04"
php-version:
- "8.1"
- "8.2"
- "8.3"
dependencies:
- "highest"
extension:
- "pdo_sqlite"
include:
- os: "ubuntu-20.04"
php-version: "8.1"
dependencies: "lowest"
extension: "pdo_sqlite"
- os: "ubuntu-22.04"
php-version: "8.1"
dependencies: "highest"
extension: "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 }}"
coverage: "pcov"
ini-values: "zend.assertions=1"
- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"
with:
composer-options: "--ignore-platform-req=php+"
dependency-versions: "${{ matrix.dependencies }}"
- name: "Print SQLite version"
run: >
php -r 'printf("Testing with libsqlite version %s\n", (new PDO("sqlite::memory:"))->query("select sqlite_version()")->fetch()[0]);'
if: "${{ matrix.extension == 'pdo_sqlite' }}"
- name: "Print SQLite version"
run: >
php -r 'printf("Testing with libsqlite version %s\n", SQLite3::version()["versionString"]);'
if: "${{ matrix.extension == 'sqlite3' }}"
- name: "Run PHPUnit"
run: "vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml --coverage-clover=coverage.xml"
- name: "Upload coverage file"
uses: "actions/upload-artifact@v4"
with:
name: "phpunit-${{ matrix.extension }}-${{ matrix.dependencies }}-${{ matrix.php-version }}.coverage"
path: "coverage.xml"
phpunit-oci8:
name: "PHPUnit on OCI8"
runs-on: "ubuntu-22.04"
needs: "phpunit-smoke-check"
strategy:
matrix:
php-version:
- "8.1"
- "8.2"
- "8.3"
oracle-version:
- "18"
- "21"
- "23"
services:
oracle:
image: gvenzl/oracle-${{ matrix.oracle-version < 23 && 'xe' || 'free' }}:${{ matrix.oracle-version }}
env:
ORACLE_PASSWORD: oracle
ports:
- "1521:1521"
options: >-
--health-cmd healthcheck.sh
--health-interval 20s
--health-timeout 10s
--health-retries 10
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: "oci8"
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"
run: "vendor/bin/phpunit -c ci/github/phpunit/oci8${{ matrix.oracle-version < 23 && '-21' || '' }}.xml --coverage-clover=coverage.xml"
- name: "Upload coverage file"
uses: "actions/upload-artifact@v4"
with:
name: "${{ github.job }}-${{ matrix.php-version }}-${{ matrix.oracle-version }}.coverage"
path: "coverage.xml"
phpunit-pdo-oci:
name: "PHPUnit on PDO_OCI"
runs-on: "ubuntu-22.04"
needs: "phpunit-smoke-check"
strategy:
matrix:
php-version:
- "8.1"
- "8.2"
- "8.3"
oracle-version:
- "18"
- "21"
- "23"
services:
oracle:
image: gvenzl/oracle-${{ matrix.oracle-version < 23 && 'xe' || 'free' }}:${{ matrix.oracle-version }}
env:
ORACLE_PASSWORD: oracle
ports:
- "1521:1521"
options: >-
--health-cmd healthcheck.sh
--health-interval 20s
--health-timeout 10s
--health-retries 10
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: "pdo_oci"
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"
run: "vendor/bin/phpunit -c ci/github/phpunit/pdo_oci${{ matrix.oracle-version < 23 && '-21' || '' }}.xml --coverage-clover=coverage.xml"
- name: "Upload coverage file"
uses: "actions/upload-artifact@v4"
with:
name: "${{ github.job }}-${{ matrix.php-version }}-${{ matrix.oracle-version }}.coverage"
path: "coverage.xml"
phpunit-postgres:
name: "PHPUnit with PostgreSQL"
runs-on: "ubuntu-22.04"
needs: "phpunit-smoke-check"
strategy:
matrix:
php-version:
- "8.1"
postgres-version:
- "10"
- "15"
- "16"
extension:
- "pgsql"
- "pdo_pgsql"
include:
- php-version: "8.2"
postgres-version: "16"
extension: "pgsql"
- php-version: "8.3"
postgres-version: "16"
extension: "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"
run: "vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml --coverage-clover=coverage.xml"
- name: "Upload coverage file"
uses: "actions/upload-artifact@v4"
with:
name: "${{ github.job }}-${{ matrix.postgres-version }}-${{ matrix.extension }}-${{ matrix.php-version }}.coverage"
path: "coverage.xml"
phpunit-mariadb:
name: "PHPUnit with MariaDB"
runs-on: "ubuntu-22.04"
needs: "phpunit-smoke-check"
strategy:
matrix:
php-version:
- "8.1"
mariadb-version:
# keep in sync with https://mariadb.org/about/#maintenance-policy
- "10.4" # Oldest version supported by DBAL, LTS (Jun 2024)
- "10.5" # LTS (Jun 2025)
- "10.6" # LTS (Jul 2026)
- "10.11" # LTS (Feb 2028)
- "11.0" # STS (Jun 2024)
- "11.1" # STS (Aug 2024)
- "11.2" # STS (Nov 2024)
- "11.3" # STS (Feb 2025)
extension:
- "mysqli"
- "pdo_mysql"
include:
- php-version: "8.2"
mariadb-version: "11.2"
extension: "mysqli"
- php-version: "8.3"
mariadb-version: "11.2"
extension: "pdo_mysql"
services:
mariadb:
image: "mariadb:${{ matrix.mariadb-version }}"
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: "doctrine_tests"
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 }}"
coverage: "pcov"
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"
run: "vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml --coverage-clover=coverage.xml"
- name: "Upload coverage file"
uses: "actions/upload-artifact@v4"
with:
name: "${{ github.job }}-${{ matrix.mariadb-version }}-${{ matrix.extension }}-${{ matrix.php-version }}.coverage"
path: "coverage.xml"
phpunit-mysql:
name: "PHPUnit with MySQL"
runs-on: "ubuntu-22.04"
needs: "phpunit-smoke-check"
strategy:
matrix:
php-version:
- "8.1"
mysql-version:
- "5.7"
- "8.0"
- "8.3"
extension:
- "mysqli"
- "pdo_mysql"
config-file-suffix:
- ""
include:
- config-file-suffix: "-tls"
php-version: "8.1"
mysql-version: "8.0"
extension: "mysqli"
- php-version: "8.2"
mysql-version: "8.0"
extension: "mysqli"
- php-version: "8.3"
mysql-version: "8.0"
extension: "pdo_mysql"
services:
mysql:
image: "mysql:${{ matrix.mysql-version }}"
options: >-
--health-cmd "mysqladmin ping --silent"
-e MYSQL_ALLOW_EMPTY_PASSWORD=yes
-e MYSQL_DATABASE=doctrine_tests
${{ matrix.custom-entrypoint }}
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 }}"
coverage: "pcov"
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: "Copy TLS-related files"
run: 'docker cp "${{ job.services.mysql.id }}:/var/lib/mysql/ca.pem" . && docker cp "${{ job.services.mysql.id }}:/var/lib/mysql/client-cert.pem" . && docker cp "${{ job.services.mysql.id }}:/var/lib/mysql/client-key.pem" .'
if: "${{ endsWith(matrix.config-file-suffix, 'tls') }}"
- name: "Run PHPUnit"
run: "vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}${{ matrix.config-file-suffix }}.xml --coverage-clover=coverage.xml"
- name: "Upload coverage file"
uses: "actions/upload-artifact@v4"
with:
name: "${{ github.job }}-${{ matrix.mysql-version }}-${{ matrix.extension }}-${{ matrix.config-file-suffix }}-${{ matrix.php-version }}.coverage"
path: "coverage.xml"
phpunit-mssql:
name: "PHPUnit with SQL Server"
runs-on: "ubuntu-20.04"
needs: "phpunit-smoke-check"
strategy:
matrix:
php-version:
- "8.1"
- "8.2"
- "8.3"
extension:
- "sqlsrv"
- "pdo_sqlsrv"
collation:
- "Latin1_General_100_CI_AS_SC_UTF8"
include:
- collation: "Latin1_General_100_CS_AS_SC_UTF8"
php-version: "8.1"
extension: "sqlsrv"
- collation: "Latin1_General_100_CS_AS_SC_UTF8"
php-version: "8.1"
extension: "pdo_sqlsrv"
services:
mssql:
image: "mcr.microsoft.com/mssql/server:2019-latest"
env:
ACCEPT_EULA: "Y"
SA_PASSWORD: "Doctrine2018"
MSSQL_COLLATION: "${{ matrix.collation }}"
options: >-
--health-cmd "echo quit | /opt/mssql-tools/bin/sqlcmd -S 127.0.0.1 -l 1 -U sa -P Doctrine2018"
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 }}"
coverage: "pcov"
ini-values: "zend.assertions=1"
tools: "pecl"
extensions: "${{ matrix.extension }}-5.10.0beta1"
- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"
with:
composer-options: "--ignore-platform-req=php+"
- name: "Run PHPUnit"
run: "vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml --coverage-clover=coverage.xml"
- name: "Upload coverage file"
uses: "actions/upload-artifact@v4"
with:
name: "${{ github.job }}-${{ matrix.extension }}-${{ matrix.php-version }}-${{ matrix.collation }}.coverage"
path: "coverage.xml"
phpunit-ibm-db2:
name: "PHPUnit with IBM DB2"
runs-on: "ubuntu-22.04"
needs: "phpunit-smoke-check"
strategy:
matrix:
php-version:
- "8.1"
- "8.2"
- "8.3"
services:
ibm_db2:
image: "icr.io/db2_community/db2:11.5.8.0"
env:
DB2INSTANCE: "db2inst1"
DB2INST1_PASSWORD: "Doctrine2018"
LICENSE: "accept"
DBNAME: "doctrine"
options: >-
--health-cmd "su - ${DB2INSTANCE} -c \"db2 -t CONNECT TO ${DBNAME};\""
--health-interval 30s
--health-timeout 10s
--health-retries 5
--privileged
ports:
- "50000:50000"
steps:
- name: "Create temporary tablespace"
run: "docker exec ${{ job.services.ibm_db2.id }} su - db2inst1 -c 'db2 -t CONNECT TO doctrine; db2 -t CREATE USER TEMPORARY TABLESPACE doctrine_tbsp PAGESIZE 4 K;'"
- name: "Checkout"
uses: "actions/checkout@v4"
with:
fetch-depth: 2
- name: "Install IBM DB2 CLI driver"
working-directory: /tmp
run: |
wget https://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/linuxx64_odbc_cli.tar.gz
tar xf linuxx64_odbc_cli.tar.gz
rm linuxx64_odbc_cli.tar.gz
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
extensions: "ibm_db2"
coverage: "pcov"
ini-values: "zend.assertions=1, ibm_db2.instance_name=db2inst1"
env:
IBM_DB2_CONFIGURE_OPTS: "--with-IBM_DB2=/tmp/clidriver"
- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"
with:
composer-options: "--ignore-platform-req=php+"
- name: "Run PHPUnit"
run: "vendor/bin/phpunit -c ci/github/phpunit/ibm_db2.xml --coverage-clover=coverage.xml"
- name: "Upload coverage file"
uses: "actions/upload-artifact@v4"
with:
name: "${{ github.job }}-${{ matrix.php-version }}.coverage"
path: "coverage.xml"
development-deps:
name: "PHPUnit with PDO_SQLite and development dependencies"
runs-on: "ubuntu-22.04"
strategy:
matrix:
php-version:
- "8.1"
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
- name: "Lower minimum stability"
run: "composer config minimum-stability dev"
- name: "Install development dependencies with Composer"
uses: "ramsey/composer-install@v2"
with:
composer-options: "--prefer-dist"
- name: "Run PHPUnit"
run: "vendor/bin/phpunit -c ci/github/phpunit/pdo_sqlite.xml"
upload_coverage:
name: "Upload coverage to Codecov"
runs-on: "ubuntu-22.04"
needs:
- "phpunit-smoke-check"
- "phpunit-oci8"
- "phpunit-pdo-oci"
- "phpunit-postgres"
- "phpunit-mariadb"
- "phpunit-mysql"
- "phpunit-mssql"
- "phpunit-ibm-db2"
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
with:
fetch-depth: 2
- name: "Download coverage files"
uses: "actions/download-artifact@v4"
with:
path: "reports"
- name: "Display structure of downloaded files"
run: ls -R
working-directory: reports
- name: "Upload to Codecov"
uses: "codecov/codecov-action@v3"
with:
directory: reports