Skip to content

Add PHP 8.6 to the test matrix #16307

Add PHP 8.6 to the test matrix

Add PHP 8.6 to the test matrix #16307

Workflow file for this run

name: CI
on:
push:
branches:
- '4.x'
- '5.x'
- '5.next'
pull_request:
branches:
- '*'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
testsuite:
runs-on: ubuntu-24.04
continue-on-error: ${{ matrix.php-version == '8.6' }}
strategy:
fail-fast: false
matrix:
php-version: ['8.2', '8.5', '8.6']
db-type: [sqlite, pgsql]
dependencies: ['highest']
include:
- php-version: '8.2'
db-type: 'mariadb'
dependencies: highest
- php-version: '8.2'
db-type: 'mysql'
dependencies: 'lowest'
- php-version: '8.2'
db-type: 'mysql'
dependencies: highest
- php-version: '8.3'
db-type: 'mysql'
dependencies: highest
- php-version: '8.4'
db-type: 'mysql'
dependencies: highest
- php-version: '8.5'
db-type: 'mysql'
dependencies: highest
- php-version: '8.6'
db-type: 'mysql'
dependencies: highest
services:
redis:
image: redis
ports:
- 6379/tcp
memcached:
image: memcached
ports:
- 11211/tcp
redis-cluster:
image: grokzen/redis-cluster:6.2.1
ports:
- 7000:7000
- 7001:7001
options: >-
--health-cmd "redis-cli -p 7000 ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Setup MySQL 8.4
if: matrix.db-type == 'mysql' && matrix.dependencies == 'highest' && matrix.php-version != '8.3'
run: docker run --rm --name=mysqld -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=cakephp -p 3306:3306 -d mysql:8.4
- name: Setup MySQL 8.0
if: matrix.db-type == 'mysql' && matrix.dependencies == 'highest' && matrix.php-version == '8.3'
run: |
sudo service mysql start
mysql -h 127.0.0.1 -u root -proot -e 'CREATE DATABASE cakephp;'
- name: Setup MySQL 5.7
if: matrix.db-type == 'mysql' && matrix.dependencies == 'lowest'
run: docker run --rm --name=mysqld -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=cakephp -p 3306:3306 -d mysql:5.7 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
- name: Setup PostgreSQL with PostGIS
if: matrix.db-type == 'pgsql'
run: docker run --rm --name=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=cakephp -p 5432:5432 -d postgis/postgis:18-3.6
- name: Setup MariaDB 11.8
if: matrix.db-type == 'mariadb'
run: |
docker run -d --name=mariadb \
-e MARIADB_ROOT_PASSWORD=root \
-e MARIADB_DATABASE=cakephp \
-p 3306:3306 \
--health-cmd="mariadb-admin ping -h 127.0.0.1 -proot || exit 1" \
--health-interval=10s \
--health-timeout=5s \
--health-retries=10 \
mariadb:11.8
echo "Waiting for MariaDB to be ready..."
for i in {1..60}; do
if docker exec mariadb mariadb-admin ping -h 127.0.0.1 -proot >/dev/null 2>&1; then
echo "MariaDB is responding."
break
fi
sleep 2
done
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, intl, apcu, memcached, redis, pdo_${{ matrix.db-type }}
ini-values: apc.enable_cli = 1, zend.assertions = 1
coverage: pcov
- name: Install packages
run: |
sudo locale-gen da_DK.UTF-8
sudo locale-gen de_DE.UTF-8
- name: Composer install
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
with:
dependency-versions: ${{ matrix.dependencies }}
composer-options: "${{ matrix.php-version == '8.6' && '--ignore-platform-req=php' || matrix.composer-options }}"
- name: Setup problem matchers for PHPUnit
if: matrix.php-version == '8.2' && matrix.db-type == 'mysql'
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Run PHPUnit
env:
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
MEMCACHED_PORT: ${{ job.services.memcached.ports['11211'] }}
REDIS_CLUSTER_NODES: "127.0.0.1:7000,127.0.0.1:7001"
run: |
if [[ ${{ matrix.db-type }} == 'sqlite' ]]; then export DB_URL='sqlite:///:memory:'; fi
if [[ ${{ matrix.db-type }} == 'mysql' ]]; then export DB_URL='mysql://root:root@127.0.0.1/cakephp'; fi
if [[ ${{ matrix.db-type }} == 'mariadb' ]]; then export DB_URL='mysql://root:root@127.0.0.1/cakephp'; fi
if [[ ${{ matrix.db-type }} == 'pgsql' ]]; then export DB_URL='postgres://postgres:postgres@127.0.0.1/postgres'; fi
if [[ ${{ matrix.php-version }} == '8.2' && ${{ matrix.dependencies }} == 'highest' ]]; then
export CODECOVERAGE=1
vendor/bin/phpunit --display-all-issues --fail-on-all-issues --do-not-fail-on-skipped --do-not-fail-on-incomplete --testsuite=cakephp --coverage-clover=coverage.xml
vendor/bin/phpunit --display-all-issues --fail-on-all-issues --do-not-fail-on-skipped --do-not-fail-on-incomplete --testsuite=database --coverage-clover=coverage-database.xml
CAKE_TEST_AUTOQUOTE=1 vendor/bin/phpunit --display-all-issues --fail-on-all-issues --do-not-fail-on-skipped --do-not-fail-on-incomplete --testsuite=database
vendor/bin/phpunit --display-all-issues --fail-on-all-issues --do-not-fail-on-skipped --do-not-fail-on-incomplete --do-not-fail-on-warning --testsuite=globalfunctions --coverage-clover=coverage-functions.xml
elif [[ ${{ matrix.php-version }} == '8.2' && ${{ matrix.dependencies }} == 'lowest' ]]; then
vendor/bin/phpunit
CAKE_TEST_AUTOQUOTE=1 vendor/bin/phpunit --testsuite=database
else
vendor/bin/phpunit --display-phpunit-notices --display-phpunit-deprecations --display-deprecations --display-warnings
CAKE_TEST_AUTOQUOTE=1 vendor/bin/phpunit --display-phpunit-notices --display-phpunit-deprecations --display-deprecations --display-warnings --testsuite=database
fi
- name: Submit code coverage
if: matrix.php-version == '8.2'
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
with:
files: coverage.xml,coverage-database.xml,coverage-functions.xml
token: ${{ secrets.CODECOV_TOKEN }}
testsuite-windows:
runs-on: windows-2022
name: Windows - PHP 8.2 & SQL Server
env:
EXTENSIONS: mbstring, intl, apcu, redis, pdo_sqlsrv
PHP_VERSION: '8.2'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Get date part for cache key
id: key-date
run: echo "date=$(date +'%Y-%m')" >> $env:GITHUB_OUTPUT
- name: Setup PHP extensions cache
id: php-ext-cache
uses: shivammathur/cache-extensions@de3c642a5fce0ef91581a1c9831e229f525196d6 # 1.15.1
with:
php-version: ${{ env.PHP_VERSION }}
extensions: ${{ env.EXTENSIONS }}
key: ${{ steps.key-date.outputs.date }}
- name: Cache PHP extensions
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ steps.php-ext-cache.outputs.dir }}
key: ${{ runner.os }}-php-ext-${{ steps.php-ext-cache.outputs.key }}
restore-keys: ${{ runner.os }}-php-ext-${{ steps.php-ext-cache.outputs.key }}
- name: Setup PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
with:
php-version: ${{ env.PHP_VERSION }}
extensions: ${{ env.EXTENSIONS }}
ini-values: apc.enable_cli = 1, zend.assertions = 1, extension = php_fileinfo.dll
coverage: none
- name: Setup SQLServer
run: |
# MSSQLLocalDB is the default SQL LocalDB instance
SqlLocalDB start MSSQLLocalDB
SqlLocalDB info MSSQLLocalDB
sqlcmd -S "(localdb)\MSSQLLocalDB" -Q "create database cakephp;"
- name: Composer install
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
- name: Run PHPUnit
env:
DB_URL: 'sqlserver://@(localdb)\MSSQLLocalDB/cakephp'
run: |
set CAKE_DISABLE_GLOBAL_FUNCS=1
vendor/bin/phpunit --display-incomplete
- name: Run PHPUnit (autoquote enabled)
env:
DB_URL: 'sqlserver://@(localdb)\MSSQLLocalDB/cakephp'
run: |
set CAKE_TEST_AUTOQUOTE=1
vendor/bin/phpunit --display-incomplete --testsuite=database
cs-stan:
name: Coding Standard & Static Analysis
runs-on: ubuntu-24.04
env:
PHIVE_KEYS: 'CF1A108D0E7AE720,51C67305FFC2E5C0,12CE0F1D262429A5,99BF4D9A33D65E1E'
PHPSTAN_TESTS: 1
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
with:
php-version: '8.2'
extensions: mbstring, intl, pcntl
coverage: none
tools: phive, cs2pr
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Composer install
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
- name: Cache phive tools
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.phive
tools
key: ${{ runner.os }}-phive-${{ hashFiles('.phive/phars.xml') }}
restore-keys: ${{ runner.os }}-phive-
- name: Install PHP tools with phive.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: 'phive install --trust-gpg-keys "$PHIVE_KEYS"'
- name: Run phpstan
if: always()
run: tools/phpstan analyse --error-format=github
- name: Run Psalm
if: always()
run: tools/psalm --output-format=github
- name: Setup phpcs cache
if: always()
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ runner.temp }}/phpcs.cache
key: ${{ runner.os }}-phpcs-${{ hashFiles('phpcs.xml', 'composer.lock') }}
restore-keys: ${{ runner.os }}-phpcs-
- name: Run phpcs
if: always()
run: vendor/bin/phpcs --parallel=8 --cache=${{ runner.temp }}/phpcs.cache --report=checkstyle | cs2pr
- name: Run phpstan for tests
if: env.PHPSTAN_TESTS
run: tools/phpstan analyse -c tests/phpstan.neon --error-format=github
- name: Run class deprecation aliasing validation script
if: always()
run: php contrib/validate-deprecation-aliases.php
- name: Run composer.json validation for split packages
if: always()
run: php contrib/validate-split-packages.php
- name: Prefer lowest check
if: matrix.prefer-lowest == 'prefer-lowest'
run: composer require --dev dereuromark/composer-prefer-lowest && vendor/bin/validate-prefer-lowest -m
- name: Setup rector cache
if: always()
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ runner.temp }}/rector
key: ${{ runner.os }}-rector-${{ hashFiles('rector.php', 'composer.lock') }}
restore-keys: ${{ runner.os }}-rector-
- name: Create rector cache dir
if: always()
run: mkdir -p ${{ runner.temp }}/rector
- name: Run rector
if: always()
env:
RECTOR_CACHE_DIR: ${{ runner.temp }}/rector
run: composer rector-setup && composer rector-check
- name: Run StructArmed
if: always()
run: vendor/bin/structarmed analyze src
split-packages-stan:
name: Static Analysis for Split Packages
runs-on: ubuntu-24.04
env:
PHIVE_KEYS: 'CF1A108D0E7AE720,51C67305FFC2E5C0,12CE0F1D262429A5,99BF4D9A33D65E1E'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
with:
php-version: '8.2'
extensions: mbstring, intl
coverage: none
tools: phive
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Composer install
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
- name: Cache phive tools
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.phive
tools
key: ${{ runner.os }}-phive-${{ hashFiles('.phive/phars.xml') }}
restore-keys: ${{ runner.os }}-phive-
- name: Install PHP tools with phive.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: 'phive install --trust-gpg-keys "$PHIVE_KEYS"'
- name: Run phpstan for split packages
run: php contrib/validate-split-packages-phpstan.php