Skip to content

Commit 4cf769c

Browse files
authored
build: Add rector to the auto-review process (#908)
1 parent 1416c09 commit 4cf769c

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

.github/workflows/lint.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,38 @@ jobs:
7878
run: make phpstan_install
7979

8080
- run: make phpstan
81+
rector:
82+
runs-on: ubuntu-latest
83+
name: Rector
84+
steps:
85+
- name: Checkout
86+
uses: actions/checkout@v4
87+
88+
- name: Setup PHP
89+
uses: shivammathur/setup-php@v2
90+
with:
91+
php-version: '8.1'
92+
tools: composer
93+
coverage: none
94+
95+
# https://docs.github.com/en/actions/learn-github-actions/workflow-commands-for-github-actions#setting-an-environment-variable
96+
- name: Configure composer root version
97+
run: |
98+
source .composer-root-version
99+
echo "COMPOSER_ROOT_VERSION=${COMPOSER_ROOT_VERSION}" >> $GITHUB_ENV
100+
101+
- name: Install Composer dependencies
102+
uses: ramsey/composer-install@v2
103+
104+
- name: Install PHPStan
105+
uses: ramsey/composer-install@v2
106+
with:
107+
working-directory: 'vendor-bin/rector'
108+
109+
- name: Ensure PHPStan Makefile target is up to date
110+
run: make rector_install
111+
112+
- run: make rector_lint
81113

82114
# This is a "trick", a meta task which does not change, and we can use in
83115
# the protected branch rules as opposed to the E2E tests one above which
@@ -90,6 +122,7 @@ jobs:
90122
needs:
91123
- cs
92124
- phpstan
125+
- rector
93126
if: always()
94127
steps:
95128
- name: Successful run

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ phpstan: $(PHPSTAN_BIN)
9999

100100
.PHONY: autoreview
101101
autoreview: ## Runs the AutoReview checks
102-
autoreview: cs_lint phpstan covers_validator
102+
autoreview: cs_lint phpstan rector_lint covers_validator
103103

104104
.PHONY: test
105105
test: ## Runs all the tests
@@ -274,6 +274,9 @@ vendor-bin/phpstan/composer.lock: vendor-bin/phpstan/composer.json
274274
@echo "$(@) is not up to date. You may want to run the following command:"
275275
@echo "$$ composer bin phpstan update --lock && touch -c $(@)"
276276

277+
.PHONY: rector_install
278+
rector_install: $(RECTOR_BIN)
279+
277280
$(RECTOR_BIN): vendor-bin/rector/vendor
278281
touch -c $@
279282
vendor-bin/rector/vendor: vendor-bin/rector/composer.lock $(COMPOSER_BIN_PLUGIN_VENDOR)

0 commit comments

Comments
 (0)