diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index db0977e..3709a74 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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" @@ -159,3 +163,67 @@ 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: "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: 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 + 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 diff --git a/phpstan.neon b/phpstan.neon index 3e184cd..4a083f0 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -5,5 +5,7 @@ includes: - vendor/phpstan/phpstan-phpunit/extension.neon parameters: + resultCachePath: tmp/resultCache.php + excludePaths: - tests/*/data/* diff --git a/phpunit.xml b/phpunit.xml index edb71a8..ae3db0d 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -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" >