name: Mutation Testing

on:
  create:
    tags:
      - v*

jobs:
  psalm:
    name: Infection on PHP ${{ matrix.php-versions }}
    runs-on: ${{ matrix.operating-system }}
    strategy:
      matrix:
        operating-system: ['ubuntu-latest']
        php-versions: ['8.4']
    steps:
      - name: Checkout
        uses: actions/checkout@v4

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

      - name: Install Composer dependencies
        uses: "ramsey/composer-install@v3"

      - name: Make Pedantic
        run: echo 'define("DO_PEDANTIC_TEST", true);' >> autoload-phpunit.php

      - name: Mutation Tests
        run: composer mutation-test

      - name: Print the mutation.log file for easy copy/paste from GitHub Actions
        run: cat infection.log
