name: CI

on:
    pull_request: ~
    push:
        branches:
            - 1.x
        tags:
            - 1.*

jobs:
    tests:
        name: PHP ${{ matrix.php }}
        runs-on: ubuntu-latest
        strategy:
            fail-fast: false
            matrix:
                php: [5.6, 7.2, 7.3]
        steps:
            - name: Setup PHP
              uses: shivammathur/setup-php@v2
              with:
                  php-version: ${{ matrix.php }}
                  tools: prestissimo, flex
                  coverage: none

            - name: Checkout
              uses: actions/checkout@v2

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

            - name: Run the unit tests
              run: vendor/bin/phpunit --colors=always

    prefer-lowest:
        name: Prefer Lowest
        runs-on: ubuntu-latest
        steps:
            - name: Setup PHP
              uses: shivammathur/setup-php@v2
              with:
                  php-version: 7.3
                  tools: prestissimo, flex
                  coverage: none

            - name: Checkout
              uses: actions/checkout@v2

            - name: Install the dependencies
              run: composer update --prefer-lowest --prefer-stable --no-interaction --no-suggest

            - name: Run the unit tests
              run: vendor/bin/phpunit --colors=always
