name: Laravel Test Suite

on:
  push:
    branches: [ staging, dev ]
  pull_request:
    branches: [ staging, dev ]

jobs:
  tests:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        php: [ '8.3' ]

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

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

      - name: Install Composer dependencies
        run: composer install -n --prefer-dist

      - name: Copy .env.testing
        run: |
          cp .env.testing .env
          php artisan key:generate

      - name: Run tests
        run: php artisan test
        continue-on-error: false
