From ec0fd31386540eec1410f0d8acc098cc73f71c2a Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 14:04:02 +0100 Subject: [PATCH] Fix phpstan workflow file (#28741) * Fix phpstan workflow file # Fix phpstan workflow file Line was split in two, joined * qual: set memory limit to 'unlimited' (-1) * Remove some stubs to check impact * Fix: Verify execution time limit * Remove stub files to reuse cache * Qual: Rename distribution phpstan.neon to phpstan.neon.dist # Qual: Rename distribution phpstan.neon to phpstan.neon.dist This allows the developer to override some settings locally Also update the .gitignore file with phpstan.neon and some other other ignores (cache, local log files, temporary edit files). * Enable debug on phpstan * Re-enable stubs * Fix: Change parallel settings to defaults, remove buffer 'buffer' is not a documented parameter, removing it. Removing some configuration settings as the defaults are higher and should adapt better to the target machine --- .github/workflows/phpstan.yml | 6 +++--- .gitignore | 18 ++++++++++++++++-- phpstan.neon => phpstan.neon.dist | 17 ++++++----------- 3 files changed, 25 insertions(+), 16 deletions(-) rename phpstan.neon => phpstan.neon.dist (86%) diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 967d16ab04e..cbe0f4b2732 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -9,8 +9,7 @@ concurrency: cancel-in-progress: true env: - CACHE_KEY_PART: ${{ github.event_name == 'pull_request' && format('{0}-{1}', -github.base_ref, github.head_ref) || github.ref_name }} + CACHE_KEY_PART: ${{ github.event_name == 'pull_request' && format('{0}-{1}', github.base_ref, github.head_ref) || github.ref_name }} GITHUB_JSON: ${{ toJSON(github) }} # Helps in debugging Github Action # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: @@ -57,7 +56,8 @@ jobs: # Run PHPStan - name: Run PHPStan id: phpstan - run: phpstan -vvv analyse --error-format=checkstyle --memory-limit 4G -a build/phpstan/bootstrap_action.php -c phpstan.neon | tee _stan.xml | cs2pr --graceful-warnings + run: | + phpstan -vvv analyse --error-format=checkstyle --memory-limit 7G -a build/phpstan/bootstrap_action.php | tee _stan.xml | cs2pr --graceful-warnings # continue-on-error: true # Save cache diff --git a/.gitignore b/.gitignore index efe6c66dfc0..2964b1ead0f 100644 --- a/.gitignore +++ b/.gitignore @@ -66,8 +66,21 @@ doc/install.lock /composer.json /composer.lock -# to execute pre-commit -local.sh +# Local script, executed during pre-commit +/local.sh + +# Local phpstan configuration +/phpstan.neon +/phpstan-baseline.neon + +# Logs +/*.log + +# Vim swap files +*.sw? + +# Generated by PHPUNIT.BAT +/INI_PHPUNIT # ignore cache builds /build/phpstan/phpstan @@ -75,3 +88,4 @@ local.sh phpstan_custom.neon /.php-cs-fixer.cache /.php_cs.cache +/.cache diff --git a/phpstan.neon b/phpstan.neon.dist similarity index 86% rename from phpstan.neon rename to phpstan.neon.dist index 8951e8ddaa2..78867274e30 100644 --- a/phpstan.neon +++ b/phpstan.neon.dist @@ -1,11 +1,13 @@ parameters: tmpDir: ./.github/tmp parallel: - jobSize: 8 + # Commented some of the settings, reminding the defaults: + # should adapt better to target machines + # jobSize: 8 # default is 20 processTimeout: 600.0 - maximumNumberOfProcesses: 20 - minimumNumberOfJobsPerProcess: 2 - buffer: 134217728 # 128 MB + # maximumNumberOfProcesses: 20 # default is 32 + # minimumNumberOfJobsPerProcess: 2 # default is 2 + # buffer: 134217728 # 128 MB # Not documented customRulesetUsed: true level: 2 fileExtensions: @@ -13,13 +15,6 @@ parameters: paths: - htdocs - scripts - stubFiles: - # - dev/tools/phan/stubs/GeoIP2.php - # - dev/tools/phan/stubs/geoip_inc.php - - dev/tools/phan/stubs/module_numberwords.php - - dev/tools/phan/stubs/restler.php - - dev/tools/phan/stubs/stripe.php - - dev/tools/phan/stubs/swiss-qr-bill.php excludePaths: analyseAndScan: - htdocs/custom/*