@@ -25,11 +25,11 @@ jobs:
2525 # - Checks out the repository.
2626 # - Sets up PHP.
2727 # - Logs debug information.
28- # - Configures caching for PHP static analysis scans.
29- # - Validates the composer.json file.
3028 # - Installs Composer dependencies.
29+ # - Configures caching for PHP static analysis scans.
3130 # - Make Composer packages available globally.
3231 # - Runs PHPStan static analysis (with Pull Request annotations).
32+ # - Saves the PHPStan result cache.
3333 # - Ensures version-controlled files are not modified or deleted.
3434 phpstan :
3535 name : Run PHP static analysis
6262 id : get-date
6363 run : echo "date=$(/bin/date -u --date='last Mon' "+%F")" >> "$GITHUB_OUTPUT"
6464
65- - name : Cache PHP Static Analysis scan cache
66- uses : actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
67- with :
68- path : .cache/phpcompat.json
69- key : ${{ runner.os }}-date-${{ steps.get-date.outputs.date }}-php-${{ inputs.php-version }}-phpcompat-cache-${{ hashFiles('**/composer.json', 'phpcompat.xml.dist') }}
70-
7165 # Since Composer dependencies are installed using `composer update` and no lock file is in version control,
7266 # passing a custom cache suffix ensures that the cache is flushed at least once per week.
7367 - name : Install Composer dependencies
7872 - name : Make Composer packages available globally
7973 run : echo "${PWD}/vendor/bin" >> "$GITHUB_PATH"
8074
75+ - name : Cache PHP Static Analysis scan cache
76+ uses : actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
77+ with :
78+ path : .cache # This is defined in the base.neon file.
79+ key : " phpstan-result-cache-${{ github.run_id }}"
80+ restore-keys : |
81+ phpstan-result-cache-
82+
8183 - name : Run PHP static analysis tests
8284 id : phpstan
83- run : phpstan analyse -vv --error-format=checkstyle |cs2pr
85+ run : phpstan analyse -vv --error-format=checkstyle | cs2pr
86+
87+ - name : " Save result cache"
88+ uses : actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
89+ if : ${{ !cancelled() }}
90+ with :
91+ path : .cache
92+ key : " phpstan-result-cache-${{ github.run_id }}"
8493
8594 - name : Ensure version-controlled files are not modified or deleted
8695 run : git diff --exit-code
0 commit comments