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

Add @cover annotation in test-load file and add support for codecov #1586

Merged
merged 10 commits into from
Nov 13, 2024

Conversation

sarthak-19
Copy link
Contributor

@sarthak-19 sarthak-19 commented Oct 10, 2024

Summary

This PR adds @cover annotation for test cases and add .yml file that can be used to configure codecov for automated test coverage in github actions.

Addresses #1284

Relevant technical choices

I've addressed the following file plugins/webp-uploads/tests/test-load.php for adding @cover annotation, if the approach is approved will extend this to other files.

composer.json Outdated Show resolved Hide resolved
composer.json Outdated Show resolved Hide resolved
@swissspidy
Copy link
Member

@sarthak-19 Welcome, and thanks for opening this! I just stumbled upon the PR and left a couple of comments for things that caught my eye.

@sarthak-19
Copy link
Contributor Author

@sarthak-19 Welcome, and thanks for opening this! I just stumbled upon the PR and left a couple of comments for things that caught my eye.

@swissspidy Thank you so much for the feedback. I've addressed those and looking forward to keep improving 😄

@westonruter westonruter added [Type] Enhancement A suggestion for improvement of an existing feature Infrastructure Issues for the overall performance plugin infrastructure no milestone PRs that do not have a defined milestone for release labels Oct 10, 2024
@pbearne
Copy link
Contributor

pbearne commented Oct 10, 2024

I am really glad to see I have been try to get into core ten+ years

@sarthak-19
Copy link
Contributor Author

Note the new coverage matrix variable which is only set to true for one configuration. This would be better than having to test against a specific PHP version everywhere. Yes, I think running coverage on the most recent PHP version would be best as it should complete the fastest. So maybe do it in PHP 8.2?

Apologies for the delayed response, made the suggested changes.
Does this works or any other changes are to be made, highly appreciate your insights here.

cc : @westonruter

@westonruter
Copy link
Member

@sarthak-19 That looks right!

@sarthak-19 sarthak-19 marked this pull request as ready for review November 7, 2024 21:19
Copy link

github-actions bot commented Nov 7, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @sarthak.jaiswal@rtCamp.com.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: sarthak.jaiswal@rtCamp.com.

Co-authored-by: sarthak-19 <sarthak8858@git.wordpress.org>
Co-authored-by: westonruter <westonruter@git.wordpress.org>
Co-authored-by: swissspidy <swissspidy@git.wordpress.org>
Co-authored-by: felixarntz <flixos90@git.wordpress.org>
Co-authored-by: pbearne <pbearne@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

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

@sarthak-19 Thank you for the PR! This looks quite solid, a few suggestions and questions.

.github/workflows/php-test-plugins.yml Show resolved Hide resolved
.github/workflows/php-test-plugins.yml Outdated Show resolved Hide resolved
.github/workflows/php-test-plugins.yml Outdated Show resolved Hide resolved
.github/workflows/php-test-plugins.yml Outdated Show resolved Hide resolved
.github/workflows/php-test-plugins.yml Outdated Show resolved Hide resolved
.github/workflows/php-test-plugins.yml Outdated Show resolved Hide resolved
.github/workflows/php-test-plugins.yml Show resolved Hide resolved
.github/workflows/php-test-plugins.yml Show resolved Hide resolved
.github/workflows/php-test-plugins.yml Show resolved Hide resolved
- Implemented alerted of failures.
- append commit SHA to avoid chance of conflicts
@westonruter
Copy link
Member

FYI: I've added the CODECOV_TOKEN to the repository secrets.

Copy link
Member

@westonruter westonruter left a comment

Choose a reason for hiding this comment

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

I suppose the one job will continue to fail since this PR was opened from a fork. I'll leave it to Felix to approve and merge.

Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @sarthak-19, LGTM!

Before we merge though: Doesn't one of us has to configure / set up this project on https://about.codecov.io/ first? 🤔

@westonruter
Copy link
Member

@felixarntz I believe it's all already configured according to the steps listed at https://app.codecov.io/gh/WordPress/performance

The only thing outstanding is the third step, which is to merge into the preferred branch:

image

I'll do so now!

@westonruter westonruter merged commit 98a2adc into WordPress:trunk Nov 13, 2024
15 of 16 checks passed
@westonruter
Copy link
Member

@westonruter
Copy link
Member

I've been chatting with @thelovekesh about what's going on.

For one, we're missing some additional -- arg separators since we're passing from npm to composer and then to phpunit. So here:

npm run test-php -- --coverage-clover=coverage-${{ github.sha }}.xml

npm run test-php-multisite -- --coverage-clover=coverage-multisite-${{ github.sha }}.xml

These need to instead be, respectively:

npm run test-php -- -- --coverage-clover=coverage-${{ github.sha }}.xml 

and

npm run test-php-multisite -- -- --coverage-clover=coverage-multisite-${{ github.sha }}.xml

Additionally, the coverage report for each plugin is getting overwritten to the same XML file. There needs to be separate XML files generated for each plugin.

Lovekesh has some additional thoughts.

@westonruter
Copy link
Member

I've opened #1652 to disable Codecov for the time being.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Infrastructure Issues for the overall performance plugin infrastructure no milestone PRs that do not have a defined milestone for release [Type] Enhancement A suggestion for improvement of an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants