name: Static Analysis

on: [push, pull_request]

jobs:
  phpstan:
    name: PHPStan

    runs-on: ubuntu-latest

    env:
      SOLIDINVOICE_ENV: test
      SOLIDINVOICE_DEBUG: 1
      SKIP_FUNCTIONAL_BOOTSTRAP: 1

    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: 7.4
          ini-values: date.timezone=Europe/Paris, opcache.enable=1, opcache.enable_cli=1, opcache.memory_consumption=256, opcache.max_accelerated_files=32531, opcache.interned_strings_buffer=8, opcache.validate_timestamps=0, opcache.save_comments=1, opcache.fast_shutdown=0
          extensions: intl, gd, opcache, mysql, pdo_mysql

      - name: Get composer cache directory
        id: composercache
        run: echo "::set-output name=dir::$(composer config cache-files-dir)"

      - name: Cache dependencies
        uses: actions/cache@v2
        with:
          path: ${{ steps.composercache.outputs.dir }}
          key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }}
          restore-keys: |
            ${{ runner.os }}-php-${{ matrix.php }}-composer-

      - name: Install dependencies
        run: composer install --ansi --no-interaction --no-scripts --no-progress --prefer-dist

      - name: Warm up cache
        run: bin/console cache:clear -n -vvv

      - name: Run PHPStan
        run: bin/phpstan analyse

Add static analysis workflow to Github Action
Add static analysis workflow to Github Action
