[BUG] JUnit test result files are discovered and uploaded as coverage #500
Description
I've been looking into why the newly integrated Codecov app does not post any coverage statuses to GitHub, with all the configuration mimicking what I've been doing in dozens of other repos.
While doing that, I noticed something strange, looking into the upload @ https://app.codecov.io/github/ansible/awx/commit/acd6b2eb2270ff3ebde9b229e0efecb6edee004e. It contains 2 XML files in the payload, while I expected that there would be one file with coverage in it.
So I looked into the job logs @ https://github.com/ansible/awx/actions/runs/10856012453/job/30129820229#step:5:53 and saw that codecov-cli
finds 2 files (/home/runner/work/awx/awx/reports/coverage.xml
and /home/runner/work/awx/awx/awxkit/report.xml
) and decides that both need to be uploaded.
Interestingly, the next CI job step uploads test results and it discovers a different file — /home/runner/work/awx/awx/reports/junit.xml
(but not /home/runner/work/awx/awx/awxkit/report.xml
) —
@ https://github.com/ansible/awx/actions/runs/10856012453/job/30129820229#step:6:34.
I don't know if that's the reason Codecov can't post statuses to GH (they don't show up for pushed commits, nor PRs), but I figured that it might as well be related. UPD: I do know now that it's unrelated.
Anyway, I think this behavior is a bug and the uploader should only look for the files of the correct shape for any given upload type (coverage or test).
My suggestion is that codecov-cli
should look into the files before uploading and at least verify they have the correct root-level XML node. Alternatively, a check against a good schema would be even better.
P.S. I've found some dead code in place you changed @joseph-sentry @ https://github.com/codecov/codecov-cli/blame/main/codecov_cli/services/upload/file_finder.py#L217-L219 — it's probably unrelated but contributes to confusion when reading it.
cc @rohan-at-sentry — there might be a deeper issue here, not sure if I should open an issue in the feedback repo..
Activity