name: phpMyFAQ Build

on: [push]

jobs:
  run:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        php-versions: ['7.3', '7.4', '8.0']
    name: phpMyFAQ ${{ matrix.php-versions }} Test on Ubuntu (latest)

    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Setup PHP, with composer and extensions
        uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php-versions }}
          extensions: mbstring, curl, fileinfo, filter, gd, json, zip, xml
          coverage: xdebug

      - name: Get composer cache directory
        id: composer-cache
        run: echo "::set-output name=dir::$(composer config cache-files-dir)"

      - name: Cache composer dependencies
        uses: actions/cache@v2
        with:
          path: ${{ steps.composer-cache.outputs.dir }}
          key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
          restore-keys: ${{ runner.os }}-composer-

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

      - name: Lint with PHPCS
        run: vendor/bin/phpcs  --standard=PSR12 ./phpmyfaq/src/phpMyFAQ

      - name: Test with PHPUnit
        run: vendor/bin/phpunit --coverage-text

name: phpMyFAQ Build

on: [push]

jobs:
  run:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        php-versions: ['7.3', '7.4', '8.0']
    name: phpMyFAQ ${{ matrix.php-versions }} Test on Ubuntu (latest)

    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Setup PHP, with composer and extensions
        uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php-versions }}
          extensions: mbstring, curl, fileinfo, filter, gd, json, zip, xml
          coverage: xdebug

      - name: Get composer cache directory
        id: composer-cache
        run: echo "::set-output name=dir::$(composer config cache-files-dir)"

      - name: Cache composer dependencies
        uses: actions/cache@v2
        with:
          path: ${{ steps.composer-cache.outputs.dir }}
          key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
          restore-keys: ${{ runner.os }}-composer-

      - name: Set Composer config to PHP 7.4.99 if we use PHP 8.0
        run: composer config platform.php 7.4.99
        with:
          php-version: '8.0'

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

      - name: Lint with PHPCS
        run: vendor/bin/phpcs  --standard=PSR12 ./phpmyfaq/src/phpMyFAQ

      - name: Test with PHPUnit
        run: vendor/bin/phpunit --coverage-text

Set Composer config to PHP 7.4.99 if we use PHP 8.0
chore: Set Composer config to PHP 7.4.99 if we use PHP 8.0
