Cache PHPStan result cache for re-use while mutation testing#721
Cache PHPStan result cache for re-use while mutation testing#721romm merged 22 commits intoCuyZ:masterfrom
Conversation
Co-authored-by: Romain Canon <romain.hydrocanon@gmail.com>
|
I have a feeling the build currently cannot download the cache artifact, because the workflow was never run on the default branch. I guess it will work after the PR beeing merged and a subsequent PR opened (will test after merge) |
| - name: Running PHPStan (global) | ||
| run: php vendor/bin/phpstan | ||
|
|
||
| - name: Cache PHPStan result cache for re-use while mutation testing |
There was a problem hiding this comment.
The var/cache folder seems to be cached already, see line 26, so do we really need that, or moving the MT to this workflow would be enough?
There was a problem hiding this comment.
hmm good catch.
I guess what you say is what we need from this PR is the phpstan.neon.dist change only and everything else can be reverted again..?
There was a problem hiding this comment.
Sorry for the late answer!
Yeah I think we can do that, mutation already has its own cache so the change in phpstan.neon.dist is probably enough. 😊
Do you know if we have a simple way to check it that works?
There was a problem hiding this comment.
you can invoke infection with --log-verbosity=all --debug and look into the infection.log so you see the underlying phpstan output and command
There was a problem hiding this comment.
Got the following from the artifact:
1) /home/runner/work/Valinor/Valinor/src/MapperBuilder.php:29 [M] IncrementInteger [ID] 14540bd378da9d0b3e054b47f7cb77b1
@@ @@
public function __construct()
{
$this->settings = new Settings();
- $x = 1;
+ $x = 2;
// test change
}
/**
$ '/home/runner/work/Valinor/Valinor/vendor/bin/phpstan' '--tmp-file=/home/runner/work/Valinor/Valinor/var/cache/infection/infection/mutant.14540bd378da9d0b3e054b47f7cb77b1.infection.php' '--instead-of=/home/runner/work/Valinor/Valinor/src/MapperBuilder.php' '--configuration=/home/runner/work/Valinor/Valinor/var/cache/infection/infection/phpstan.14540bd378da9d0b3e054b47f7cb77b1.infection.neon' '--error-format=json' '--no-progress' '-vv' '--fail-without-result-cache'
{"totals":{"errors":0,"file_errors":0},"files":{},"errors":[]}
Result cache restored. 1 file will be reanalysed.
Result cache was not saved because of --tmp-file and --instead-of CLI options passed (editor mode).
Elapsed time: 3 seconds
Used memory: 102.84 MB
Looks good to you?
| --min-msi=100 \ | ||
| --show-mutations \ | ||
| --verbose \ | ||
| --logger-text=php://stdout \ |
There was a problem hiding this comment.
@romm I've noticed you removed --log-verbosity=all - is it intentional? By default (without this option), killed mutants are not printed
https://infection.github.io/guide/how-to.html#How-to-debug-Infection
The verbosity of the log file, all - this mode will add “Killed mutants” into log file and add additional information
There was a problem hiding this comment.
Indeed. Is there some way we don't show everything (for instance "error" mutants)? Because the list can get huge quite fast.
There was a problem hiding this comment.
unfortunately, no. But I feel like we can introduce some update to Infection to support it, like instead of --log-verbosity=all we can use +x notation:
--log-verbosity=+killed,+not-covered
meaning that only killed and not covered mutants will be added to the log outputs. (It's just an idea, option and implementation can be different)
There was a problem hiding this comment.
Filed infection/infection#2445. If you have other ideas, please share
|
Alright I think we're good to go, so to summarize:
|
|
Thank you @staabm! |
|
@romm you probably missed my question #721 (comment) :) could you please take a look? |
| if: github.event_name == 'pull_request' && always() | ||
| with: | ||
| name: "infection-log" | ||
| path: "var/infection/infection.log" |
There was a problem hiding this comment.
hm.. but it's not generated on CI because it's overridden by --logger-text=php://stdout
or did I miss something?
There was a problem hiding this comment.
🤦
I'm actually at a conference center and it's probably not the best idea to merge a PR there while talking with people haha
Reduces PHPStan overhead while mutation testing