name: PHPUnit

on: [push]

jobs:
  phpunit:
    runs-on: ubuntu-latest

    steps:
      - name: Cancel Previous Run
        uses: styfle/cancel-workflow-action@0.6.0
        with:
          access_token: ${{ github.token }}

      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: '8.3'
          extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd, exif, imagick, bcmath
          coverage: xdebug

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

      - name: Install Composer dependencies
        run: composer install

      - name: Run tests
        run: XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-text
