From 14fee2bd14dfedb92254169c19689c45d06da572 Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Fri, 20 Nov 2026 19:24:39 +0400 Subject: [PATCH 1/3] chore: install Infection with the Testo adapter The adapter hands testFrameworkOptions to Testo as a single argument, so several --suite flags cannot be listed there; DB_DRIVERS=sqlite in the scripts registers only the SQLite suites next to Unit, which CI runs without database servers. Assisted-By: Claude Opus 5.5 --- composer.json | 14 ++++++++++++++ infection.json | 18 ++++++++++++++++++ vendor-bin/infection/.gitignore | 4 ++++ vendor-bin/infection/composer.json | 11 +++++++++++ 4 files changed, 47 insertions(+) create mode 100644 infection.json create mode 100644 vendor-bin/infection/.gitignore create mode 100644 vendor-bin/infection/composer.json diff --git a/composer.json b/composer.json index 205b268..6c97f38 100644 --- a/composer.json +++ b/composer.json @@ -57,6 +57,18 @@ "cs:fix": "php-cs-fixer fix -v --config=vendor-bin/code-style/.php-cs-fixer.dist.php", "db:down": "docker compose -f vendor/cycle/testing/resources/docker/compose.yaml down -v", "db:up": "docker compose -f vendor/cycle/testing/resources/docker/compose.yaml up -d --wait", + "infect": [ + "Composer\\Config::disableProcessTimeout", + "@putenv XDEBUG_MODE=coverage", + "@putenv DB_DRIVERS=sqlite", + "infection --configuration=infection.json --threads=max" + ], + "infect:ci": [ + "Composer\\Config::disableProcessTimeout", + "@putenv XDEBUG_MODE=coverage", + "@putenv DB_DRIVERS=sqlite", + "infection --ansi --configuration=infection.json --logger-github --threads=max --show-mutations=0" + ], "psalm": "psalm -c vendor-bin/psalm/psalm.xml", "psalm:baseline": "psalm -c vendor-bin/psalm/psalm.xml --set-baseline=vendor-bin/psalm/psalm-baseline.xml", "psalm:ci": "psalm -c vendor-bin/psalm/psalm.xml --output-format=github --shepherd --show-info=false --stats --threads=4", @@ -69,6 +81,8 @@ "test:unit": "testo --suite=Unit" }, "scripts-descriptions": { + "infect": "Run mutation testing with Infection against the Unit and SQLite suites", + "infect:ci": "Run mutation testing in CI: GitHub annotations, the Stryker dashboard report and the MSI gate", "test:new-case": "Generate a regression case for an issue: composer test:new-case -- " }, "minimum-stability": "dev", diff --git a/infection.json b/infection.json new file mode 100644 index 0000000..0dec2b2 --- /dev/null +++ b/infection.json @@ -0,0 +1,18 @@ +{ + "$schema": "vendor-bin/infection/vendor/infection/infection/resources/schema.json", + "source": { + "directories": [ + "src" + ] + }, + "timeout": 10, + "minMsi": 95, + "minCoveredMsi": 95, + "testFramework": "testo", + "tmpDir": "runtime", + "logs": { + "stryker": { + "report": "4.x" + } + } +} diff --git a/vendor-bin/infection/.gitignore b/vendor-bin/infection/.gitignore new file mode 100644 index 0000000..d4da745 --- /dev/null +++ b/vendor-bin/infection/.gitignore @@ -0,0 +1,4 @@ +/vendor/ +/composer.lock +/.*/ +/skills.json diff --git a/vendor-bin/infection/composer.json b/vendor-bin/infection/composer.json new file mode 100644 index 0000000..8436e13 --- /dev/null +++ b/vendor-bin/infection/composer.json @@ -0,0 +1,11 @@ +{ + "require": { + "infection/infection": "^0.35", + "testo/bridge-infection": "^0.1.9" + }, + "config": { + "allow-plugins": { + "infection/extension-installer": true + } + } +} From ff00ec9a3bb14143ebcdfb0d9f62f3ec71ed8762 Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Fri, 20 Nov 2026 19:24:40 +0400 Subject: [PATCH 2/3] ci: run mutation testing through the shared cycle/gh-actions workflow Assisted-By: Claude Opus 5.5 --- .github/workflows/infection.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/infection.yml diff --git a/.github/workflows/infection.yml b/.github/workflows/infection.yml new file mode 100644 index 0000000..0acdb7b --- /dev/null +++ b/.github/workflows/infection.yml @@ -0,0 +1,24 @@ +--- + +on: # yamllint disable-line rule:truthy + pull_request: + push: + branches: + - 4.x + +name: 🧬 Mutation Tests + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +permissions: + contents: read + +jobs: + infection: + name: Infection + uses: cycle/gh-actions/.github/workflows/infection.yml@master + secrets: inherit + +... From a56663791cbd2cd7f8dee759f1ad8ef915608e68 Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Fri, 20 Nov 2026 19:24:41 +0400 Subject: [PATCH 3/3] docs: add the mutation testing badge Assisted-By: Claude Opus 5.5 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6b7b5f8..978d696 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ [![Psalm Level](https://shepherd.dev/github/cycle/migrations/level.svg)](https://shepherd.dev/github/cycle/migrations) [![Type Coverage](https://shepherd.dev/github/cycle/migrations/coverage.svg)](https://shepherd.dev/github/cycle/migrations) [![Codecov](https://img.shields.io/codecov/c/github/cycle/migrations/4.x?style=flat-square&logo=codecov)](https://codecov.io/gh/cycle/migrations/tree/4.x) +[![Mutation testing badge](https://img.shields.io/endpoint?style=flat-square&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fcycle%2Fmigrations%2F4.x)](https://dashboard.stryker-mutator.io/reports/github.com/cycle/migrations/4.x)