name: Test

on: [push, pull_request]

jobs:
    test:
        name: PHP ${{ matrix.php-version }}

        runs-on: ubuntu-18.04

        strategy:
            matrix:
                php-version:
                    - 7.2
                    - 7.3
                    - 7.4
                    - 8.0

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

            - name: Install PHP with extensions
              uses: shivammathur/setup-php@v2
              with:
                  php-version: ${{ matrix.php-version }}
                  coverage: pcov
                  tools: composer:v2
                  extensions: xmlrpc, xmlreader

            - name: Install Node
              uses: actions/setup-node@v1
              with:
                  node-version: 12

            - name: Install Composer dependencies
              uses: ramsey/composer-install@v1
              with:
                  composer-options: --prefer-dist

            - name: Install NPM dependencies
              run: npm install

            - name: Run Tests
              run: vendor/bin/phpunit
