name: CI test suite

on:
  pull_request:
    paths:
      - 'composer.*'
      - phpcs.xml
      - phpstan.neon
      - '**.php'
  push:
    paths:
      - 'composer.*'
      - phpcs.xml
      - phpstan.neon
      - '**.php'

jobs:
  build:
    strategy:
      matrix:
        php-versions: ['8.1', '8.0', '7.4', '7.3']

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v1

    - name: Set up PHP versions
      uses: shivammathur/setup-php@v2
      with:
        php-version: ${{ matrix.php-versions }}
        extensions: mbstring

    - name: Validate composer.json and composer.lock
      run: composer validate

    - name: Install dependencies
      run: composer install --prefer-dist --no-progress --no-suggest --classmap-authoritative

    - name: Run CI test suite
      run: composer run-script ci

name: CI test suite

on:
  pull_request:
    paths:
      - '.github/workflows/**'
      - 'composer.*'
      - phpcs.xml
      - phpstan.neon
      - '**.php'
  push:
    paths:
      - '.github/workflows/**'
      - 'composer.*'
      - phpcs.xml
      - phpstan.neon
      - '**.php'

# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
  # The concurrency group contains the workflow name and the branch name.
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  build:
    strategy:
      matrix:
        php-versions: ['8.1', '8.0', '7.4', '7.3']

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v1

    - name: Set up PHP versions
      uses: shivammathur/setup-php@v2
      with:
        php-version: ${{ matrix.php-versions }}
        extensions: mbstring

    - name: Validate composer.json and composer.lock
      run: composer validate

    - name: Install dependencies
      uses: ramsey/composer-install@v1

    - name: Run CI test suite
      run: composer run-script ci

Improve and optimize CI action
Improve and optimize CI action
