name: Tests

on:
  pull_request:
  push:
    branches:
      - master

jobs:
  tests:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        php:
          - "8.1"
          - "8.2"
          - "8.3"
        dependency-version:
          # - prefer-lowest
          - prefer-stable

    name: PHP ${{ matrix.php }} - ${{ matrix.dependency-version }} - tests
    steps:
      # basically git clone
      - uses: actions/checkout@v4

      - name: Setup PHP
        # use PHP of specific version
        uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php }}
          coverage: none # disable xdebug, pcov
          tools: composer

      - name: Install Composer Dependencies
        run: |
          composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest

      - name: Run PHPUnit Tests
        run: composer tests
