Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(ci): Review the mutation testing workflow #1791

Merged
merged 9 commits into from
Dec 22, 2022
35 changes: 20 additions & 15 deletions .github/workflows/mt.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
# yamllint disable rule:line-length
# yamllint disable rule:braces

name: Mutation Testing
# This build is to test the whole execute the PHPUnit tests & collect the coverage
# report and run infection.
# We are not interested in:
# - Running it on different systems (e.g. Windows, which was disabled because too slow)
# - Min/maxing the PHP version used: it can be any supported version
# - Using different dependencies than the locked ones
# - Using different code coverages
# All of those variants may be interesting but are better tested in more scoped
# tests like in ci.yaml.
name: Infection on Infection
theofidry marked this conversation as resolved.
Show resolved Hide resolved

on:
pull_request:
Expand All @@ -16,15 +25,9 @@ env:

jobs:
tests:
runs-on: ${{ matrix.operating-system }}
runs-on: ubuntu-latest

strategy:
matrix:
operating-system: [ubuntu-latest]
php-version: ['8.0']
coverage-driver: [pcov]

name: Mutation testing on ${{ matrix.operating-system }} with PHP ${{ matrix.php-version }}, using ${{ matrix.coverage-driver }}
name: Infection complete run on Infection

steps:
- name: Checkout code
Expand All @@ -33,9 +36,10 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: ${{ matrix.coverage-driver }}
tools: composer:v2.1
# Any supported PHP version is fine
php-version: '8.2'
coverage: pcov
tools: composer

- name: Get composer cache directory
id: composer-cache
Expand All @@ -52,12 +56,13 @@ jobs:
composer-

- name: Install dependencies
run: |
composer update --no-interaction --prefer-dist --no-progress
# Run the locked dependencies: we are not interested in testing different
# variations here so having a stable set is better.
run: composer install --no-interaction --prefer-dist --no-progress

- name: Collect coverage report
run: |
php vendor/phpunit/phpunit/phpunit --stop-on-failure \
SYMFONY_DEPRECATIONS_HELPER=disabled php vendor/phpunit/phpunit/phpunit --stop-on-failure \
Copy link
Member

Choose a reason for hiding this comment

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

why is it needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because depending on the deprecations it can fail this build. It's not necessarily bad, but we already check for the deprecations in ci.yaml. So having it here is redundant, and disabling it guaranteeing we get to the interesting part of that build which is running infection with coverage generated and with the badge API key

Copy link
Member Author

Choose a reason for hiding this comment

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

Lemme know if that's a satisfying answer for you or you prefer to keep it

--coverage-xml=build/logs/coverage-xml \
--log-junit=build/logs/junit.xml

Expand Down