name: Run tests

on:
  push:
    branches: [laravel-9-ongoing, laravel-8-ongoing]
  pull_request:

jobs:
  tests:
    strategy:
      matrix:
        os: [Ubuntu, macOS]
        php: [8.0, 8.1, 8.2]

        include:
          - os: Ubuntu
            os-version: ubuntu-latest

          - os: macOS
            os-version: macos-latest

    name: ${{ matrix.os }} - PHP ${{ matrix.php }}

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

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

      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php }}
          extensions: posix, dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
          coverage: none

      - name: Install dependencies
        run: composer update --prefer-stable --prefer-dist --no-interaction

      - name: Run tests
        run: bash upgrade.sh
