Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,81 @@ jobs:

- name: "Tests"
run: "make tests"

mutation-testing:
name: "Mutation Testing"
runs-on: "ubuntu-latest"
needs: ["tests"]
if: github.event_name == 'pull_request'

strategy:
fail-fast: false
matrix:
php-version:
- "8.2"
- "8.3"
- "8.4"
operating-system: [ubuntu-latest]

steps:
- name: "Checkout"
uses: actions/checkout@v5

- name: "Checkout build-infection"
uses: actions/checkout@v5
with:
repository: "phpstan/build-infection"
path: "build-infection"
ref: "1.x"

- uses: ./build-infection/.github/actions/setup-php
with:
php-version: "${{ matrix.php-version }}"
extensions: ds,mbstring

- name: "Install dependencies"
run: "composer install --no-interaction --no-progress"

- name: "Install build-infection dependencies"
working-directory: "build-infection"
run: "composer install --no-interaction --no-progress"

- name: "Configure infection"
run: |
php build-infection/bin/infection-config.php \
--source-directory='build/PHPStan/Build' \
> infection.json5
cat infection.json5 | jq

- name: "Determine default branch"
id: default-branch
run: |
echo "name=$(git remote show origin | sed -n '/HEAD branch/s/.*: //p')" >> $GITHUB_OUTPUT

- name: "Restore result cache"
uses: actions/cache/restore@v4
with:
path: ./tmp
key: "result-cache-v1-${{ matrix.php-version }}-${{ github.run_id }}"
restore-keys: |
result-cache-v1-${{ matrix.php-version }}-

- name: "Run infection"
run: |
git fetch --depth=1 origin ${{ steps.default-branch.outputs.name }}
infection \
--git-diff-base=origin/${{ steps.default-branch.outputs.name }} \
--git-diff-lines \
--ignore-msi-with-no-mutations \
--min-msi=100 \
--min-covered-msi=100 \
--log-verbosity=all \
--debug \
--logger-text=php://stdout

- name: "Save result cache"
uses: actions/cache/save@v4
if: ${{ !cancelled() }}
with:
path: ./tmp
key: "result-cache-v1-${{ matrix.php-version }}-${{ github.run_id }}"
Loading