Skip to content

Commit

Permalink
Next-gen coding standard workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed May 25, 2023
1 parent 2003479 commit aa4e98e
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 466 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- name: "Lint"
run: "make lint"

coding-standards:
coding-standard:
name: "Coding Standard"

runs-on: "ubuntu-latest"
Expand All @@ -57,11 +57,17 @@ jobs:
- name: "Checkout"
uses: actions/checkout@v3

- name: "Checkout build-cs"
uses: actions/checkout@v3
with:
repository: "phpstan/build-cs"
path: "build-cs"

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "8.0"
php-version: "8.2"
ini-file: development

- name: "Validate Composer"
Expand All @@ -70,6 +76,10 @@ jobs:
- name: "Install dependencies"
run: "composer install --no-interaction --no-progress"

- name: "Install build-cs dependencies"
working-directory: "build-cs"
run: "composer install --no-interaction --no-progress"

- name: "Lint"
run: "make lint"

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/tests/tmp
/build-cs
/vendor
/composer.lock
.phpunit.result.cache
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,19 @@ lint:
--exclude tests/Rules/DeadCode/data/bug-383.php \
src tests

.PHONY: cs-install
cs-install:
git clone https://github.com/phpstan/build-cs.git || true
git -C build-cs fetch origin && git -C build-cs reset --hard origin/main
composer install --working-dir build-cs

.PHONY: cs
cs:
composer install --working-dir build-cs && php build-cs/vendor/bin/phpcs
php build-cs/vendor/bin/phpcs --standard=build-cs/phpcs.xml src tests

.PHONY: cs-fix
cs-fix:
php build-cs/vendor/bin/phpcbf
php build-cs/vendor/bin/phpcbf --standard=build-cs/phpcs.xml src tests

.PHONY: phpstan
phpstan:
Expand Down
1 change: 0 additions & 1 deletion build-cs/.gitignore

This file was deleted.

13 changes: 0 additions & 13 deletions build-cs/composer.json

This file was deleted.

Loading

0 comments on commit aa4e98e

Please sign in to comment.