name: PHP Composer

on:
  pull_request:
    branches: [ "master" ]

permissions:
  contents: read

jobs:
  build:

    runs-on: ubuntu-18.04

    strategy:
      matrix:
        php-versions: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2']
        include:
          - php-versions: '5.3'

    steps:
    - uses: actions/checkout@v3

    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: ${{ matrix.php-versions }}

    - name: Cache Composer packages
      id: composer-cache
      uses: actions/cache@v3
      with:
        path: vendor
        key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
        restore-keys: |
          ${{ runner.os }}-php-

    - name: Update composer
      run: composer self-update

    - name: Install dependencies
      run: composer install --no-interaction

    - name: Run test
      run: composer run test


