symfonyAppPipeline: use 'symfony php' command ton run tools

This commit is contained in:
wpetit 2022-09-27 14:35:56 +02:00
parent 37445a815e
commit 14bf4665f1
2 changed files with 9 additions and 4 deletions

View File

@ -39,4 +39,9 @@ RUN mkdir --parents /tools/phpstan \
&& composer require --working-dir=/tools/phpstan phpstan/phpstan \
&& ln -s /tools/phpstan/vendor/bin/phpstan /usr/local/bin/phpstan \
&& composer require --working-dir=/tools/phpstan phpstan/phpstan-symfony \
&& composer require --working-dir=/tools/phpstan phpstan/phpstan-doctrine
&& composer require --working-dir=/tools/phpstan phpstan/phpstan-doctrine
# Install Symfony
RUN curl -1sLf 'https://dl.cloudsmith.io/public/symfony/stable/setup.deb.sh' | bash \
&& apt update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y symfony-cli

View File

@ -18,7 +18,7 @@ def call(String baseImage = 'ubuntu:22.04') {
stage('Install composer dependencies') {
sh '''
composer install
symfony composer install
'''
}
@ -51,7 +51,7 @@ def call(String baseImage = 'ubuntu:22.04') {
sh '''
CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRTUXB "HEAD~..HEAD" | fgrep ".php" | tr "\n" " ")
if ! echo "${CHANGED_FILES}" | grep -qE "^(\\.php-cs-fixer(\\.dist)\\.php?|composer\\.lock)$"; then EXTRA_ARGS=$(printf -- '--path-mode=intersection -- %s' "${CHANGED_FILES}"); else EXTRA_ARGS=''; fi
php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --dry-run --using-cache=no --format junit ${EXTRA_ARGS} > php-cs-fixer.xml || true
symfony php $(which php-cs-fixer) fix --config=.php-cs-fixer.dist.php -v --dry-run --using-cache=no --format junit ${EXTRA_ARGS} > php-cs-fixer.xml || true
'''
def report = sh(script: 'junit2md php-cs-fixer.xml', returnStdout: true)
if (env.CHANGE_ID) {
@ -70,7 +70,7 @@ def call(String baseImage = 'ubuntu:22.04') {
writeFile file:'phpstan.neon', text:phpStanConfig
}
sh '''
phpstan analyze -l 1 --error-format=table src > phpstan.txt || true
symfony php $(which phpstan) analyze -l 1 --error-format=table src > phpstan.txt || true
'''
def report = sh(script: 'cat phpstan.txt', returnStdout: true)
report = '## Rapport PHPStan\n\n```\n' + report