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

Use pcov => xdebug => phpdbg for phpunit code coverage #166

Merged
merged 1 commit into from
Jun 14, 2022

Conversation

stronk7
Copy link
Member

@stronk7 stronk7 commented Apr 25, 2022

Right now we are only using phpdbg for phpunit code coverage. And
it's causing some problems with latest (8.0, 8.1) php versions.

Also, since phpunit 8, its code coverage tool supports pcov, that
is the lighter and better alternative. And then, xdebug running
in coverage mode has become way better in recent versions.

So, with this patch applied, moodle-plugin-ci will look for the
"best" code coverage alternative (pcov => xdebug => phpdbg) in
every run.

This guarantees that existing automations, not having pcov or
xdebug available will continue fall-backing to phpdbg. But if
any of the 2 extensions are available, we'll be using them.

No matter of the above (fully automatic), it's also possible
to configure the desired code coverage tool with 3 new options,
in case it's needed to force any:

  • coverage-pcov
  • coverage-xdebug
  • coverage-phpdbg

Added support to the '--verbose' option to be passed to phpunit
(useful to debug options or see details about skipped tests).

Includes modifications to both GHA docs and template to show the new options.

And, also, changes to own CI tests to have both pcov and xdebug used
all the time.

@stronk7 stronk7 force-pushed the better_code_coverage branch 2 times, most recently from fb69f86 to 5712b3b Compare May 10, 2022 19:19
@stronk7
Copy link
Member Author

stronk7 commented May 11, 2022

Hi super @scara !

Are you going to complete the review of this issue? TIA and no worries if you cannot!

Ciao :-)

@stronk7
Copy link
Member Author

stronk7 commented Jun 8, 2022

Ping!

@scara
Copy link

scara commented Jun 8, 2022

Hi @stronk7,

Ping!

Will look in the next days, within the week.

HTH,
Matteo

@stronk7
Copy link
Member Author

stronk7 commented Jun 8, 2022

Will look in the next days, within the week.

Awesome! TIA!

.travis.yml Outdated Show resolved Hide resolved
Right now we are only using phpdbg for phpunit code coverage. And
it's causing some problems with latest (8.0, 8.1) php versions.

Also, since phpunit 8, its code coverage tool supports pcov, that
is the lighter and better alternative. And then, xdebug running
in coverage mode has become way better in recent versions.

So, with this patch applied, moodle-plugin-ci will look for the
"best" code coverage alternative (pcov => xdebug => phpdbg) in
every run.

This guarantees that existing automations, not having pcov or
xdebug available will continue fall-backing to phpdbg. But if
any of the 2 extensions are available, we'll be using them.

No matter of the above (fully automatic), it's also possible
to configure the desired code coverage tool with 3 new options,
in case it's needed to force any:
  - coverage-pcov
  - coverage-xdebug
  - coverage-phpdbg

Added support to the '--verbose' option to be passed to phpunit
(useful to debug options or see details about skipped tests).

Includes modifications to both GHA docs and template to show the new options.

And, also, changes to own CI tests to have both pcov and xdebug used
all the time.
@stronk7
Copy link
Member Author

stronk7 commented Jun 13, 2022

I've commented in the 3 places now: travis.yml and .github/workflows/test.yml with the very same comment:

# We want to verify that xdebug works for coverage. Once we only support
# Moodle 3.10/PHPUnit 8 and up, we can switch our tests to pcov too.

Those are all the changes applied. Ciao :-)

@stronk7
Copy link
Member Author

stronk7 commented Jun 14, 2022

Thanks, @scara . Going to merge this now!

@stronk7 stronk7 merged commit b88bd4c into moodlehq:master Jun 14, 2022
@stronk7 stronk7 deleted the better_code_coverage branch June 14, 2022 09:52
@stronk7 stronk7 mentioned this pull request Jul 6, 2022
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.

2 participants