diff --git a/.github/workflows/mutation.yml b/.github/workflows/mutation.yml new file mode 100644 index 000000000..f2e175250 --- /dev/null +++ b/.github/workflows/mutation.yml @@ -0,0 +1,32 @@ +name: Mutation Testing + +on: [pull_request] + +jobs: + tests: + runs-on: ubuntu-latest + + name: Mutation Testing Code Review Annotations + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 7.4 + tools: composer:v2 + extensions: pcov + coverage: pcov + + - name: Install dependencies + run: | + composer install --no-progress --no-suggest --no-interaction + + - name: Download Infection + run: composer infection-install + + - name: Run Infection for added files only + run: | + git fetch --depth=1 origin $GITHUB_BASE_REF + php build/infection.phar -j2 --git-diff-filter=AM --git-diff-base=origin/$GITHUB_BASE_REF --logger-github --only-covered diff --git a/composer.json b/composer.json index 5fd534f62..d6b784baa 100644 --- a/composer.json +++ b/composer.json @@ -173,6 +173,12 @@ "box-compile": [ "php build/box.phar compile" ], + "infection-install": [ + "curl -f -L https://github.com/infection/infection/releases/download/0.26.0/infection.phar -o build/infection.phar" + ], + "infection": [ + "XDEBUG_MODE=coverage php build/infection.phar --threads=8" + ], "cs": "phpcs", "cbf": "phpcbf", "unit": "phpunit tests/phpunit -vvv", diff --git a/composer.lock b/composer.lock index 9a508225c..8b7b5b7c1 100644 --- a/composer.lock +++ b/composer.lock @@ -10624,5 +10624,5 @@ "platform-overrides": { "php": "7.4" }, - "plugin-api-version": "2.2.0" + "plugin-api-version": "2.3.0" } diff --git a/infection.json b/infection.json new file mode 100644 index 000000000..acf084251 --- /dev/null +++ b/infection.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://raw.githubusercontent.com/infection/infection/0.26.0/resources/schema.json", + "source": { + "directories": [ + "src" + ] + }, + "mutators": { + "@default": true + } +} \ No newline at end of file