Skip to content

Commit

Permalink
Qual: Add phan stub files to phpstan configuration (#28730)
Browse files Browse the repository at this point in the history
* Qual: Add phan stub files to phpstan configuration

* Provide log as artifact (for debug), improve CACHE_KEY
  • Loading branch information
mdeweerd authored Mar 10, 2024
1 parent e5dc0f9 commit 4c442de
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ concurrency:
cancel-in-progress: true

env:
CACHE_KEY_PART: >
${{ ( github.event_name == 'pull_request' ) && github.base_ref
}}${{ ( github.event_name == 'pull_request' ) && '-' }}${{ github.head_ref }}
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:
Expand Down Expand Up @@ -58,7 +57,7 @@ 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 | cs2pr --graceful-warnings
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
# continue-on-error: true

# Save cache
Expand All @@ -68,3 +67,10 @@ jobs:
with:
path: ./.github/tmp
key: phpstan-cache-${{ matrix.php-version }}-${{ env.CACHE_KEY_PART }}-${{ github.run_id }}
- name: Provide phpstan log as artifact
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: phpstan-srcrt
path: ${{ github.workspace }}/_stan.xml
retention-days: 2
7 changes: 7 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ 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/*
Expand Down

0 comments on commit 4c442de

Please sign in to comment.