name: PHP

on: [push]

jobs:
  run:
    runs-on: 'ubuntu-latest'
    strategy:
      matrix:
        php-versions: ['7.3', '7.4', '8.0']
        phpunit-versions: ['9.5']
    steps:
    - name: Checkout
      uses: actions/checkout@v2

    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: ${{ matrix.php-versions }}
        extensions: mbstring, intl
        ini-values: post_max_size=256M, max_execution_time=180
        coverage: xdebug
        tools: php-cs-fixer, phpunit:${{ matrix.phpunit-versions }}

    - name: Validate Composer
      run: composer validate
    - name: Install Composer Deps
      run: composer install
    - name: Run Tests
      run: phpunit --testdox --coverage-text --coverage-clover=coverage.clover
    - name: Upload Scrutinzer
      continue-on-error: true
      run: |
        wget https://scrutinizer-ci.com/ocular.phar
        php ocular.phar code-coverage:upload --format=php-clover coverage.clover