Skip to content

Fix tests workflow

Fix tests workflow #4

Workflow file for this run

name: Tests
on: ['push', 'pull_request']
jobs:
ci:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
ports:
- 3306:3306
env:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: testing
MYSQL_USER: sail
MYSQL_PASSWORD: password
options: >-
--health-cmd="mysqladmin ping --silent"
--health-interval=10s
--health-timeout=5s
--health-retries=3
strategy:
fail-fast: true
matrix:
php: [8.2, 8.3]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: json, dom, curl, libxml, mbstring
tools: composer:v2
coverage: xdebug
- name: Copy .env.ci to .env.testing
run: cp .env.ci .env.testing
- name: Install Dependencies
run: composer install --no-interaction --prefer-dist --optimize-autoloader
- name: Wait for MySQL
run: |
echo "Waiting for MySQL to be ready..."
for i in {1..60}; do
if mysql -h"127.0.0.1" -P3306 -usail -ppassword -e 'select 1' &> /dev/null; then
echo "MySQL is ready!"
break
fi
echo "MySQL is unavailable - sleeping"
sleep 1
done
- name: Run Migrations
run: php artisan migrate --env=testing --force
- name: Run Tests
run: vendor/bin/pest