name: CI

on:
  push:
    branches: [ "development", "main" ]
  pull_request:
    branches: [ "development", "main" ]

permissions:
  contents: read

jobs:
  build:

    runs-on: ubuntu-latest

    strategy:
      fail-fast: false
      matrix:
        php-version:
          - "7.2"
          - "7.3"
          - "7.4"
          - "8.0"
          - "8.1"

    steps:
      - name: Checkout repository
        uses: actions/checkout@v3

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

      - name: Validate composer.json and composer.lock
        run: composer validate --strict --working-dir=web/

      - name: Install dependencies
        run: composer install --prefer-dist --no-progress --working-dir=web/

      - name: Run test suite
        run: ./web/vendor/bin/phpunit tests
