name: Mutation Testing

on: [push]

jobs:
  tests:
    runs-on: ${{ matrix.operating-system }}
    strategy:
      matrix:
        operating-system: [ubuntu-latest]
        php-versions: ['7.4']
    name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}

    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          ref: ${{ github.head_ref }}

      - name: Setup PHP, with composer and extensions
        uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php-versions }}
          extensions: json, mbstring, openssl, gmp
          coverage: xdebug

      - name: Install Composer dependencies
        run: |
          composer update --no-progress --no-suggest --prefer-dist --optimize-autoloader

      - name: Fetch Git base reference
        run: git fetch --depth=1 origin $GITHUB_BASE_REF

      - name: Infection
        run: ./vendor/bin/infection --logger-github --git-diff-filter=AM -s --threads=$(nproc) --min-msi=0 --min-covered-msi=0
