name: Tests

on: [push, pull_request]

jobs:
    tests:
        runs-on: ubuntu-latest
        strategy:
            matrix:
                php: ['5.6', '7.0', '7.1', 7.2', '7.3', '7.4', '8.0']

            fail-fast: false

        name: PHP ${{ matrix.php }} tests
        steps:
            - uses: actions/checkout@v2
            - uses: shivammathur/setup-php@v2
              with:
                  php-version: ${{ matrix.php }}
                  extensions: json, mbstring, tokenizer, sqlite3
                  coverage: none

            - run: composer install --no-interaction --prefer-dist
            - run: vendor/bin/tester tests -s -C
            - if: failure()
              uses: actions/upload-artifact@v2
              with:
                  name: output
                  path: tests/**/output
