forge/.github/workflows/tests.yaml

54 lines
1.3 KiB
YAML
Raw Normal View History

2024-06-18 16:18:27 -04:00
name: Tests
on: [ push, pull_request ]
jobs:
2025-01-29 17:31:39 -05:00
tests:
runs-on: ubuntu-latest
2024-06-18 16:18:27 -04:00
services:
mysql:
image: mysql:8.3
ports:
- 33306:3306
2025-01-29 17:31:39 -05:00
env:
MYSQL_DATABASE: test
MYSQL_ALLOW_EMPTY_PASSWORD: yes
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
2024-06-18 16:18:27 -04:00
steps:
- name: Checkout
uses: actions/checkout@v4
2025-01-29 17:31:39 -05:00
- name: Setup
uses: ./.github/action/setup
2024-06-18 16:18:27 -04:00
with:
2025-01-29 17:31:39 -05:00
php-version: 8.3
2024-06-18 16:18:27 -04:00
- name: Install Composer Dependencies
2025-01-29 17:31:39 -05:00
run: composer install -q --no-interaction --no-progress --prefer-dist --optimize-autoloader
2025-01-29 17:31:39 -05:00
- name: Install NPM dependencies
2024-06-18 16:18:27 -04:00
run: npm ci
2024-06-18 19:31:35 -04:00
- name: Build Front-end Assets
run: npm run build
2024-06-18 16:18:27 -04:00
- name: Prepare Laravel Environment
run: |
php -r "file_exists('.env') || copy('.env.ci', '.env');"
php artisan key:generate
php artisan optimize
2024-06-18 16:18:27 -04:00
- name: Run Database Migrations
run: php artisan migrate
2024-06-18 16:18:27 -04:00
- name: Link Storage
run: php artisan storage:link
2024-06-18 16:18:27 -04:00
- name: Run Tests
run: php artisan test
- name: Display Laravel Log
if: failure()
run: cat storage/logs/laravel.log