Files
monica/.github/workflows/mysql.yml
T
2021-12-04 18:26:14 -05:00

65 lines
2.2 KiB
YAML

name: PHPUnit with MySQL
on: [push]
jobs:
laravel:
name: PHP ${{ matrix.php-versions }}
runs-on: ubuntu-latest
env:
DB_DATABASE: butler
DB_USERNAME: root
DB_PASSWORD: password
BROADCAST_DRIVER: log
services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: butler
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
fail-fast: false
matrix:
php-versions: ['8.0']
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, dom, fileinfo, mysql
coverage: none
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer dependencies
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies
run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader
- name: Prepare the application
run: |
php -r "file_exists('.env') || copy('.env.ci.mysql', '.env');"
php -r "copy('phpunit.ci.mysql.xml', 'phpunit.xml');"
php artisan key:generate
- name: Clear Config
run: php artisan config:clear
- name: Run Migration
run: php artisan migrate -v
env:
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
- name: Run seeds
run: php artisan db:seed --no-interaction -vvv
- name: Execute tests via PHPUnit
run: vendor/bin/phpunit --coverage-clover=coverage-report.clover --log-junit=test-report.xml
env:
DB_PORT: ${{ job.services.mysql.ports['3306'] }}