Laravel Test Fresh Install #4
This file contains hidden or 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: Laravel Test Fresh Install | |
on: workflow_dispatch | |
jobs: | |
laravel-tests-fresh-install: | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql:8.0 | |
env: | |
MYSQL_DATABASE: testing_db | |
MYSQL_ROOT_PASSWORD: secret | |
ports: | |
- 3306:3306 | |
options: >- | |
--health-cmd="mysqladmin ping --silent" | |
--health-interval=10s | |
--health-timeout=5s | |
--health-retries=3 | |
steps: | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.1' | |
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv | |
coverage: none | |
- uses: actions/checkout@v4 | |
- name: Copy .env | |
run: php -r "file_exists('.env') || copy('.env.example', '.env');" | |
- name: Install Dependencies | |
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist | |
- name: Generate key | |
run: php artisan key:generate | |
- name: Directory Permissions | |
run: chmod -R 777 storage bootstrap/cache | |
- name: Wait for MySQL | |
run: sleep 15 | |
- name: Execute tests (Unit and Feature tests) via PHPUnit/Pest | |
env: | |
DB_CONNECTION: mysql | |
DB_DATABASE: testing_db | |
DB_USERNAME: root | |
DB_PASSWORD: secret | |
run: php artisan migrate --seed && php artisan test |