Skip to content

Add mysql to tests

Add mysql to tests #20

Workflow file for this run

name: Pest Tests
on: [ push, pull_request, workflow_dispatch ]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
php: [ 8.2, 8.3 ]
env:
DB_DATABASE: testbench
DB_USERNAME: root
DB_PASSWORD: root
name: PHP ${{ matrix.php }} - ${{ matrix.os }}
services:
mysql:
image: 'mysql:8.0'
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: testbench
ports:
- 3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, xml, mbstring, zip, pdo, sqlite, bcmath, soap, intl, gd
coverage: none
- name: Create MySQL Database
run: |
sudo systemctl start mysql
mysql -u${{ env.DB_USERNAME }} -p${{ env.DB_PASSWORD }} -e 'CREATE DATABASE ${{ env.DB_DATABASE }};' --port ${{ job.services.mysql.ports['3306'] }}
- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Install dependencies
run: composer update --prefer-stable --prefer-dist --no-interaction
- name: Execute tests
run: composer test