Skip to content

Commit aa4e98e

Browse files
committed
Next-gen coding standard workflow
1 parent 2003479 commit aa4e98e

File tree

7 files changed

+21
-466
lines changed

7 files changed

+21
-466
lines changed

.github/workflows/build.yml

+12-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
- name: "Lint"
4949
run: "make lint"
5050

51-
coding-standards:
51+
coding-standard:
5252
name: "Coding Standard"
5353

5454
runs-on: "ubuntu-latest"
@@ -57,11 +57,17 @@ jobs:
5757
- name: "Checkout"
5858
uses: actions/checkout@v3
5959

60+
- name: "Checkout build-cs"
61+
uses: actions/checkout@v3
62+
with:
63+
repository: "phpstan/build-cs"
64+
path: "build-cs"
65+
6066
- name: "Install PHP"
6167
uses: "shivammathur/setup-php@v2"
6268
with:
6369
coverage: "none"
64-
php-version: "8.0"
70+
php-version: "8.2"
6571
ini-file: development
6672

6773
- name: "Validate Composer"
@@ -70,6 +76,10 @@ jobs:
7076
- name: "Install dependencies"
7177
run: "composer install --no-interaction --no-progress"
7278

79+
- name: "Install build-cs dependencies"
80+
working-directory: "build-cs"
81+
run: "composer install --no-interaction --no-progress"
82+
7383
- name: "Lint"
7484
run: "make lint"
7585

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/tests/tmp
2+
/build-cs
23
/vendor
34
/composer.lock
45
.phpunit.result.cache

Makefile

+8-2
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,19 @@ lint:
1111
--exclude tests/Rules/DeadCode/data/bug-383.php \
1212
src tests
1313

14+
.PHONY: cs-install
15+
cs-install:
16+
git clone https://github.com/phpstan/build-cs.git || true
17+
git -C build-cs fetch origin && git -C build-cs reset --hard origin/main
18+
composer install --working-dir build-cs
19+
1420
.PHONY: cs
1521
cs:
16-
composer install --working-dir build-cs && php build-cs/vendor/bin/phpcs
22+
php build-cs/vendor/bin/phpcs --standard=build-cs/phpcs.xml src tests
1723

1824
.PHONY: cs-fix
1925
cs-fix:
20-
php build-cs/vendor/bin/phpcbf
26+
php build-cs/vendor/bin/phpcbf --standard=build-cs/phpcs.xml src tests
2127

2228
.PHONY: phpstan
2329
phpstan:

build-cs/.gitignore

-1
This file was deleted.

build-cs/composer.json

-13
This file was deleted.

0 commit comments

Comments
 (0)