Skip to content

Commit c854598

Browse files
committed
ci: run mutation tests with Infection
Infection is installed in the workflow rather than from the phar or require-dev: the phar's Testo adapter calls the unscoped IncludeInterceptor and fails every mutant, and Infection needs PHP 8.3+ while the package supports 8.2. Assisted-By: Claude Opus 5.5
1 parent a3236f3 commit c854598

4 files changed

Lines changed: 70 additions & 0 deletions

File tree

‎.gitattributes‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
.travis.yml export-ignore
77
testo.php export-ignore
88
monorepo-builder.php export-ignore
9+
infection.json5 export-ignore

‎.github/workflows/mutation.yml‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
3+
name: Mutation Tests
4+
5+
on: # yamllint disable-line rule:truthy
6+
pull_request:
7+
push:
8+
branches: [2.x]
9+
10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
15+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
16+
17+
jobs:
18+
mutation:
19+
name: Infection
20+
runs-on: ubuntu-latest
21+
timeout-minutes: 15
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v5
25+
with:
26+
persist-credentials: false
27+
28+
- name: Setup PHP
29+
uses: shivammathur/setup-php@v2
30+
with:
31+
php-version: '8.4'
32+
extensions: sockets
33+
coverage: xdebug
34+
ini-values: memory_limit=-1
35+
36+
- name: Install Composer dependencies
37+
uses: ramsey/composer-install@v3
38+
with:
39+
dependency-versions: highest
40+
41+
# The Infection phar is unusable with Testo: its bundled adapter calls the
42+
# unscoped \Infection\StreamWrapper\IncludeInterceptor. Infection requires
43+
# PHP 8.3+, so it is installed here instead of in require-dev.
44+
- name: Install Infection
45+
run: |
46+
composer config allow-plugins.infection/extension-installer true
47+
composer require --dev --no-interaction --no-progress -W infection/infection testo/bridge-infection
48+
49+
- name: Run Infection
50+
run: vendor/bin/infection --threads=max --logger-github --show-mutations=0 --min-msi=85 --min-covered-msi=85
51+
env:
52+
STRYKER_DASHBOARD_API_KEY: ${{ github.event_name == 'push' && secrets.STRYKER_DASHBOARD_API_KEY || '' }}

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
[![Psalm Level](https://shepherd.dev/github/roadrunner-php/services/level.svg)](https://shepherd.dev/github/roadrunner-php/services)
1616
[![Type Coverage](https://shepherd.dev/github/roadrunner-php/services/coverage.svg)](https://shepherd.dev/github/roadrunner-php/services)
1717
[![Codecov](https://codecov.io/gh/roadrunner-php/services/branch/2.x/graph/badge.svg)](https://codecov.io/gh/roadrunner-php/services/branch/2.x)
18+
[![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Froadrunner-php%2Fservices%2F2.x)](https://dashboard.stryker-mutator.io/reports/github.com/roadrunner-php/services/2.x)
1819

1920
</div>
2021

‎infection.json5‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/infection/infection/0.35.6/resources/schema.json",
3+
"source": {
4+
"directories": ["src"]
5+
},
6+
"testFramework": "testo",
7+
"tmpDir": "runtime",
8+
"timeout": 10,
9+
"logs": {
10+
"text": "runtime/infection.log",
11+
"github": true,
12+
"stryker": {
13+
"report": "2.x"
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)