diff --git a/.gitattributes b/.gitattributes index 487a6337..b078d9ea 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,5 @@ .* export-ignore +infection.json export-ignore Makefile export-ignore phpstan.neon export-ignore phpunit.xml.dist export-ignore diff --git a/.github/settings.yml b/.github/settings.yml index 84f44dbb..415f20c8 100644 --- a/.github/settings.yml +++ b/.github/settings.yml @@ -21,6 +21,8 @@ branches: - "Tests (7.4, lowest)" - "Tests (7.4, highest)" - "Code Coverage (7.4)" + - "Mutation Tests (7.4)" + - "Mutation Tests (7.4)" strict: true required_pull_request_reviews: null diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 76ba1329..a3f1774c 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -182,3 +182,38 @@ jobs: env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} run: bash <(curl -s https://codecov.io/bash) + + mutation-tests: + name: "Mutation Tests" + + runs-on: ubuntu-latest + + strategy: + matrix: + php-version: + - 7.4 + + steps: + - name: "Checkout" + uses: actions/checkout@v1 + + - name: "Install PHP with extensions" + uses: shivammathur/setup-php@v1 + with: + coverage: pcov + extensions: "mbstring" + php-version: ${{ matrix.php-version }} + + - name: "Cache dependencies installed with composer" + uses: actions/cache@v1 + with: + path: ~/.composer/cache + key: php${{ matrix.php-version }}-composer- + restore-keys: | + php${{ matrix.php-version }}-composer- + + - name: "Install locked dependencies with composer" + run: composer install --no-interaction --no-progress --no-suggest + + - name: "Run mutation tests with pcov and infection/infection" + run: vendor/bin/infection --ignore-msi-with-no-mutations --min-covered-msi=25 --min-msi=18 diff --git a/infection.json b/infection.json new file mode 100644 index 00000000..418c43a3 --- /dev/null +++ b/infection.json @@ -0,0 +1,11 @@ +{ + "timeout": 10, + "source": { + "directories": [ + "src" + ] + }, + "logs": { + "text": "build/infection/infection-log.txt" + } +} diff --git a/vendor-bin/test/composer.json b/vendor-bin/test/composer.json index 97741b9e..5aeb8b8b 100644 --- a/vendor-bin/test/composer.json +++ b/vendor-bin/test/composer.json @@ -1,5 +1,6 @@ { "require": { + "infection/infection": "^0.15", "matthiasnoback/symfony-dependency-injection-test": "^4.0", "phpunit/phpunit": "^8.2", "symfony/phpunit-bridge": "^4.1"