Skip to content

Commit 19d1032

Browse files
ci: add mutation testing workflow with Infection (#163)
- Configure workflow to fail if MSI is below 87% --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 6f62090 commit 19d1032

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

.github/workflows/test.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,47 @@ jobs:
125125

126126
- name: Run PHPStan
127127
run: vendor/bin/phpstan analyse
128+
129+
mutation-testing:
130+
name: Mutation Testing
131+
runs-on: ubuntu-24.04
132+
133+
steps:
134+
- name: Checkout code
135+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
136+
137+
- name: Setup PHP
138+
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2
139+
with:
140+
php-version: '8.2'
141+
extensions: json
142+
coverage: xdebug
143+
tools: composer:v2
144+
145+
- name: Get composer cache directory
146+
id: composer-cache
147+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
148+
149+
- name: Cache dependencies
150+
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5
151+
with:
152+
path: ${{ steps.composer-cache.outputs.dir }}
153+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
154+
restore-keys: ${{ runner.os }}-composer-
155+
156+
- name: Install dependencies
157+
run: composer update -n --prefer-dist
158+
159+
- name: Download Infection PHAR
160+
run: |
161+
wget https://github.com/infection/infection/releases/download/0.30.0/infection.phar
162+
wget https://github.com/infection/infection/releases/download/0.30.0/infection.phar.asc
163+
164+
- name: Validate Infection PHAR
165+
run: |
166+
gpg --keyserver hkps://keys.openpgp.org --recv-keys C6D76C329EBADE2FB9C458CFC5095986493B4AA0
167+
gpg --with-fingerprint --verify infection.phar.asc infection.phar
168+
chmod +x infection.phar
169+
170+
- name: Run mutation testing
171+
run: ./infection.phar --threads=max --min-msi=87 --min-covered-msi=87

0 commit comments

Comments
 (0)