Skip to content

Merge pull request #185 from bizley/dependabot/github_actions/actions… #131

Merge pull request #185 from bizley/dependabot/github_actions/actions…

Merge pull request #185 from bizley/dependabot/github_actions/actions… #131

Workflow file for this run

name: Build with MySQL
on:
pull_request:
push:
branches:
- "master"
jobs:
Tests:
name: PHP ${{ matrix.php }} + MySQL ${{ matrix.mysql }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['7.2', '7.3', '7.4', '8.0', '8.1']
mysql: ['5.7']
services:
mysql:
image: mysql:${{ matrix.mysql }}
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: migration
MYSQL_USER: migration
MYSQL_PASSWORD: password
ports:
- 3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, intl, mysql
coverage: none
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
update: true
- name: Start MySQL service
run: sudo /etc/init.d/mysql start
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader
- name: Prepare DB connections for tests
run: printf "<?php\n\n\$config['mysql']['dsn']='mysql:host=127.0.0.1;port=${{ job.services.mysql.ports['3306'] }};dbname=migration';\n" >> tests/config.local.php;
- name: PHPUnit tests
run: vendor/bin/phpunit --exclude-group pgsql,sqlite,autoloader