name: Tests

on:
  push:
  pull_request:

permissions:
  contents: read

jobs:
  build:

    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: true
      matrix:
        os: [ ubuntu-latest ]
        php: [ 8.1, 8.2, 8.3 ]
        stability: [ lowest, highest ]

    steps:
      - uses: actions/checkout@v4

      - name: Validate composer.json and composer.lock
        run: composer validate --strict
      
      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php }}
          extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, mysql, mysqli, pdo_mysql, bcmath, intl, fileinfo
          coverage: none


      - name: Install dependencies
        uses: "ramsey/composer-install@v2"
        with:
          dependency-versions: "${{ matrix.stability }}"
          composer-options: "--prefer-dist --no-cache"


      - name: Run test suite
        run: composer run-script test
