Skip to content

Commit

Permalink
Create separate composer.json files for PHP CS Fixer & PHPStan
Browse files Browse the repository at this point in the history
  • Loading branch information
jmsche committed Nov 29, 2023
1 parent 60c8166 commit 24cb330
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
/tests export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
/tools export-ignore
41 changes: 33 additions & 8 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,44 @@ jobs:
phpstan:
name: PHPStan
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@master
- name: PHPStan
uses: docker://jakzal/phpqa:php8.2
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2

- name: Download dependencies
uses: ramsey/composer-install@v2

- name: Install PHPStan
uses: ramsey/composer-install@v2
with:
args: phpstan analyze --no-progress
composer-options: "--working-dir=tools/phpstan"

- name: PHPStan
run: tools/phpstan/vendor/bin/phpstan analyze --no-progress --error-format=checkstyle

php-cs-fixer:
name: PHP-CS-Fixer
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@master
- name: PHP-CS-Fixer
uses: docker://jakzal/phpqa:php8.2
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
args: php-cs-fixer fix --config=.php_cs.dist.php --dry-run --diff
php-version: 8.2

- name: Install php-cs-fixer
uses: ramsey/composer-install@v2
with:
composer-options: "--working-dir=tools/php-cs-fixer"

- name: PHP-CS-Fixer
run: tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --dry-run --diff --config=.php_cs.dist.php
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/.idea/
/.php_cs.cache
/.php-cs-fixer.cache
/.phpunit.result.cache
/composer.lock
/composer.phar
/phpunit.xml
/tools/*/composer.lock
/tools/*/vendor
/vendor/
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ help:
| awk 'BEGIN {FS = ":.*?## "}; {printf " \033[32m%s\033[0m___%s\n", $$1, $$2}' | column -ts___

cs-lint: ## Verify check styles
@docker run --rm -v $(DIR):/project -w /project $(QA_IMAGE) php-cs-fixer fix --allow-risky=yes --dry-run -vvv
composer install --working-dir=tools/php-cs-fixer
tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --dry-run --diff --config=.php_cs.dist.php

cs-fix: ## Apply Check styles
@docker run --rm -v $(DIR):/project -w /project $(QA_IMAGE) php-cs-fixer fix --config=.php_cs.dist.php --allow-risky=yes -vvv
composer install --working-dir=tools/php-cs-fixer
tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --diff --config=.php_cs.dist.php

phpstan: ## Run PHPStan
@docker run --rm -v $(DIR):/project -w /project $(QA_IMAGE) phpstan analyse
composer install --working-dir=tools/phpstan
tools/phpstan/vendor/bin/phpstan analyze

phpunit: ## Run phpunit
-./vendor/bin/phpunit
Expand Down
5 changes: 5 additions & 0 deletions tools/php-cs-fixer/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"require": {
"friendsofphp/php-cs-fixer": "^3.40"
}
}
5 changes: 5 additions & 0 deletions tools/phpstan/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"require": {
"phpstan/phpstan": "^1.10.46"
}
}

0 comments on commit 24cb330

Please sign in to comment.