name: Run tests

on:
  push:
    branches: [main]
  pull_request:
  schedule:
    - cron: '0 0 * * *'

jobs:
  test:
    strategy:
      matrix:
        php: ['7.3', '7.4', '8.0']
        os: [ubuntu-latest, macos-latest]
        dependency-version: [prefer-lowest, prefer-stable]
        include:
          - phpunit: '9.*'
          - php: '7.3'
            phpunit: '8.*'

    name: PHP ${{ matrix.php }}, ${{ matrix.dependency-version }}, ${{ matrix.os }}

    runs-on: ${{ matrix.os }}

    steps:
      - uses: actions/checkout@v2
      - uses: actions/cache@v2
        with:
          path: ~/.composer/cache/files
          key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ matrix.dependency-version }}-${{ hashFiles('composer.json') }}
          restore-keys: |
            ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ matrix.dependency-version }}-
            ${{ runner.os }}-php-${{ matrix.php }}-composer-
      - uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php }}
      - run: |
          composer require phpunit/phpunit:${{ matrix.phpunit }} --no-update --no-interaction
          composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
          composer require illuminate/view --with-all-dependencies --no-interaction
      - run: vendor/bin/phpunit

name: Run tests

on:
  push:
    branches: [main]
  pull_request:
  schedule:
    - cron: '0 0 * * *'

jobs:
  test:
    strategy:
      matrix:
        php: ['7.3', '7.4', '8.0', '8.1']
        os: [ubuntu-latest, macos-latest]
        dependency-version: [prefer-lowest, prefer-stable]
        include:
          - phpunit: '9.*'
          - php: '7.3'
            phpunit: '8.*'

    name: PHP ${{ matrix.php }}, ${{ matrix.dependency-version }}, ${{ matrix.os }}

    runs-on: ${{ matrix.os }}

    steps:
      - uses: actions/checkout@v2
      - uses: actions/cache@v2
        with:
          path: ~/.composer/cache/files
          key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ matrix.dependency-version }}-${{ hashFiles('composer.json') }}
          restore-keys: |
            ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ matrix.dependency-version }}-
            ${{ runner.os }}-php-${{ matrix.php }}-composer-
      - uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php }}
      - run: |
          composer require phpunit/phpunit:${{ matrix.phpunit }} --no-update --no-interaction
          composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
          composer require illuminate/view --with-all-dependencies --no-interaction
      - run: vendor/bin/phpunit

Add CI test run on PHP 8.1
Add CI test run on PHP 8.1
