kpi-web-guild / django-girls-blog-OlenaEfymenko

django-girls-blog-OlenaEfymenko created by GitHub Classroom
MIT License
1 stars 0 forks source link

Integrate Codecov code coverage reporting #34

Closed OlenaYefymenko closed 7 months ago

OlenaYefymenko commented 8 months ago

This patch adds the Codecov tool to automatically track test coverage. It provides a detailed coverage metric for testing in the project.

Related #18

webknjaz commented 8 months ago

This patch adds powerful tool to automatically track test coverage across branches and pull requests.

Is this an advertisement by ChatGPT?

OlenaYefymenko commented 8 months ago

This patch adds powerful tool to automatically track test coverage across branches and pull requests.

Is this an advertisement by ChatGPT?

To be honest, it's my idea🙂. I just check the grammar sometimes. I had dubieties about the word "powerful". Likewise, I have confusion when I try to add a description without making it sound like an advertisement. Maybe for me, it's worth rereading the articles about rules to formulate a good commit message.

OlenaYefymenko commented 8 months ago

This won't work in the linters job since it doesn't produce any coverage report files. You should collect coverage from the test runs instead.

Thanks. Sorry for being inattentive🤦‍♀️. Edited.

webknjaz commented 8 months ago

In the CI log, the upload step doesn't find coverage.xml. Is it getting created locally? You could temporarily inject an extra step with something like ls -l after running the tests in CI, to see what files are present in the directory in the job.

OlenaYefymenko commented 7 months ago

In the CI log, the upload step doesn't find coverage.xml. Is it getting created locally? You could temporarily inject an extra step with something like ls -l after running the tests in CI, to see what files are present in the directory in the job.

Initially, there was no local file. Then I ran python -m coverage run manage.py test. Now, in the repository, I have the coverage.xml file. However, when running tests, I noticed the following issue:

  Codecov report uploader 0.7.1
[2024-01-10T13:10:30.878Z] ['info'] => Project root located at: /home/runner/work/django-girls-blog-OlenaEfymenko/django-girls-blog-OlenaEfymenko
[2024-01-10T13:10:30.879Z] ['info'] ->  Token found by environment variables
[2024-01-10T13:10:30.979Z] ['info'] Running coverage xml...
[2024-01-10T13:10:31.065Z] ['info'] Searching for coverage files...
[2024-01-10T13:10:31.088Z] ['info'] Warning: Some files located via search were excluded from upload.
[2024-01-10T13:10:31.088Z] ['info'] If Codecov did not locate your files, please review https://docs.codecov.com/docs/supported-report-formats
[2024-01-10T13:10:31.088Z] ['error'] There was an error running the uploader: No coverage files located, please try use `-f`, or change the project root with `-R`

Maybe it's because I don't have tests yet. Is that the reason?

webknjaz commented 7 months ago

No, the step you added shows that file in the list. Perhaps, you need to point to it explicitly through with:.

You can also save it as an artifact in CI so you'd be able to download it after the workflow run.

codecov[bot] commented 7 months ago

Welcome to Codecov :tada:

Once merged to your default branch, Codecov will compare your coverage reports and display the results in this comment.

Thanks for integrating Codecov - We've got you covered :open_umbrella:

OlenaYefymenko commented 7 months ago

No, the step you added shows that file in the list. Perhaps, you need to point to it explicitly through with:.

You can also save it as an artifact in CI so you'd be able to download it after the workflow run.

Finally, It's works :)

webknjaz commented 7 months ago

Interesting.. I'd expect the auto-discovery mechanism to find this file. This might be a bug in the Codecov action. OTOH, this is fine for now.