name : Test Suite

on :
  push :
  pull_request :

jobs :
  test :
    runs-on : ubuntu-latest

    strategy :
      matrix :
        php_version : [ '8.1' ]
    steps :
      - uses : actions/checkout@v2

      - name : Set up PHP
        uses : shivammathur/setup-php@v2
        with :
          php-version : ${{ matrix.php_version }}
          coverage : xdebug
          tools : composer:v2, cs2pr

      - name : Install Supervisor
        run : |
          sudo apt-get install -y --no-install-recommends supervisor

      - name : Install Composer dependencies
        run : |
          composer install --no-interaction

      - name : Run PHP Linter
        run : |
          vendor/bin/parallel-lint . --exclude vendor --checkstyle | cs2pr

      - name : Run PHPStan
        run : |
          vendor/bin/phpstan analyze --xdebug --memory-limit=-1 --error-format=checkstyle | cs2pr

      - name : Run CI Tests
        run : |
          composer run phpspec
          composer run behat
