name: CI

on:
  push:
    branches:
      - master
  pull_request:

jobs:
  build:

    runs-on: ubuntu-latest

    strategy:
      matrix:
        php-versions: ['7.2', '7.3', '7.4']

    name: PHP ${{ matrix.php-versions }}

    steps:
      - uses: actions/checkout@v2

      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php-versions }}
          tools: phpunit

      - name: Install dependencies
        run: composer install --prefer-dist

      - name: Analysis
        run: vendor/bin/phpstan analyse -l 7 src

      - name: Test
        run: vendor/bin/phpunit
