Some code refresh #126
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v3 | |
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 |