Skip to content
Merged
Changes from 10 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
65 changes: 65 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,68 @@ 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 \
> infection.json5
cat infection.json5 | jq

- name: "Cache Result cache"
uses: actions/cache@v4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't going to save the cache if the build fails, right? Shouldn't we do what's recommended here? https://phpstan.org/user-guide/result-cache#setup-in-github-actions

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 $GITHUB_BASE_REF
infection \
--git-diff-base=origin/$GITHUB_BASE_REF \
--git-diff-lines \
--ignore-msi-with-no-mutations \
--min-msi=100 \
--min-covered-msi=100 \
--log-verbosity=all \
--debug \
--logger-text=php://stdout
Loading