Subscribers and notifications #13
Workflow file for this run
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: Tests | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
permissions: | |
contents: read | |
jobs: | |
app-tests: | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql:latest | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: false | |
MYSQL_ROOT_PASSWORD: symfony | |
MYSQL_DATABASE: symfony | |
ports: | |
- 3306/tcp | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# Docs: https://github.com/shivammathur/setup-php | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.3' | |
extensions: mbstring, xml, ctype, iconv, intl, mysql | |
- name: Copy .env.test.local | |
run: php -r "file_exists('.env.test.local') || copy('.env.test', '.env.test.local');" | |
- name: Cache Composer packages | |
id: composer-cache | |
uses: actions/cache@v3 | |
with: | |
path: vendor | |
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-php- | |
- name: Install Dependencies | |
run: composer install --no-progress --prefer-dist --optimize-autoloader | |
- name: Run Migration | |
run: | | |
php bin/console doctrine:schema:update --force || echo "No migrations found or schema update failed" | |
php bin/console doctrine:migrations:migrate || echo "No migrations found or migration failed" | |
env: | |
DATABASE_URL: mysql://root:[email protected]:${{ job.services.mysql.ports['3306'] }}/symfony | |
- name: Run tests | |
run: php bin/phpunit --coverage-text | |
env: | |
DATABASE_URL: mysql://root:[email protected]:${{ job.services.mysql.ports['3306'] }}/symfony | |