@@ -197,3 +197,81 @@ jobs:
197197
198198 - name : " Tests"
199199 run : " make tests"
200+
201+ mutation-testing :
202+ name : " Mutation Testing"
203+ runs-on : " ubuntu-latest"
204+ needs : ["tests"]
205+ if : github.event_name == 'pull_request'
206+
207+ strategy :
208+ fail-fast : false
209+ matrix :
210+ php-version :
211+ - " 8.2"
212+ - " 8.3"
213+ - " 8.4"
214+ operating-system : [ubuntu-latest]
215+
216+ steps :
217+ - name : " Checkout"
218+ uses : actions/checkout@v5
219+
220+ - name : " Checkout build-infection"
221+ uses : actions/checkout@v5
222+ with :
223+ repository : " phpstan/build-infection"
224+ path : " build-infection"
225+ ref : " 1.x"
226+
227+ - uses : ./build-infection/.github/actions/setup-php
228+ with :
229+ php-version : " ${{ matrix.php-version }}"
230+ extensions : ds,mbstring
231+
232+ - name : " Install dependencies"
233+ run : " composer install --no-interaction --no-progress"
234+
235+ - name : " Install build-infection dependencies"
236+ working-directory : " build-infection"
237+ run : " composer install --no-interaction --no-progress"
238+
239+ - name : " Configure infection"
240+ run : |
241+ php build-infection/bin/infection-config.php \
242+ --source-directory='build/PHPStan/Build' \
243+ > infection.json5
244+ cat infection.json5 | jq
245+
246+ - name : " Determine default branch"
247+ id : default-branch
248+ run : |
249+ echo "name=$(git remote show origin | sed -n '/HEAD branch/s/.*: //p')" >> $GITHUB_OUTPUT
250+
251+ - name : " Restore result cache"
252+ uses : actions/cache/restore@v4
253+ with :
254+ path : ./tmp
255+ key : " result-cache-v1-${{ matrix.php-version }}-${{ github.run_id }}"
256+ restore-keys : |
257+ result-cache-v1-${{ matrix.php-version }}-
258+
259+ - name : " Run infection"
260+ run : |
261+ git fetch --depth=1 origin ${{ steps.default-branch.outputs.name }}
262+ infection \
263+ --git-diff-base=origin/${{ steps.default-branch.outputs.name }} \
264+ --git-diff-lines \
265+ --ignore-msi-with-no-mutations \
266+ --min-msi=100 \
267+ --min-covered-msi=100 \
268+ --log-verbosity=all \
269+ --debug \
270+ --logger-text=php://stdout
271+
272+ - name : " Save result cache"
273+ uses : actions/cache/save@v4
274+ if : ${{ !cancelled() }}
275+ with :
276+ path : ./tmp
277+ key : " result-cache-v1-${{ matrix.php-version }}-${{ github.run_id }}"
0 commit comments