Skip to content

Conversation

@staabm
Copy link
Collaborator

@staabm staabm commented Oct 25, 2025

closes #10


- name: "Run infection"
run: |
git fetch --depth=1 origin ${{ steps.default-branch.outputs.name }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get why do you need the default branch and why are you fetching it here. You've already checked out the extension repo to the default branch...

Copy link
Collaborator Author

@staabm staabm Oct 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thats how it is documented on the infection website, for git based diffs
https://infection.github.io/guide/command-line-options.html#git-diff-base

which is what we need in the end, because its so slow as is

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But here it’s not diff based, no diff related CLI options are passed.

for phpstan-src in the future I’d do a separate job because it will be a lot different

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since running a single mutator on simple repositories like phpstan-doctrine already takes 15 minutes, I had the impression that as soon as we add more mutators there is no other way then doing diff based mutations for all repos

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the duration really 15 minutes times number of mutators?

If you want to do git fetch origin, I'm really missing some diff options in infection execution (like setting the base 100 commits ago).

Copy link
Collaborator Author

@staabm staabm Oct 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in our setup worst-case infection runtime is
("number of mutations" * "runtime of test-suite in seconds") + ("number of mutations" * "a few seconds for running phpstan with a primed result cache")

while a single mutator can yield hundreds of mutations (depending on the size of the project or diff)

Copy link
Collaborator Author

@staabm staabm Oct 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so for example in phpstan-doctrine we need ~14min to process 17 mutations because the runtime of the test-suite is ~1 minute
(because our test-suite does not contain meta information which infection can use to optimize the phpunit runtime - like #[CoversClass])

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now 17m is okay, once it gets slower because of more mutators, we can do the last 100 commits on all repos :)

@staabm
Copy link
Collaborator Author

staabm commented Oct 26, 2025

interessting that PHPStan needs 17-18 seconds to re-analyze only 6 files

10) /home/runner/work/build-infection/build-infection/src/Type/Doctrine/Query/QueryResultTypeWalker.php:930    [M] PHPStan\Infection\TrinaryLogicMutator [ID] 868c978753abd210075c3d2f3cb7405a

@@ @@
             $result = $this->createFloat($containsNull);
         } elseif ($typeNoNull->isNumericString()->yes()) {
             $result = $this->createNumericString($containsNull, $typeNoNull->isLowercaseString()->yes(), $typeNoNull->isUppercaseString()->yes());
-        } elseif ($typeNoNull->isString()->yes()) {
+        } elseif (!$typeNoNull->isString()->no()) {
             $result = $this->createString($containsNull, $typeNoNull->isLowercaseString()->yes(), $typeNoNull->isUppercaseString()->yes());
         } else {
             $result = $type;

$ '/home/runner/work/build-infection/build-infection/vendor/bin/phpstan' '--tmp-file=/tmp/infection/mutant.868c978753abd210075c3d2f3cb7405a.infection.php' '--instead-of=/home/runner/work/build-infection/build-infection/src/Type/Doctrine/Query/QueryResultTypeWalker.php' '--configuration=/tmp/infection/phpstan.868c978753abd210075c3d2f3cb7405a.infection.neon' '--error-format=json' '--no-progress' '-vv'
  {"totals":{"errors":0,"file_errors":1},"files":{"/home/runner/work/build-infection/build-infection/src/Type/Doctrine/Query/QueryResultTypeWalker.php":{"errors":1,"messages":[{"message":"Strict comparison using === between 'pdo_pgsql' and 'pdo_pgsql' will always evaluate to true.","line":1691,"ignorable":true,"identifier":"identical.alwaysTrue"}]}},"errors":[]}
  
  Result cache restored. 6 files will be reanalysed.
  Result cache was not saved because of --tmp-file and --instead-of CLI options passed (editor mode).
  Elapsed time: 17 seconds
  Used memory: 194.5 MB

@ondrejmirtes
Copy link
Member

That should be profiled. It's not obvious where that time is spent.

@ondrejmirtes ondrejmirtes merged commit f3fc3b5 into 1.x Oct 26, 2025
11 checks passed
@ondrejmirtes
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Integration test for all the repositories using build-infection

2 participants