name: Tests

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

jobs:
  tests:
    runs-on: ${{ matrix.operating-system }}
    strategy:
      matrix:
        operating-system: [ubuntu-latest]
        php-versions: ["7.2", "7.3", "7.4", "8.0"]
    name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
    steps:
      - uses: actions/checkout@v2
      - name: Install PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php-versions }}
      - name: Validate composer.json
        run: composer validate

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

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