Skip to content

Update laravel.yml

Update laravel.yml #31

Workflow file for this run

name: Laravel
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
laravel-tests:
runs-on: ubuntu-22.04
steps:
- uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e
with:
php-version: '8.1'
- uses: actions/checkout@v4
- name: Copy .env
run: php -r "file_exists('project/.env') || copy('project/.env.example', 'project/.env');"
- name: Clear Composer Cache
run: composer clear-cache
- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist -d project
- name: Generate key if not exists
run: |
if ! grep -q "APP_KEY=" project/.env; then
php -r "echo 'APP_KEY=' . bin2hex(random_bytes(32)) . PHP_EOL;" >> project/.env
fi
- name: Directory Permissions
run: chmod -R 777 project/storage project/bootstrap/cache
- name: Create Database
run: |
mkdir -p database
touch database/laravel_example_app.sql
- name: Execute tests (Unit and Feature tests) via PHPUnit/Pest
working-directory: project
env:
DB_CONNECTION: mysql
DB_DATABASE: database/laravel_example_app.sql
run: php artisan test