name: Debug

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  php73:
    runs-on: ${{ matrix.os }}
    env:
      WEBPCONVERT_EWWW_API_KEY: ${{ secrets.WEBPCONVERT_EWWW_API_KEY }}
    strategy:
      fail-fast: true
      matrix:
        os: [macos-11]
        php: [7.3]
    steps:
    - name: Checkout
      uses: actions/checkout@v2

    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: ${{ matrix.php }}
        extensions: exif, mbstring, fileinfo, gd

    - name: Setup problem matchers for PHP
      run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"

    - name: Setup problem matchers for PHPUnit
      run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

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

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

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

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