name: codebase checks

on: [push]

jobs:
  test:
    runs-on: ubuntu-latest
    env:
      COMPOSER_NO_INTERACTION: 1

    strategy:
      matrix:
        php: ["7.4", "7.3", "7.2"]

    name: PHP ${{ matrix.php }}

    steps:
      - uses: actions/checkout@v2

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

      - name: Install dependencies
        run: |
          composer install --prefer-dist --no-progress

      - name: Run psalm
        run: php vendor/bin/psalm

      - name: Run PHPUnit
        run: php vendor/bin/phpunit --verbose

      - name: Run phpmd
        run: |
          php vendor/bin/phpmd src xml codesize,unusedcode,naming,design
          php vendor/bin/phpmd tests xml codesize,unusedcode,naming,design

      - name: Run phpcpd
        run: |
          php vendor/bin/phpcpd src
          php vendor/bin/phpcpd tests

      - name: Run php-cs-fixer
        run: |
          php vendor/bin/php-cs-fixer fix src --diff --dry-run -v --rules=@Symfony
          php vendor/bin/php-cs-fixer fix tests --diff --dry-run -v --rules=@Symfony

name: codebase checks

on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    env:
      COMPOSER_NO_INTERACTION: 1

    strategy:
      matrix:
        php: ["7.4", "7.3", "7.2"]

    name: PHP ${{ matrix.php }}

    steps:
      - uses: actions/checkout@v2

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

      - name: Install dependencies
        run: |
          composer install --prefer-dist --no-progress

      - name: Run psalm
        run: php vendor/bin/psalm

      - name: Run PHPUnit
        run: php vendor/bin/phpunit --verbose

      - name: Run phpmd
        run: |
          php vendor/bin/phpmd src xml codesize,unusedcode,naming,design
          php vendor/bin/phpmd tests xml codesize,unusedcode,naming,design

      - name: Run phpcpd
        run: |
          php vendor/bin/phpcpd src
          php vendor/bin/phpcpd tests

      - name: Run php-cs-fixer
        run: |
          php vendor/bin/php-cs-fixer fix src --diff --dry-run -v --rules=@Symfony
          php vendor/bin/php-cs-fixer fix tests --diff --dry-run -v --rules=@Symfony

Allow GH actions on pull requests
Allow GH actions on pull requests