name: "Continuous Integration"

on:
  push:
    branches:
      - 5.x.x
  pull_request:
    branches:
      - 5.x.x

jobs:
  tests:
    name: "PHP ${{ matrix.php-version }}"

    runs-on: ubuntu-latest

    strategy:
      fail-fast: false
      matrix:
        php-version: ['7.1', '7.2', '7.3', '7.4']

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

      - name: "Install PHP"
        uses: "shivammathur/setup-php@v2"
        with:
          coverage: "none"
          extensions: "intl, zip"
          ini-values: "memory_limit=-1, phar.readonly=0, error_reporting=E_ALL, display_errors=On"
          php-version: "${{ matrix.php-version }}"
          tools: composer

      - name: "Update dependencies"
        run: "composer update --ansi --no-interaction --no-progress --prefer-dist"

      - name: "Validate composer.json"
        run: "composer validate"

      - name: "Run tests"
        run: "composer test"
