name: Tests

on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: true
      matrix:
        php: [8.2, 8.1]
        stability: [lowest, highest]

    name: PHP ${{ matrix.php }} - ${{ matrix.stability }} deps

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php }}
          coverage: none

      - name: Setup problem matchers
        run: |
          echo "::add-matcher::${{ runner.tool_cache }}/php.json"
          echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

      - name: Install dependencies
        uses: ramsey/composer-install@v3
        with:
          dependency-versions: ${{ matrix.stability }}

      - name: Execute tests
        run: vendor/bin/pest
