Skip to content

Merge pull request #27 from naaando/dependabot/composer/pets-api/phps… #73

Merge pull request #27 from naaando/dependabot/composer/pets-api/phps…

Merge pull request #27 from naaando/dependabot/composer/pets-api/phps… #73

Workflow file for this run

name: Laravel Tests
on:
push:
branches: [ "main" ]
paths:
- pets-api/**
- .github/workflows/laravel.yml
pull_request:
branches: [ "main" ]
paths:
- pets-api/**
- .github/workflows/laravel.yml
defaults:
run:
working-directory: pets-api
jobs:
tests:
name: "Run Pest tests"
runs-on: ubuntu-latest
services:
postgres:
image: postgres
ports:
- 5432:5432
# Baseado no .env.example
env:
POSTGRES_DB: "pets_api"
POSTGRES_USER: "root"
POSTGRES_PASSWORD: "root"
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
php-version: 8.2
tools: composer:v2
coverage: xdebug
- name: Copy .env
run: cp .env.example .env
- name: Install Dependencies
run: composer install --verbose --no-interaction --prefer-dist --optimize-autoloader
- name: Generate key
run: php artisan key:generate
- name: Install node packages
run: npm ci
- name: Build UI
run: npm run build
- name: Directory Permissions
run: chmod -R 777 storage bootstrap/cache
- name: Tests
run: ./vendor/bin/pest --coverage --min=50 --coverage-cobertura=./cobertura.xml
env:
DB_CONNECTION: pgsql
DB_HOST: localhost
DB_PORT: 5432
DB_DATABASE: "pets_api"
DB_USER: "root"
DB_PASSWORD: "root"
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}