name: soft-deletable-bundle-CI
on:
  [push, pull_request]
jobs:
  phpstan:
    runs-on: ubuntu-latest
    name: PHPStan
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: composer install
        run: composer install
      - name: PHPStan
        run: composer phpstan
        env:
          REQUIRE_DEV: true
  cs-fixer:
    runs-on: ubuntu-latest
    name: PHP-CS-Fixer
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: composer install
        run: composer install
      - name: CS Check
        run: composer cs-check

  tests:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        name:
          - 'PHP 7.4 tests (Symfony 4.4)'
          - 'PHP 7.4 tests (Symfony 5.1)'
          - 'PHP 8.0 tests (Symfony 5.2)'
          - 'PHP 8.0 tests (Symfony 5.3)'
          - 'PHP 8.0 tests (Symfony 5.4)'
          - 'PHP 8.0 tests (Symfony 6.0)'
          - 'PHP 8.1 tests (Symfony 6.0)'
        include:
          - php: '7.4'
            symfony: 4.4.*
          - php: '7.4'
            symfony: 5.1.*
          - php: '8.0'
            symfony: 5.2.*
          - php: '8.0'
            symfony: 5.3.*
          - php: '8.0'
            symfony: 5.4.*
          - php: '8.0'
            symfony: 6.0.*
          - php: '8.1'
            symfony: 6.0.*
    name: ${{ matrix.name }}
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Setup MySQL
        run: |
          sudo systemctl enable mysql.service
          sudo systemctl start mysql.service
          mysql -uroot -proot -h localhost -e "CREATE DATABASE test CHARACTER SET utf8 COLLATE utf8_general_ci;"
      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php }}
      - run: |
          sed -ri 's/"symfony\/(.+)": "(.+)"/"symfony\/\1": "${{ matrix.symfony }}"/' composer.json;
        if: matrix.symfony
      - run: composer update --no-interaction --no-progress --ansi
      - run: composer phpunit
