Skip to content

Commit 551fa0a

Browse files
committed
ci: add mutation testing using infection/infection
1 parent 41f228a commit 551fa0a

File tree

5 files changed

+1841
-216
lines changed

5 files changed

+1841
-216
lines changed

.github/workflows/testing.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,56 @@ jobs:
131131

132132
- name: 🧪 Run unit tests using pestphp/pest
133133
run: composer test
134+
135+
mutation-testing:
136+
timeout-minutes: 16
137+
runs-on: ${{ matrix.os }}
138+
concurrency:
139+
cancel-in-progress: true
140+
group: mutation-testing-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
141+
strategy:
142+
fail-fast: true
143+
matrix:
144+
os:
145+
- ubuntu-latest
146+
php-version:
147+
- '8.1'
148+
dependencies:
149+
- locked
150+
steps:
151+
- name: 📦 Check out the codebase
152+
uses: actions/checkout@v4.1.5
153+
154+
- name: 🛠️ Setup PHP
155+
uses: shivammathur/setup-php@2.30.4
156+
with:
157+
php-version: ${{ matrix.php-version }}
158+
extensions: mbstring, pdo, pdo_sqlite
159+
ini-values: error_reporting=E_ALL
160+
coverage: xdebug
161+
162+
- name: 🛠️ Setup problem matchers
163+
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
164+
165+
- name: 🤖 Validate composer.json and composer.lock
166+
run: composer validate --ansi --strict
167+
168+
- name: 🔍 Get composer cache directory
169+
uses: wayofdev/gh-actions/actions/composer/get-cache-directory@v3.1.0
170+
171+
- name: ♻️ Restore cached dependencies installed with composer
172+
uses: actions/cache@v4.0.2
173+
with:
174+
path: ${{ env.COMPOSER_CACHE_DIR }}
175+
key: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}
176+
restore-keys: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-
177+
178+
- name: 📥 Install "${{ matrix.dependencies }}" dependencies
179+
uses: wayofdev/gh-actions/actions/composer/install@v3.1.0
180+
with:
181+
dependencies: ${{ matrix.dependencies }}
182+
183+
- name: 🧪 Run mutation testing using Xdebug and infection/infection
184+
run: composer infect:ci
185+
env:
186+
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}

composer.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@
2626
"phpstan/phpstan-deprecation-rules": "^1.2",
2727
"phpstan/phpstan-phpunit": "^1.4",
2828
"phpstan/phpstan-strict-rules": "^1.6",
29-
"phpunit/phpunit": "^10.5"
29+
"phpunit/phpunit": "^10.5",
30+
"psalm/plugin-phpunit": "~0.19.0",
31+
"roave/infection-static-analysis-plugin": "^1.35",
32+
"vimeo/psalm": "^5.23.1"
3033
},
3134
"autoload": {
3235
"psr-4": {
@@ -41,6 +44,7 @@
4144
"config": {
4245
"allow-plugins": {
4346
"ergebnis/composer-normalize": true,
47+
"infection/extension-installer": true,
4448
"pestphp/pest-plugin": true,
4549
"phpstan/extension-installer": true
4650
},

0 commit comments

Comments
 (0)