name: Tests

on:
  push:
  pull_request:
  schedule:
    - cron: '0 0 * * *'

jobs:
  tests:
    runs-on: ubuntu-latest

    strategy:
      fail-fast: true
      matrix:
        php: ['8.2', '8.3', '8.4', '8.5']
        stability: ['prefer-lowest', 'prefer-stable']
        laravel: ['^11.0', '^12.0', '^13.0']
        exclude:
          - php: '8.2'
            laravel: '^13.0'

    name: 'PHP ${{ matrix.php }} - Laravel: ${{matrix.laravel}} - ${{ matrix.stability }}'

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

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

      - name: Install TeX Live and Poppler Utils
        run: sudo apt-get update && sudo apt-get install -y poppler-utils texlive-latex-base texlive-latex-recommended texlive-latex-extra

      - name: Install dependencies
        run: composer update --with='laravel/framework:${{matrix.laravel}}' --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress

      - name: Execute tests
        run: composer test
