From e16d1fbe51db2db88c588f2b4591e1a7e1795e43 Mon Sep 17 00:00:00 2001 From: yaozm Date: Wed, 21 Jun 2023 10:38:37 +0800 Subject: [PATCH] Update github action config file --- .github/workflows/php-cs-fixer.yml | 6 +- .github/workflows/psalm.yml | 6 +- .github/workflows/rector.yml | 6 +- .php-cs-fixer.php | 4 + composer.json | 19 +++-- composer.lock | 75 ++++++++++++++++++- rector.php | 1 + vendor-bin/composer-unused/composer.json | 10 +++ .../php-conventional-changelog/composer.json | 5 ++ 9 files changed, 114 insertions(+), 18 deletions(-) create mode 100644 vendor-bin/composer-unused/composer.json create mode 100644 vendor-bin/php-conventional-changelog/composer.json diff --git a/.github/workflows/php-cs-fixer.yml b/.github/workflows/php-cs-fixer.yml index a0cafd4..38d82c3 100644 --- a/.github/workflows/php-cs-fixer.yml +++ b/.github/workflows/php-cs-fixer.yml @@ -23,10 +23,10 @@ jobs: key: composer-${{ hashFiles('composer.lock') }} - name: Run composer install - run: composer install --prefer-dist --ansi --no-interaction --no-scripts --ansi -v + run: composer install --prefer-dist --ansi --no-interaction --ansi -v - - name: Install global php-cs-fixer - run: composer global require friendsofphp/php-cs-fixer --prefer-dist --ansi --no-interaction --no-scripts +# - name: Install global php-cs-fixer +# run: composer global require friendsofphp/php-cs-fixer --prefer-dist --ansi --no-interaction --no-scripts - name: Run php-cs-fixer run: composer style-fix diff --git a/.github/workflows/psalm.yml b/.github/workflows/psalm.yml index be18581..5851aca 100644 --- a/.github/workflows/psalm.yml +++ b/.github/workflows/psalm.yml @@ -30,10 +30,10 @@ jobs: key: composer-${{ hashFiles('composer.lock') }} - name: Run composer install - run: composer install --prefer-dist --ansi --no-interaction --no-scripts --ansi -v + run: composer install --prefer-dist --ansi --no-interaction --ansi -v - - name: Install global psalm - run: composer global require vimeo/psalm --prefer-dist --ansi --no-interaction --no-scripts +# - name: Install global psalm +# run: composer global require vimeo/psalm --prefer-dist --ansi --no-interaction --no-scripts - name: Run psalm run: composer psalm diff --git a/.github/workflows/rector.yml b/.github/workflows/rector.yml index 132104f..ef2d25d 100644 --- a/.github/workflows/rector.yml +++ b/.github/workflows/rector.yml @@ -30,10 +30,10 @@ jobs: key: composer-${{ hashFiles('composer.lock') }} - name: Run composer install - run: composer install --prefer-dist --ansi --no-interaction --no-scripts --ansi -v + run: composer install --prefer-dist --ansi --no-interaction --ansi -v - - name: Install global rector - run: composer global require rector/rector --prefer-dist --ansi --no-interaction --no-scripts +# - name: Install global rector +# run: composer global require rector/rector --prefer-dist --ansi --no-interaction --no-scripts - name: Run rector run: composer rector-dry-run diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index a79c412..e1d49a3 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -65,6 +65,10 @@ // dd(json_encode($header, JSON_UNESCAPED_SLASHES)); +if (! is_dir($dir = __DIR__.'/build/php-cs-fixer') && ! mkdir($dir, 0777, true) && ! is_dir($dir)) { + throw new RuntimeException("The directory [$dir] was not created."); +} + // @see https://github.com/PHP-CS-Fixer/PHP-CS-Fixer // @see https://cs.symfony.com // @see https://mlocati.github.io/php-cs-fixer-configurator diff --git a/composer.json b/composer.json index 15791b0..9eb9f21 100644 --- a/composer.json +++ b/composer.json @@ -50,6 +50,7 @@ }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8", + "brainmaestro/composer-git-hooks": "^2.8", "guzzlehttp/guzzle": "^7.7", "illuminate/http": "^8.83 || ^9.0 || ^10.0", "illuminate/translation": "^8.83 || ^9.0 || ^10.0", @@ -129,7 +130,7 @@ ], "post-autoload-dump": [], "ai-commit": "@php ./builds/ai-commit commit --ansi", - "cghooks": "@php cghooks --ansi -v", + "cghooks": "@php ./vendor/bin/cghooks --ansi -v", "cghooks-install": [ "@cghooks add --ignore-lock", "@cghooks update" @@ -138,7 +139,7 @@ "@php -r \"file_exists('.git/hooks/pre-commit') and rename('.git/hooks/pre-commit', '.git/hooks/pre-commit.sample');\"", "@php -r \"file_exists('.git/hooks/post-merge') and rename('.git/hooks/post-merge', '.git/hooks/post-merge.sample');\"" ], - "changelog": "conventional-changelog --ansi -v", + "changelog": "@php ./vendor/bin/conventional-changelog --ansi -v", "changelog-major": "@changelog --major", "changelog-minor": "@changelog --minor", "changelog-patch": "@changelog --patch", @@ -150,6 +151,8 @@ "@mark-separate", "@composer-validate", "@mark-separate", + "@composer-unused", + "@mark-separate", "@style-lint", "@mark-separate", "@test", @@ -159,7 +162,7 @@ ], "composer-bin": "@composer bin --ansi -v", "composer-check-platform-reqs": "@composer check-platform-reqs --lock --ansi -v", - "composer-unused-checker": "@php ./vendor/bin/composer-unused --ansi -v", + "composer-unused": "@php ./vendor/bin/composer-unused --ansi -v", "composer-validate": "@composer validate --strict --ansi -v", "haulable": "haulable --ansi -v", "haulable-package": "@haulable package ./builds/ai-commit", @@ -174,20 +177,20 @@ "md-lint": "lint-md --config .lintmdrc ./*.md ./.github/ ./docs/", "pest": "@php ./vendor/bin/pest", "pest-coverage": "@pest --coverage-html=./build/phpunit/ --coverage-clover=clover.xml --coverage", - "phpstan": "phpstan analyse --ansi -v", + "phpstan": "@php ./vendor/bin/phpstan analyse --ansi -v", "phpstan-baseline": "@phpstan --generate-baseline --allow-empty-baseline", "post-merge": [ "@composer install" ], - "psalm": "psalm", + "psalm": "@php ./vendor/bin/psalm", "psalm-baseline": "@psalm --update-baseline", - "rector": "rector --clear-cache --ansi -v", + "rector": "@php ./vendor/bin/rector --clear-cache --ansi -v", "rector-dry-run": "@rector --dry-run", - "style-fix": "php-cs-fixer fix --using-cache=no --config=.php-cs-fixer.php --ansi -v", + "style-fix": "@php ./vendor/bin/php-cs-fixer fix --using-cache=yes --config=.php-cs-fixer.php --ansi -v", "style-lint": "@style-fix --diff --dry-run", "test": "@pest", "test-coverage": "@pest-coverage", - "var-dump-server": "var-dump-server --ansi -v", + "var-dump-server": "@php ./vendor/bin/var-dump-server --ansi -v", "vhs": [ "@cghooks-uninstall", "vhs < ai-commit.tape", diff --git a/composer.lock b/composer.lock index ff776f3..b92659d 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": "52d78272aa5d22b521d76b6871ff0648", + "content-hash": "bd84356f4955a820b6244f65ea2ba17d", "packages": [], "packages-dev": [ { @@ -64,6 +64,79 @@ }, "time": "2022-10-31T08:38:03+00:00" }, + { + "name": "brainmaestro/composer-git-hooks", + "version": "v2.8.5", + "source": { + "type": "git", + "url": "https://github.com/BrainMaestro/composer-git-hooks.git", + "reference": "ffed8803690ac12214082120eee3441b00aa390e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/BrainMaestro/composer-git-hooks/zipball/ffed8803690ac12214082120eee3441b00aa390e", + "reference": "ffed8803690ac12214082120eee3441b00aa390e", + "shasum": "" + }, + "require": { + "php": "^5.6 || >=7.0", + "symfony/console": "^3.2 || ^4.0 || ^5.0" + }, + "require-dev": { + "ext-json": "*", + "friendsofphp/php-cs-fixer": "^2.9", + "phpunit/phpunit": "^5.7 || ^7.0" + }, + "bin": [ + "cghooks" + ], + "type": "library", + "extra": { + "hooks": { + "pre-commit": "composer check-style", + "pre-push": [ + "composer test", + "appver=$(grep -o -E '\\d.\\d.\\d' cghooks)", + "tag=$(git describe --tags --abbrev=0)", + "if [ \"$tag\" != \"v$appver\" ]; then", + "echo \"The most recent tag $tag does not match the application version $appver\\n\"", + "tag=${tag#v}", + "sed -i -E \"s/$appver/$tag/\" cghooks", + "exit 1", + "fi" + ] + } + }, + "autoload": { + "files": [ + "src/helpers.php" + ], + "psr-4": { + "BrainMaestro\\GitHooks\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ezinwa Okpoechi", + "email": "brainmaestro@outlook.com" + } + ], + "description": "Easily manage git hooks in your composer config", + "keywords": [ + "HOOK", + "composer", + "git" + ], + "support": { + "issues": "https://github.com/BrainMaestro/composer-git-hooks/issues", + "source": "https://github.com/BrainMaestro/composer-git-hooks/tree/v2.8.5" + }, + "time": "2021-02-08T15:59:11+00:00" + }, { "name": "brick/math", "version": "0.9.3", diff --git a/rector.php b/rector.php index 89ef133..b923910 100644 --- a/rector.php +++ b/rector.php @@ -119,6 +119,7 @@ ], // paths + __DIR__.'/.php-cs-fixer.php', __DIR__.'/tests/AspectMock', '**/Fixture*', '**/Fixture/*', diff --git a/vendor-bin/composer-unused/composer.json b/vendor-bin/composer-unused/composer.json new file mode 100644 index 0000000..6412a14 --- /dev/null +++ b/vendor-bin/composer-unused/composer.json @@ -0,0 +1,10 @@ +{ + "require-dev": { + "icanhazstring/composer-unused": "^0.7" + }, + "config": { + "allow-plugins": { + "icanhazstring/composer-unused": true + } + } +} diff --git a/vendor-bin/php-conventional-changelog/composer.json b/vendor-bin/php-conventional-changelog/composer.json new file mode 100644 index 0000000..ccaa69a --- /dev/null +++ b/vendor-bin/php-conventional-changelog/composer.json @@ -0,0 +1,5 @@ +{ + "require-dev": { + "marcocesarato/php-conventional-changelog": "^1.17" + } +}