---
name: build
on:
  push: ~
  pull_request: ~

jobs:
  linux_tests:
    name: PHP ${{ matrix.php }} - ${{ matrix.stability }}
    runs-on: ubuntu-latest
    continue-on-error: true
    strategy:
      matrix:
        php: ['8.0']
        stability: [prefer-lowest, prefer-stable]
        include:
          -   php: '8.1'
              flags: "--ignore-platform-req=php"
              stability: prefer-stable
    steps:
      - name: Checkout code
        uses: actions/checkout@v2

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

      - name: Install dependencies
        run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress ${{ matrix.flags }}

      - name: Run Unit tests with coverage
        run: composer phpunit
        if: ${{ matrix.php == '8.0' }}

      - name: Run Unit tests without
        run: vendor/bin/phpunit
        if: ${{ matrix.php == '8.1' }}

      - name: Run static analysis
        run: composer phpstan
        if: ${{ matrix.php == '8.0' }}

      - name: Run coding style check
        run: composer phpcs
        if: ${{ matrix.php == '8.0' }}

---
name: build
on:
  push: ~
  pull_request: ~

jobs:
  linux_tests:
    name: PHP ${{ matrix.php }} - ${{ matrix.stability }}
    runs-on: ubuntu-latest
    continue-on-error: true
    strategy:
      matrix:
        php: ['8.0']
        stability: [prefer-lowest, prefer-stable]
        include:
          -   php: '8.1'
              flags: "--ignore-platform-req=php"
              stability: prefer-stable
    steps:
      - name: Checkout code
        uses: actions/checkout@v2

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

      - name: Install dependencies
        run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress ${{ matrix.flags }}

      - name: Run Unit tests with coverage
        run: composer phpunit
        if: ${{ matrix.php == '8.0' }}

      - name: Run Unit tests without coverage
        run: vendor/bin/phpunit --no-coverage -vvv
        if: ${{ matrix.php == '8.1' }}

      - name: Run static analysis
        run: composer phpstan
        if: ${{ matrix.php == '8.0' }}

      - name: Run coding style check
        run: composer phpcs
        if: ${{ matrix.php == '8.0' }}

Improve test running in PHP8.1
Improve test running in PHP8.1
