Skip to content

test-coverage

test-coverage #49

Workflow file for this run

name: test-coverage
on:
workflow_dispatch:
pull_request:
types:
- opened
branches:
- "master"
- "develop"
push:
branches:
- "master"
jobs:
run-tests:
runs-on: ubuntu-latest
# Configure the MySQL service
services:
mysql:
image: mysql:8
env:
MYSQL_ROOT_PASSWORD: secret
MYSQL_DATABASE: buzzer
ports:
- 33064:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v3
- name: Init application
run: |
cp .env.example .env
docker compose -f docker-compose.dev.yml up --build -d
docker exec -i -u root buzzer_app composer install
docker exec -i -u root buzzer_app php artisan key:generate
docker exec -i -u root buzzer_app php artisan migrate
env:
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
- name: Run tests and generate xml report
run: docker exec -i -u root buzzer_app vendor/bin/phpunit --coverage-clover=coverage.xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}