name: CI
on: [push, pull_request]
jobs:
  run:
    strategy:
      matrix:
        include:
          - php: '7.4'
          - php: '8.0'
          - php: '8.1'
          - php: '8.2'
          - php: '8.3'
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Set up PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: "${{ matrix.php }}"

      - name: Install dependencies
        run: composer self-update && composer install && composer dump-autoload

      - name: Run tests and collect coverage
        run: vendor/bin/phpunit --bootstrap vendor/autoload.php --coverage-clover coverage.xml .

      - name: Upload coverage to Codecov
        uses: codecov/codecov-action@v4
        env:
          CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
