Skip to content
Merged
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,71 @@ jobs:

- name: "Tests"
run: "make tests"

mutation-testing:
name: "Mutation Testing"
runs-on: "ubuntu-latest"
needs: ["tests", "tests-levels"]
Copy link
Member

Choose a reason for hiding this comment

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

tests-levels? I don't want Infection to run these levels so it doesn't make sense to wait for them.

Copy link
Member

Choose a reason for hiding this comment

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

Also: what about static analysis? I know it's in another workflow but not warmed-up cache might have a downside or two here?

Copy link
Contributor Author

@staabm staabm Oct 26, 2025

Choose a reason for hiding this comment

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

tests-levels? I don't want Infection to run these levels so it doesn't make sense to wait for them.

I initially added levels to make sure we run late enough for the static analysis step... does no longer make sense as we no longer have the artifact down/upload step.

deleted it.

Also: what about static analysis? I know it's in another workflow but not warmed-up cache might have a downside or two here?

as we restore the previous cache I think it will be "fresh enough". waiting across workflows will complicate it, as this is only supported in github actions with work-arrounds. I don't think its worth the effort.

infection will start and fail in the "preparation phase" when SA is not green.

Copy link
Member

Choose a reason for hiding this comment

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

I thought we could just run PHPStan again before Infection.

Copy link
Contributor Author

@staabm staabm Oct 26, 2025

Choose a reason for hiding this comment

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

infection will run it once before it starts it as a process killer


strategy:
fail-fast: false
matrix:
php-version:
- "8.2"
- "8.3"
- "8.4"
operating-system: [ubuntu-latest]

steps:
- name: "Checkout"
uses: actions/checkout@v5

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "pcov"
php-version: "${{ matrix.php-version }}"
ini-file: development
extensions: ds,mbstring
tools: infection:0.31.7

- name: "Install dependencies"
run: "composer install --no-interaction --no-progress"

- name: "Checkout build-infection"
uses: actions/checkout@v5
with:
repository: "phpstan/build-infection"
path: "build-infection"
ref: "1.x"

- name: "Install build-infection dependencies"
working-directory: "build-infection"
run: "composer install --no-interaction --no-progress"

- name: "Configure infection"
run: |
php build-infection/bin/infection-config.php \
> infection.json5
cat infection.json5 | jq

- name: "Cache Result cache"
uses: actions/cache@v4
Copy link
Member

Choose a reason for hiding this comment

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

This isn't going to save the cache if the build fails, right? Shouldn't we do what's recommended here? https://phpstan.org/user-guide/result-cache#setup-in-github-actions

with:
path: ./tmp
key: "result-cache-v1-${{ matrix.php-version }}-${{ github.run_id }}"
restore-keys: |
result-cache-v1-${{ matrix.php-version }}-

- name: "Run infection"
run: |
git fetch --depth=1 origin $GITHUB_BASE_REF
infection \
--git-diff-base=origin/$GITHUB_BASE_REF \
--git-diff-lines \
--ignore-msi-with-no-mutations \
--min-msi=100 \
--min-covered-msi=100 \
--log-verbosity=all \
--debug \
--logger-text=php://stdout
Loading