Skip to content

feat(CI): add Codecov Test Analytics for flaky and failed tests #29881

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

giovanni-guidini
Copy link

PR summary

Hi, Gio from Codecov here. I saw that you used Codecov already, and I thought you could benefit from catching any flaky or failed tests. We released a Test Analytics product that might be helpful and would love your feedback.

Changes:

  • feat: add junitxml format to be ingested by the codecov test analytics action
  • feat: add the codecov test analytics action to the CI pipeline

PR checklist

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Thank you for opening your first PR into Matplotlib!

If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks.

You can also join us on gitter for real-time discussion.

For details on testing, writing docs, and our review process, please see the developer guide

We strive to be a welcoming and open project. Please follow our Code of Conduct.

ps.: the action that uploads the test results doesn't have a great time
differentiating 'linux' from 'linux-arm64', so I had to add the matrix
values for the `os:` option
@giovanni-guidini giovanni-guidini force-pushed the gio/codecov-test-analytics branch from fa88a74 to 3c13d7f Compare April 7, 2025 16:26
Copy link
Member

@QuLogic QuLogic left a comment

Choose a reason for hiding this comment

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

I guess the results are here: https://app.codecov.io/gh/matplotlib/matplotlib/tests/giovanni-guidini%3Agio%2Fcodecov-test-analytics

But it doesn't say too much since it's just the one commit, and there are no trends to speak of.

@giovanni-guidini giovanni-guidini force-pushed the gio/codecov-test-analytics branch from 41ad7d5 to 887c1e9 Compare April 8, 2025 07:59
@giovanni-guidini giovanni-guidini requested a review from QuLogic April 8, 2025 08:47
Copy link
Member

@dstansby dstansby left a comment

Choose a reason for hiding this comment

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

This looks like a nice new feature, and I'd definitely be 👍 to trying it out.

The other comment I have, is would you recommend us adding any tags? The codecov docs seem to recommend the Python version, so perhaps we should add that as a tag? We have definitely had tests fail on certain Python versions before, so I think adding that tag could be helpful.

uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
os: ${{ matrix.codecov-test-results-action-os }}
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason we need to manually specify the os - the docs say "Override the assumed OS.", so I would have assumed that the os can be autodetected somehow? I was thinking of saving having to hard code the os as a variable for every element of the test matrix.

Copy link
Author

Choose a reason for hiding this comment

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

I completely agree with you there, it would be better to rely on the autodetect. It works mostly fine, but it's not perfect.

Originally I was relying on that, but this run shows that specifically the ubuntu-22.04-arm is being detected as "linux" not "linux-arm64". Hopefully this will be addressed in the Action's side, of course, but in the mean time using the os var can side step this limitation and make sure all uploads are being done correctly.

An alternative approach that I didn't think would work is to conditionally pass the os var only in that one case that would need it. This would be a much smaller footprint in the yaml. I can try that approach.

@giovanni-guidini
Copy link
Author

This looks like a nice new feature, and I'd definitely be 👍 to trying it out.

The other comment I have, is would you recommend us adding any tags? The codecov docs seem to recommend the Python version, so perhaps we should add that as a tag? We have definitely had tests fail on certain Python versions before, so I think adding that tag could be helpful.

We appreciate the interest in this feature!

About the flags, I think the python version is indeed a good candidate for flags. The os might also be. With the flags you can filter test results per flag, meaning you could quickly see if tests are failing on one python version but not others, and similar to the OS.

@tacaswell tacaswell added this to the v3.11.0 milestone Apr 11, 2025
@dstansby
Copy link
Member

Can you explain where the Python tag can be used on codecov to filter results (or for other functionality)? I tried looking at https://app.codecov.io/gh/matplotlib/matplotlib/commit/bc70afb98830826cfd18ee24dc185bcc1af16a66 and https://app.codecov.io/gh/matplotlib/matplotlib/tests/giovanni-guidini%3Agio%2Fcodecov-test-analytics, but I can't obviously see where the tags show up.

@giovanni-guidini
Copy link
Author

giovanni-guidini commented Apr 14, 2025

Can you explain where the Python tag can be used on codecov to filter results (or for other functionality)? I tried looking at https://app.codecov.io/gh/matplotlib/matplotlib/commit/bc70afb98830826cfd18ee24dc185bcc1af16a66 and https://app.codecov.io/gh/matplotlib/matplotlib/tests/giovanni-guidini%3Agio%2Fcodecov-test-analytics, but I can't obviously see where the tags show up.

Good observation. I've confirmed with the team that at this time you can only filter the test results by flag in the main branch (https://app.codecov.io/gh/matplotlib/matplotlib/tests/main has the filter, but no tests, obviously)

The team did say they are considering expanding filtering to any branch, but I won't make promises, nor do I have a timeframe for such feature. Sorry :E

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.

4 participants