name: Tests

on:
  push:
    branches: [ "master" ]
  pull_request:
    branches: [ "master" ]

jobs:
    test:
        runs-on: ${{ matrix.os }}
        strategy:
            fail-fast: true
            matrix:
                os: [ubuntu-latest, ubuntu-22.04]
                php: [8.1, 8.2]
                dependency-version: [prefer-stable]

        name: P${{ matrix.php }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}

        steps:
        - name: Setup PHP
          uses: shivammathur/setup-php@v2
          with:
              php-version: ${{ matrix.php }}
              extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
              coverage: non

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

        - name: Install dependencies
          run: composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction

        - name: Execute tests (Unit and Feature tests) via PHPUnit
          run: vendor/bin/phpunit
