66 - " src/**"
77 - " tests/**"
88 - " composer.json"
9+ - " .phive/phars.xml"
910 - " phpstan.neon.dist"
1011 - " phpunit.xml.dist"
1112 - " .php-cs-fixer.dist.php"
1213 - " rector.php"
13- - " composer-dependency-analyser.php "
14+ - " tools/** "
1415 - " .github/workflows/ci.yml"
1516 - " .github/workflows/secure-tests.yml"
1617 push :
1920 - " src/**"
2021 - " tests/**"
2122 - " composer.json"
23+ - " .phive/phars.xml"
2224 - " phpstan.neon.dist"
2325 - " phpunit.xml.dist"
2426 - " .php-cs-fixer.dist.php"
2527 - " rector.php"
26- - " composer-dependency-analyser.php "
28+ - " tools/** "
2729 - " .github/workflows/ci.yml"
2830 - " .github/workflows/secure-tests.yml"
2931 workflow_dispatch :
@@ -113,16 +115,75 @@ jobs:
113115 - name : Install dependencies with Composer
114116 run : composer install --no-interaction --no-progress --ansi --ignore-platform-req=ext-grpc
115117
118+ - name : Cache PHPStan dependencies
119+ uses : actions/cache@v5
120+ with :
121+ path : tools/.phpstan/vendor
122+ key : ${{ runner.os }}-phpstan-tools-${{ hashFiles('tools/.phpstan/composer.lock') }}
123+
124+ - name : Install PHPStan dependencies
125+ run : composer --working-dir=tools/.phpstan install --no-interaction --no-progress --ansi
126+
116127 - name : Setup problem matchers for PHP
117128 run : echo "::add-matcher::${{ runner.tool_cache }}/php.json"
118129
119130 - name : Run PHPStan
120- run : XDEBUG_MODE=off vendor/bin/phpstan analyse --no-progress --error-format=github
131+ run : XDEBUG_MODE=off tools/phpstan analyse --no-progress --error-format=github
132+
133+ lint :
134+ name : Lint
135+ needs :
136+ - dependency-validation
137+ runs-on : ubuntu-latest
138+ timeout-minutes : 20
139+
140+ steps :
141+ - name : Checkout code
142+ uses : actions/checkout@v6
143+
144+ - name : Setup PHP
145+ uses : shivammathur/setup-php@v2
146+ with :
147+ php-version : " 8.5"
148+ tools : composer, pecl
149+ coverage : none
150+
151+ - name : Get Composer cache directory
152+ id : composer-cache
153+ shell : bash
154+ run : |
155+ echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
156+
157+ - name : Cache Composer cache directory
158+ uses : actions/cache@v5
159+ with :
160+ path : ${{ steps.composer-cache.outputs.dir }}
161+ key : ${{ runner.os }}-composer-${{ hashFiles('composer.json', 'composer.lock') }}
162+ restore-keys : ${{ runner.os }}-composer-
163+
164+ - name : Install dependencies with Composer
165+ run : composer install --no-interaction --no-progress --ansi --ignore-platform-req=ext-grpc
166+
167+ - name : Cache Rector dependencies
168+ uses : actions/cache@v5
169+ with :
170+ path : tools/.rector/vendor
171+ key : ${{ runner.os }}-rector-tools-${{ hashFiles('tools/.rector/composer.lock') }}
172+
173+ - name : Install Rector dependencies
174+ run : composer --working-dir=tools/.rector install --no-interaction --no-progress --ansi
175+
176+ - name : Run linter suite
177+ run : |
178+ tools/rector --ansi --dry-run
179+ tools/php-cs-fixer check --ansi --diff --verbose
180+ tools/composer-normalize --ansi --dry-run
121181
122182 tests :
123183 name : " PHP ${{ matrix.php }}, ${{ matrix.dependencies }} deps"
124184 needs :
125185 - static-analysis
186+ - lint
126187 runs-on : ubuntu-latest
127188 timeout-minutes : 20
128189
@@ -176,7 +237,7 @@ jobs:
176237 run : echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
177238
178239 - name : Run PHPUnit
179- run : vendor/bin /phpunit --testsuite=unit --testdox
240+ run : tools /phpunit --testsuite=unit --testdox
180241
181242 code-coverage :
182243 name : Unit Test Coverage (PHP 8.5)
@@ -218,8 +279,21 @@ jobs:
218279 - name : Setup Problem Matchers for PHPUnit
219280 run : echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
220281
221- - name : Run PHPUnit with coverage
222- run : vendor/bin/phpunit --testsuite=unit --coverage-clover=coverage.xml --log-junit=test-report.xml --testdox
282+ - name : Cache PHPUnit static analysis cache
283+ uses : actions/cache@v5
284+ with :
285+ path : .phpunit.cache/code-coverage
286+ key : ${{ runner.os }}-phpunit-code-coverage-${{ github.ref }}-
287+ restore-keys : |
288+ ${{ runner.os }}-phpunit-code-coverage-${{ github.ref }}-
289+
290+ - name : Warm PHPUnit static analysis cache
291+ run : tools/phpunit --warm-coverage-cache
292+
293+ - name : Collect code coverage with PHPUnit
294+ run : |
295+ mkdir -p build
296+ tools/phpunit --testsuite=unit --log-junit build/test-results.xml --coverage-clover build/code-coverage.xml --testdox
223297
224298 - name : Upload test results to Codecov
225299 if : ${{ !cancelled() }}
@@ -228,14 +302,15 @@ jobs:
228302 token : ${{ secrets.CODECOV_TOKEN }}
229303 flags : unit
230304 report_type : test_results
305+ files : ./build/test-results.xml
231306 fail_ci_if_error : false
232307
233308 - name : Upload coverage to Codecov
234309 if : ${{ !cancelled() }}
235310 uses : codecov/codecov-action@v5
236311 with :
237312 token : ${{ secrets.CODECOV_TOKEN }}
238- files : ./coverage.xml
313+ files : ./build/code- coverage.xml
239314 flags : unit
240315 fail_ci_if_error : false
241316
0 commit comments