diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ae3653a..9008356 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,22 +25,13 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-versions }} - tools: composer:v2 + tools: composer:v1 coverage: xdebug - name: Install Composer dependencies run: composer install - - name: Linting code - run: ./vendor/bin/phing lint - - - name: Codesniffer - run: ./vendor/bin/phing sniff - - - name: Static code analysis - run: ./vendor/bin/phing analyse - - - name: Magerun + - name: Install Magerun if: matrix.coveralls == false run: | wget https://files.magerun.net/n98-magerun2-latest.phar @@ -48,20 +39,26 @@ jobs: ln -s $(pwd) ~/.n98-magerun2/modules/magerun2-password-normalizer php n98-magerun2-latest.phar help dev:customer:normalize-passwords + - name: Codesniffer + run: composer cs-check + + - name: Static code analysis + run: composer analyze + - name: Unittests if: matrix.coveralls == false - run: ./vendor/bin/phing unit - - - name: Unittests with coverage - if: matrix.coveralls == true - run: ./vendor/bin/phing unit-with-coverage + run: composer test - name: Infection for added files env: INFECTION_BADGE_API_KEY: ${{ secrets.INFECTION_BADGE_API_KEY }} run: | git fetch --depth=1 origin $GITHUB_BASE_REF - ./vendor/bin/infection -j2 --git-diff-filter=A --git-diff-base=origin/$GITHUB_BASE_REF --logger-github --ignore-msi-with-no-mutations --only-covered + ./vendor/bin/infection -j4 --git-diff-filter=A --git-diff-base=origin/$GITHUB_BASE_REF --logger-github --ignore-msi-with-no-mutations --only-covered + + - name: Unittests with coverage + if: matrix.coveralls == true + run: composer coverage - name: Coveralls report if: matrix.coveralls == true diff --git a/build.xml b/build.xml deleted file mode 100644 index a2186f0..0000000 --- a/build.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/captainhook.json b/captainhook.json index e53bb86..4157c93 100644 --- a/captainhook.json +++ b/captainhook.json @@ -15,12 +15,22 @@ "enabled": true, "actions": [ { - "action": "./vendor/bin/phing analyse", + "action": "composer analyze", "options": [] }, { - "action": "./vendor/bin/phing infection", + "action": "composer test", "options": [] + }, + { + "action": "\\bitExpert\\CaptainHook\\Infection\\InfectionAction", + "options": { + "args": [ + "-j4", + "--ignore-msi-with-no-mutations", + " --only-covered" + ] + } } ] }, @@ -28,16 +38,40 @@ "enabled": true, "actions": [ { - "action": "./vendor/bin/phing lint", - "options": [] + "action": "\\CaptainHook\\App\\Hook\\PHP\\Action\\Linting", + "options": [], + "conditions": [ + { + "exec": "\\CaptainHook\\App\\Hook\\Condition\\FileStaged\\OfType", + "args": ["php"] + } + ] }, { - "action": "./vendor/bin/phing sniff", - "options": [] + "action": "composer cs-check {$STAGED_FILES|of-type:php|separated-by: }", + "options": [], + "conditions": [ + { + "exec": "\\CaptainHook\\App\\Hook\\Condition\\FileStaged\\OfType", + "args": ["php"] + } + ] }, { - "action": "./vendor/bin/phing unit", - "options": [] + "action": "\\bitExpert\\CaptainHook\\Infection\\InfectionAction", + "options": { + "args": [ + "-j4", + "--ignore-msi-with-no-mutations", + " --only-covered" + ] + }, + "conditions": [ + { + "exec": "\\CaptainHook\\App\\Hook\\Condition\\FileStaged\\OfType", + "args": ["php"] + } + ] } ] }, @@ -52,5 +86,25 @@ "post-merge": { "enabled": false, "actions": [] + }, + "post-change": { + "enabled": true, + "actions": [ + { + "action": "composer install", + "options": [], + "conditions": [ + { + "exec": "\\CaptainHook\\App\\Hook\\Condition\\FileChanged\\Any", + "args": [ + [ + "composer.json", + "composer.lock" + ] + ] + } + ] + } + ] } } diff --git a/composer.json b/composer.json index 14d24ea..edea2d4 100644 --- a/composer.json +++ b/composer.json @@ -31,14 +31,14 @@ "n98/magerun2": "^4.0.0", "phpunit/phpunit": "^9.5", "squizlabs/php_codesniffer": "^3.5", - "phing/phing": "^2.16", "phpstan/phpstan": "^0.12.68", "phpstan/extension-installer": "^1.1", "captainhook/captainhook": "^5.4", "captainhook/plugin-composer": "^5.2", "bitexpert/phpstan-magento": "^0.6.0", "roave/security-advisories": "dev-latest", - "infection/infection": "^0.21.0" + "infection/infection": "^0.21.0", + "bitexpert/captainhook-infection": "^0.1.0" }, "repositories": [ { @@ -61,8 +61,11 @@ "@cs-check", "@test" ], - "cs-check": "vendor/bin/phing sniff", + "cs-check": "vendor/bin/phpcs --standard=PSR2 ./src ./tests", "cs-fix": "vendor/bin/phpcbf", - "test": "vendor/bin/phing unit" + "analyze": "vendor/bin/phpstan analyze", + "test": "vendor/bin/phpunit", + "infection": "vendor/bin/infection -j4 --ignore-msi-with-no-mutations --only-covered", + "coverage": "vendor/bin/phpunit --coverage-clover clover.xml" } } diff --git a/composer.lock b/composer.lock index 02eacfc..2f0f2d3 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "4196425fad0a34f7e9f20f2cdb210d9f", + "content-hash": "bdc259d9a03943a5479ca0d10e7290f6", "packages": [ { "name": "colinmollenhour/credis", @@ -6130,6 +6130,53 @@ ], "time": "2019-01-01T23:59:15+00:00" }, + { + "name": "bitexpert/captainhook-infection", + "version": "v0.1.0", + "source": { + "type": "git", + "url": "https://github.com/bitExpert/captainhook-infection.git", + "reference": "08469ffe0298df7c35e53ded40cf7c384b869bf9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bitExpert/captainhook-infection/zipball/08469ffe0298df7c35e53ded40cf7c384b869bf9", + "reference": "08469ffe0298df7c35e53ded40cf7c384b869bf9", + "shasum": "" + }, + "require": { + "captainhook/captainhook": "^5.4", + "php": "^7.4.0|^8.0.0" + }, + "require-dev": { + "captainhook/plugin-composer": "^5.2", + "infection/infection": "^0.21.0", + "phing/phing": "^2.16.0", + "phpstan/phpstan": "^0.12", + "phpunit/phpunit": "^9.5", + "roave/security-advisories": "dev-latest", + "squizlabs/php_codesniffer": "^3.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "bitExpert\\CaptainHook\\Infection\\": "src/bitExpert/CaptainHook/Infection" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Stephan Hochdörfer", + "email": "S.Hochdoerfer@bitExpert.de", + "homepage": "http://www.bitExpert.de" + } + ], + "description": "Captain Hook Plugin to run InfectionPHP only against the files of the current changeset", + "time": "2021-01-30T15:35:39+00:00" + }, { "name": "bitexpert/phpstan-magento", "version": "v0.6.0", @@ -7027,34 +7074,37 @@ }, { "name": "ocramius/package-versions", - "version": "2.1.0", + "version": "1.9.0", "source": { "type": "git", "url": "https://github.com/Ocramius/PackageVersions.git", - "reference": "a7e35c34bc166a5684a1e2f13da7b1d6a821349d" + "reference": "94c9d42a466c57f91390cdd49c81313264f49d85" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/a7e35c34bc166a5684a1e2f13da7b1d6a821349d", - "reference": "a7e35c34bc166a5684a1e2f13da7b1d6a821349d", + "url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/94c9d42a466c57f91390cdd49c81313264f49d85", + "reference": "94c9d42a466c57f91390cdd49c81313264f49d85", "shasum": "" }, "require": { - "composer-runtime-api": "^2.0.0", - "php": "^7.4.7 || ~8.0.0" - }, - "replace": { - "composer/package-versions-deprecated": "*" + "composer-plugin-api": "^1.1.0 || ^2.0", + "php": "^7.4.0" }, "require-dev": { - "composer/composer": "^2.0.0@dev", - "doctrine/coding-standard": "^8.1.0", + "composer/composer": "^1.9.3 || ^2.0@dev", + "doctrine/coding-standard": "^7.0.2", "ext-zip": "^1.15.0", - "infection/infection": "dev-master#8d6c4d6b15ec58d3190a78b7774a5d604ec1075a", - "phpunit/phpunit": "~9.3.11", - "vimeo/psalm": "^4.0.1" + "infection/infection": "^0.15.3", + "phpunit/phpunit": "^9.1.1", + "vimeo/psalm": "^3.9.3" + }, + "type": "composer-plugin", + "extra": { + "class": "PackageVersions\\Installer", + "branch-alias": { + "dev-master": "1.99.x-dev" + } }, - "type": "library", "autoload": { "psr-4": { "PackageVersions\\": "src/PackageVersions" @@ -7070,11 +7120,7 @@ "email": "ocramius@gmail.com" } ], - "description": "Provides efficient querying for installed package versions (no runtime IO)", - "support": { - "issues": "https://github.com/Ocramius/PackageVersions/issues", - "source": "https://github.com/Ocramius/PackageVersions/tree/2.1.0" - }, + "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", "funding": [ { "url": "https://github.com/Ocramius", @@ -7085,7 +7131,7 @@ "type": "tidelift" } ], - "time": "2020-10-21T13:48:04+00:00" + "time": "2020-06-22T14:15:44+00:00" }, { "name": "ondram/ci-detector", @@ -7306,99 +7352,6 @@ "description": "Library for handling version information and constraints", "time": "2020-12-13T23:18:30+00:00" }, - { - "name": "phing/phing", - "version": "2.16.3", - "source": { - "type": "git", - "url": "https://github.com/phingofficial/phing.git", - "reference": "b34c2bf9cd6abd39b4287dee31e68673784c8567" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phingofficial/phing/zipball/b34c2bf9cd6abd39b4287dee31e68673784c8567", - "reference": "b34c2bf9cd6abd39b4287dee31e68673784c8567", - "shasum": "" - }, - "require": { - "php": ">=5.2.0" - }, - "require-dev": { - "ext-pdo_sqlite": "*", - "mikey179/vfsstream": "^1.6", - "pdepend/pdepend": "2.x", - "pear/archive_tar": "1.4.x", - "pear/http_request2": "dev-trunk", - "pear/net_growl": "dev-trunk", - "pear/pear-core-minimal": "1.10.1", - "pear/versioncontrol_git": "@dev", - "pear/versioncontrol_svn": "~0.5", - "phpdocumentor/phpdocumentor": "2.x", - "phploc/phploc": "~2.0.6", - "phpmd/phpmd": "~2.2", - "phpunit/phpunit": ">=3.7", - "sebastian/git": "~1.0", - "sebastian/phpcpd": "2.x", - "siad007/versioncontrol_hg": "^1.0", - "simpletest/simpletest": "^1.1", - "squizlabs/php_codesniffer": "~2.2", - "symfony/yaml": "^2.8 || ^3.1 || ^4.0" - }, - "suggest": { - "pdepend/pdepend": "PHP version of JDepend", - "pear/archive_tar": "Tar file management class", - "pear/versioncontrol_git": "A library that provides OO interface to handle Git repository", - "pear/versioncontrol_svn": "A simple OO-style interface for Subversion, the free/open-source version control system", - "phpdocumentor/phpdocumentor": "Documentation Generator for PHP", - "phploc/phploc": "A tool for quickly measuring the size of a PHP project", - "phpmd/phpmd": "PHP version of PMD tool", - "phpunit/php-code-coverage": "Library that provides collection, processing, and rendering functionality for PHP code coverage information", - "phpunit/phpunit": "The PHP Unit Testing Framework", - "sebastian/phpcpd": "Copy/Paste Detector (CPD) for PHP code", - "siad007/versioncontrol_hg": "A library for interfacing with Mercurial repositories.", - "tedivm/jshrink": "Javascript Minifier built in PHP" - }, - "bin": [ - "bin/phing" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.16.x-dev" - } - }, - "autoload": { - "classmap": [ - "classes/phing/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "classes" - ], - "license": [ - "LGPL-3.0-only" - ], - "authors": [ - { - "name": "Michiel Rook", - "email": "mrook@php.net" - }, - { - "name": "Phing Community", - "homepage": "https://www.phing.info/trac/wiki/Development/Contributors" - } - ], - "description": "PHing Is Not GNU make; it's a PHP project build system or build tool based on Apache Ant.", - "homepage": "https://www.phing.info/", - "keywords": [ - "build", - "phing", - "task", - "tool" - ], - "time": "2020-02-03T18:50:54+00:00" - }, { "name": "phpdocumentor/reflection-common", "version": "2.2.0", @@ -10587,5 +10540,5 @@ "php": "^7.4" }, "platform-dev": [], - "plugin-api-version": "2.0.0" + "plugin-api-version": "1.1.0" }