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

Remove diff cover #257

Merged
merged 10 commits into from
Sep 22, 2023
Merged

Remove diff cover #257

merged 10 commits into from
Sep 22, 2023

Conversation

ewjoachim
Copy link
Member

@ewjoachim ewjoachim commented Sep 10, 2023

This PR removes diff-cover from the codebase:

  • Computes the list of added lines from git diff
  • Creates a DiffCoverage object from a Coverage object, restricting lines to the ones added
  • Recomputes all derived metrics from the base ones

The nice thing is that the tests barely need to change.

We bump the docker image version number in the process, but I believe the old action will run on the new image, and vice versa (thanks to the pip install . that we left in Dockerfile) so I don't think we need to do anything specific for this to work.

@github-actions
Copy link

End-to-end public repo

@ewjoachim
Copy link
Member Author

Ha of course.
The CI of e2e fail because:

ERROR: failed to solve: ewjoachim/python-coverage-comment-action-base:v4: docker.io/ewjoachim/python-coverage-comment-action-base:v4: not found

@ewjoachim
Copy link
Member Author

subprocess.CalledProcessError: Command '('git', 'diff', '--unified=0', 'origin/main', '--', '.')' returned non-zero exit status 128.
fatal: bad revision 'origin/main'

Hmm... Is it a problem of a missing fetch ? But why didn't we have that with diff cover ? Time to explore...

@ewjoachim
Copy link
Member Author

Ow damn you already have a branch for doing that :( https://github.com/py-cov-action/python-coverage-comment-action/tree/replace-diff-cover

Sorry about the duplicated work !

@kieferro kieferro self-requested a review September 13, 2023 00:50
@kieferro
Copy link
Member

Sorry about the duplicated work !

It's of course not ideal, but no big problem, I had neglected the branch a bit anyway, because we had more important things at the time and and then I didn't deal with it. But the fact that I had already thought about it makes the review process easier for me.

How do we want to proceed, do you want to get the CI passing first or should I review it now?

@ewjoachim
Copy link
Member Author

I think the only thing needed is for me to push the missing git fetch. Let's say you're welcome to review once it's green :)

@github-actions
Copy link

Coverage report

The coverage rate went from 100% to 100% ➡️
The branch rate is 100%.

100% of new lines are covered.

Diff Coverage details (click to unfold)

coverage_comment/main.py

100% of new lines are covered (100% of the complete file).

coverage_comment/coverage.py

100% of new lines are covered (100% of the complete file).

@ewjoachim
Copy link
Member Author

All green, rebased conflicts resolved, all yours :)

coverage_comment/coverage.py Show resolved Hide resolved
coverage_comment/coverage.py Outdated Show resolved Hide resolved
coverage_comment/coverage.py Outdated Show resolved Hide resolved
coverage_comment/coverage.py Outdated Show resolved Hide resolved
coverage_comment/coverage.py Outdated Show resolved Hide resolved
tests/unit/test_coverage.py Show resolved Hide resolved
tests/unit/test_coverage.py Show resolved Hide resolved
@ewjoachim
Copy link
Member Author

Ok, I think all your comments have been addressed.

Copy link
Member

@kieferro kieferro left a comment

Choose a reason for hiding this comment

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

Yes, looks good

@kieferro kieferro merged commit 81ee18f into main Sep 22, 2023
3 checks passed
@kieferro kieferro deleted the remove-diff-cover branch September 22, 2023 23:58
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.

2 participants