Add PHPStan to workflow #586
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: Testing with PostgreSQL | |
on: [push, pull_request] | |
jobs: | |
symfony: | |
name: Symfony (PHP ${{ matrix.php-versions }}) | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:10.8 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: postgres | |
ports: | |
- 5432/tcp | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3 | |
strategy: | |
fail-fast: false | |
matrix: | |
php-versions: ['8.1', '8.2'] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup PHP, with composer and extensions | |
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: mbstring, xml, ctype, gd, iconv, intl, pdo_sqlite, pgsql | |
coverage: xdebug #optional | |
- name: Get composer cache directory | |
id: composercache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Cache composer dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.composercache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Install Composer dependencies | |
run: | | |
composer update symfony/flex --no-plugins --no-scripts | |
composer install --no-progress --prefer-dist --optimize-autoloader | |
- name: Run Migration | |
run: | | |
php bin/console doctrine:database:create --if-not-exists --no-interaction | |
php bin/console doctrine:migrations:migrate --no-interaction || php bin/console doctrine:migrations:version --add --all -n | |
php bin/console make:migration -n | |
php bin/console doctrine:migrations:migrate --no-interaction | |
php bin/console doctrine:fixtures:load --no-interaction | |
env: | |
DATABASE_URL: postgres://postgres:[email protected]:${{ job.services.postgres.ports[5432] }}/postgres?charset=UTF-8 | |
- name: Run Tests | |
env: | |
DATABASE_URL: postgres://postgres:[email protected]:${{ job.services.postgres.ports[5432] }}/postgres?charset=UTF-8 | |
run: php bin/phpunit --testsuite=main |