Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
73 changes: 73 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
branches:
- "2.0.x"

concurrency:
group: build-${{ github.head_ref || github.run_id }} # will be canceled on subsequent pushes in pull requests but not branches
cancel-in-progress: true

jobs:
lint:
name: "Lint"
Expand Down Expand Up @@ -159,3 +163,72 @@ jobs:

- name: "PHPStan"
run: "make phpstan"

mutation-testing:
name: "Mutation Testing"
runs-on: "ubuntu-latest"
needs: ["tests", "static-analysis"]

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: "Install PHP"
Copy link
Member

Choose a reason for hiding this comment

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

Please use the composite action, same way it's used here (the commit first moves "Checkout build-infection" right after "Checkout", then we can use a local path to the composite action): phpstan/phpstan-doctrine#704

uses: "shivammathur/setup-php@v2"
with:
coverage: "pcov"
php-version: "${{ matrix.php-version }}"
tools: pecl, infection:0.31.7
extensions: mbstring
ini-file: development
ini-values: memory_limit=-1

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

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

- 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
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
2 changes: 2 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ includes:
- vendor/phpstan/phpstan-phpunit/extension.neon

parameters:
resultCachePath: tmp/resultCache.php

excludePaths:
- tests/*/data/*
3 changes: 2 additions & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
beStrictAboutTodoAnnotatedTests="true"
failOnRisky="true"
failOnWarning="true"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xml"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
executionOrder="random"
>
<coverage>
<include>
Expand Down