Skip to content

Commit 4c80332

Browse files
committed
Setup mutation testing
1 parent c81e395 commit 4c80332

File tree

3 files changed

+65
-1
lines changed

3 files changed

+65
-1
lines changed

.github/workflows/build.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,3 +213,64 @@ jobs:
213213

214214
- name: "PHPStan"
215215
run: "make phpstan"
216+
217+
mutation-testing:
218+
name: "Mutation Testing"
219+
runs-on: "ubuntu-latest"
220+
needs: ["tests", "static-analysis"]
221+
222+
strategy:
223+
fail-fast: false
224+
matrix:
225+
php-version:
226+
- "8.2"
227+
- "8.3"
228+
- "8.4"
229+
operating-system: [ubuntu-latest]
230+
231+
steps:
232+
- name: "Checkout"
233+
uses: actions/checkout@v5
234+
235+
- name: "Install PHP"
236+
uses: "shivammathur/setup-php@v2"
237+
with:
238+
coverage: "pcov"
239+
php-version: "${{ matrix.php-version }}"
240+
tools: pecl, infection:0.31.7
241+
extensions: mbstring
242+
ini-file: development
243+
ini-values: memory_limit=-1
244+
245+
- name: "Install dependencies"
246+
run: "composer install --no-interaction --no-progress"
247+
248+
- name: "Checkout build-infection"
249+
uses: actions/checkout@v5
250+
with:
251+
repository: "phpstan/build-infection"
252+
path: "build-infection"
253+
ref: "1.x"
254+
255+
- name: "Install build-infection dependencies"
256+
working-directory: "build-infection"
257+
run: "composer install --no-interaction --no-progress"
258+
259+
- name: "Configure infection"
260+
run: |
261+
php build-infection/bin/infection-config.php \
262+
> infection.json5
263+
cat infection.json5 | jq
264+
265+
- name: "Run infection"
266+
run: |
267+
git fetch --depth=1 origin $GITHUB_BASE_REF
268+
infection \
269+
--git-diff-base=origin/$GITHUB_BASE_REF \
270+
--git-diff-lines \
271+
--ignore-msi-with-no-mutations \
272+
--min-msi=100 \
273+
--min-covered-msi=100 \
274+
--log-verbosity=all \
275+
--debug \
276+
--logger-text=php://stdout

phpstan.neon

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ includes:
99
parameters:
1010
reportUnmatchedIgnoredErrors: false
1111

12+
resultCachePath: tmp/resultCache.php
13+
1214
excludePaths:
1315
- tests/*/data/*
1416
ignoreErrors:

phpunit.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
beStrictAboutTodoAnnotatedTests="true"
1111
failOnRisky="true"
1212
failOnWarning="true"
13-
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xml"
13+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
14+
executionOrder="random"
1415
>
1516
<testsuites>
1617
<testsuite name="PHPStan for PHPUnit">

0 commit comments

Comments
 (0)