feature pipeline: adicionando migrations para os testes laravel.yml #9
This file contains 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 | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
laravel-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e | |
with: | |
php-version: '8.1' | |
- name: Copy .env | |
run: php -r "file_exists('backend-api/.env') || copy('backend-api/.env.example', 'backend-api/.env');" | |
- name: Install Composer Dependencies | |
run: | | |
cd backend-api | |
composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist | |
composer dump-autoload --optimize | |
- name: Generate key | |
run: php backend-api/artisan key:generate | |
- name: Directory Permissions | |
run: chmod -R 777 backend-api/storage backend-api/bootstrap/cache | |
- name: Create Database | |
run: | | |
mkdir -p backend-api/database | |
touch backend-api/database/database.sqlite | |
- name: Run Migrations | |
run: php backend-api/artisan migrate --env=testing | |
- name: Execute tests (Unit and Feature tests) via PHPUnit | |
env: | |
DB_CONNECTION: sqlite | |
DB_DATABASE: backend-api/database/database.sqlite | |
run: backend-api/vendor/bin/phpunit backend-api/tests |