Repository navigation
ci(#1871): PHPStan runs beside the lint steps and keeps its result cache - #1872
Merged
Merged
Conversation
Backend (static) was the slowest CI job (~2:37); PHPStan was 50-95 s of it and the lint steps queued behind it. Two jobs now run in parallel, each paying the ~12 s setup. -vvv names the reason a restored result cache was not used: CI restores it yet re-analyses all 3604 files, while locally the same cache re-analyses only the changed ones.
phpstan-symfony before 2.1 hashed the whole DI container into the result cache meta, so any service change (CI: every PR) re-analysed all 3604 files (phpstan-symfony#455). 2.1 tracks what each analysed file asks of the container and re-analyses only those; it needs PHPStan 2.3. PHPStan 2.3 keeps a narrowed call result across later statements. Calls that read changing state are now @phpstan-impure: three services that persist or cache, and the test helpers reading the response, a draining queue or the database. assistantContent() is a pure read, so its test compares two reads instead. The two src findings were dead checks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1871
Split. Backend (static) becomes two parallel jobs:
composer stan -- -vvv.The first run of the split took 1:55 end to end, down from ~2:37.
Result cache.
-vvvnamed the cause:Result cache not used because the metadata do not match: metaExtensions. phpstan-symfony < 2.1 hashed the whole DI container, so any service change threw the cache away, even on this PR, which changed no PHP at the time (phpstan-symfony#455). 2.1 (#512) re-analyses only the files that ask the container about something that changed. It needs PHPStan 2.3.phpstan/phpstan2.2.5 → 2.3.4,phpstan/phpstan-symfony2.0.20 → 2.1.1. Thecomposer.jsonfloors are raised to match.FeedLinkScanner(null === $formatonce$urlis null-checked) andQuotedViewRecord(a?->on a non-null value).@phpstan-impure:ImageVerifier::verify,RecommendationRunAdvancer::advance,GrafanaSettingsCache::remember(they persist or cache);payload,titlesOfResponse,runnable,memberEntryIds.CompletionStreamReader::assistantContent()is a pure read, so its test now compares two reads instead of being annotated.EntryPageParametersTestreads the payload once instead of three times.Deploy and release gates check the workflow's conclusion, not job names, and
develophas no required status checks.The first run after this merges re-analyses everything once, because the PHPStan version changed. The run after that shows whether the cache now hits.