-
Notifications
You must be signed in to change notification settings - Fork 385
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
Measure Code Coverage #2434
Measure Code Coverage #2434
Conversation
After disabling Xdebug when not needed, the Travis jobs are now super fast: https://travis-ci.org/ampproject/amp-wp/builds/537875524 ⚡️ |
@swissspidy The code coverage job is failing: https://travis-ci.org/ampproject/amp-wp/jobs/537889379
|
@westonruter That is to be expected, as the the project hasn’t been set up on Coveralls yet. See todo above:
I don‘t have the permissions to add the Coveralls GitHub app to this repository. Without that, Coveralls cannot set things up. |
Looks like the main repo uses Codecov, so I am inclined to use the same: https://codecov.io/gh/ampproject/amphtml/ Relevant wp-dev-lib issue: xwp/wp-dev-lib#153 How GlotPress implemented it: https://github.com/GlotPress/GlotPress-WP/blob/a08b7865ba0a28d4a8e84f8e81df66f1c16a9c4a/.travis.yml#L67-L73 |
Just pushed some config changes that should make it work with Codecov. Nice bonus is that Codecov apparently makes it super easy to upload reports for both PHP and JS coverage. I also requested permissions in order to get access to this repo with Codecov: Probably necessary because I am only a collaborator on this repo. Maybe you can directly add it without problems, @westonruter. |
The last build failed because of PHPUnit errors:
No idea why this happens. Seems like some autoloader issue, but I couldn't reproduce it locally. See https://travis-ci.org/ampproject/amp-wp/jobs/538685863#L685-L710 |
@swissspidy This happens when |
@swissspidy I've put in the request to get the GitHub app installed. I suppose we need to update wp-dev-lib to enable generation of the badge in |
Yeah wp-dev-lib doesn‘t support codecov yet. Not urgent, as it‘s mostly important for ourselves. Let‘s hope the request gets through soon. Maybe we can ping some people directly? |
Otherwise code coverage runs all the time
The issue with PHP coverage is a bit odd: https://travis-ci.org/ampproject/amp-wp/jobs/539185192#L979-L1007 PHPUnit says a coverage report was built, but Codecov can't find anything at |
I believe the problem is that the |
Hmm that just uploads the report to Coveralls, no? We already (try to) upload it to Codecov in the script step, so that doesn‘t really apply to this setup. The actual code coverage analysis is done by PHPUnit while running the tests. |
These are only helper utilities for running tests, not actual source files.
Finally! It works! 🥳 Check out the newest code coverage report here: https://codecov.io/gh/ampproject/amp-wp/tree/140e6b3abdd1c86cf10cdbee8c2fa3e19b85824d It combines both PHP and JS coverage, which is nice. @westonruter If you wanna review this again, that would be awesome 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice persistent work.
Excellent!
Em sex, 31 de mai de 2019 às 12:07, Pascal Birchler <
[email protected]> escreveu:
… Merged #2434 <#2434> into
develop.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2434?email_source=notifications&email_token=AAD3R2M6KA7HYSONBHJCJG3PYFZPDA5CNFSM4HP5F4B2YY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGORX4NQXA#event-2381895772>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAD3R2ITOI7FOKXWAV4LLZ3PYFZPDANCNFSM4HP5F4BQ>
.
|
While working on #2408 I realized there was currently no easy way to measure PHP code coverage for the plugin.
With this PR, code coverage analysis is automatically run on Travis CI and then uploaded to Coveralls. This is the only service that wp-dev-lib supports out of the box. I've previously only used Codecov, but I guess they are pretty much the same.
Also, this PR disables Xdebug when no coverage analysis is needed, for a nice little extra boost.
Wanna get some code coverage analysis today? Fear not! It's as easy as following these steps:
pecl install xdebug
phpunit --coverage-clover build/logs/clover.xml
. This might take a while.