Skip to content

Run tests with multiple php and mysql versions #99

Run tests with multiple php and mysql versions

Run tests with multiple php and mysql versions #99

Workflow file for this run

name: PHP Tests
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
php: [ '8.2', '8.3', '8.4' ]
mysql-version: [ '5.7', '8.0', '8.4' ]
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: shogo82148/actions-setup-mysql@v1
with:
mysql-version: "${{ matrix.mysql-version }}"
my-cnf: |
server-id=1
binlog_format=row
binlog_rows_query_log_events=ON
log_bin=binlog
root-password: root
- name: set up timezones
run: mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql -proot
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: xdebug
- name: Validate composer.json and composer.lock
run: composer validate
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.php }}-
- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --prefer-dist --no-progress --no-suggest
- name: Run tests
run: vendor/bin/phpunit --coverage-text