[TASK] Split PHPStan CI jobs#2050
Conversation
…mposer command to native phpstan command Related: #1827
a0a3866 to
01e9270
Compare
Coverage Report for CI Build 26807031978Coverage remained the same at 92.089%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
oliverklee
left a comment
There was a problem hiding this comment.
When I run this for TYPO3 13LTS, checking the code with PHPStan works fine.
When I run it with TYPO3 12LTS, I get errors, though:
klee@gonzales ~/src/typo3/ext/tea (feature/1827-split-phpstan-jobs)$ ./Build/Scripts/runTests.sh -t 12.4 -s phpstan
------ ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Line Classes/Domain/Repository/TeaRepository.php
------ ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
24 Method TTN\Tea\Domain\Repository\TeaRepository::findByOwnerUid() return type with generic interface TYPO3\CMS\Extbase\Persistence\QueryResultInterface does not specify its
types: TKey, TValue
🪪 missingType.generics
36 Method TTN\Tea\Domain\Repository\TeaRepository::findAllFromAllPages() return type with generic interface TYPO3\CMS\Extbase\Persistence\QueryResultInterface does not specify its
types: TKey, TValue
🪪 missingType.generics
------ ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------ ------------------------------------------------------------------------------------------------------------------------------
Line Tests/Functional/Controller/BackendModuleControllerTest.php
------ ------------------------------------------------------------------------------------------------------------------------------
Ignored error pattern #^Call to method hmac\(\) on an unknown class TYPO3\\CMS\\Core\\Crypto\\HashService\.$# in path
/home/klee/src/typo3/ext/tea/Tests/Functional/Controller/BackendModuleControllerTest.php was not matched in reported errors.
🪪 ignore.unmatched (non-ignorable)
Ignored error pattern #^Class TYPO3\\CMS\\Core\\Crypto\\HashService not found\.$# in path
/home/klee/src/typo3/ext/tea/Tests/Functional/Controller/BackendModuleControllerTest.php was not matched in reported errors.
🪪 ignore.unmatched (non-ignorable)
------ ------------------------------------------------------------------------------------------------------------------------------
[ERROR] Found 4 errors
| - name: Cache dependencies installed with composer | ||
| uses: actions/cache@v5 | ||
| with: | ||
| key: "php-${{ matrix.php-version }}-typo3-${{ matrix.typo3-version }}-${{ matrix.composer-dependencies }}-composer-${{ hashFiles('**/composer.json') }}" |
There was a problem hiding this comment.
We also need to have the Max dependencies in the CI matrix so the cache keys are correct.
| restore-keys: "php-${{ matrix.php-version }}-typo3-${{ matrix.typo3-version }}-${{ matrix.composer-dependencies }}-composer-\n" | ||
| - name: Install composer dependencies | ||
| run: | | ||
| ./Build/Scripts/runTests.sh -p ${{ matrix.php-version }} -t ${{matrix.typo3-version}} -s composerUpdateMax |
There was a problem hiding this comment.
… and use ${{ matrix.composer-dependencies }} here. (We should copy this from the other jobs so they are identical and easier to maintain.)
| COMMAND=(php -dxdebug.mode=off .Build/bin/phpstan analyse -c ${PHPSTAN_CONFIG_FILE} --no-progress --no-interaction --memory-limit 4G "$@") | ||
| ${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name phpstan-${SUFFIX} -e COMPOSER_CACHE_DIR=.cache/composer -e COMPOSER_ROOT_VERSION=${COMPOSER_ROOT_VERSION} ${IMAGE_PHP} "${COMMAND[@]}" | ||
| } | ||
| phpstanGenerateBaseline() { |
There was a problem hiding this comment.
There should be a blank line above this line so the scripts are separated.
| ;; | ||
| phpstan) | ||
| phpstan | ||
| phpstan "$@" |
There was a problem hiding this comment.
Why do we need to pass the parameters here and in the other function?
| "check:php:cs-fixer": "php-cs-fixer fix --config ./Build/php-cs-fixer/config.php -v --dry-run --diff", | ||
| "check:php:lint": "parallel-lint *.php Build Classes Configuration Tests", | ||
| "check:php:rector": "rector process --dry-run --config=./Build/rector/config.php", | ||
| "check:php:stan": "phpstan --no-progress -v --configuration=Build/phpstan/phpstan.neon", |
There was a problem hiding this comment.
We also need to update the documentation that mentions this script.
Scratch that - I had forgotten to install the 12LTS packages. |
Resolves: #1827