name: Tests

on:
  pull_request:
  push:
    branches:
      - master

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

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

      - name: Setup Git
        run: |
          git --version
          git config --global user.email "test@github.com"
          git config --global user.name "GitHub Action"
          git --version

      - 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
