name: Coding Standards

on: [push, pull_request]

jobs:
  phpcs:
    name: PHP coding standards
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2

      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: 7.1
          tools: composer, cs2pr

      - name: Log debug information
        run: |
          php --version
          composer --version

      - name: Install Composer dependencies
        run: |
          composer install --prefer-dist --no-suggest --no-progress --no-ansi --no-interaction
          echo "${PWD}/vendor/bin" >> $GITHUB_PATH

      - name: Log PHPCS debug information
        run: composer run lint

      - name: Run PHP compatibility tests
        run: composer run lint:min-php
