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

Run coverage in subdirectory #184

Merged
merged 16 commits into from
Aug 3, 2023
Merged

Run coverage in subdirectory #184

merged 16 commits into from
Aug 3, 2023

Conversation

ewjoachim
Copy link
Member

Closes #167 (and linked to #16)

I'm not 100% sure it works, because I've mostly make tests pass, but I'd like to try that for real (and wondering about changing the e2e tests to use a subdir)

@github-actions
Copy link

End-to-end public repo
End-to-end private repo
If the tests fail, @ewjoachim will be added to the private repo

@github-actions
Copy link

github-actions bot commented Jun 11, 2023

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/files.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).

coverage_comment/main.py

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

coverage_comment/subprocess.py

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

coverage_comment/settings.py

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

@kieferro
Copy link
Member

This looks great <3. That's pretty much how I imagined it too.

I'm not 100% sure it works, because I've mostly make tests pass, but I'd like to try that for real (and wondering about changing the e2e tests to use a subdir)

Yes, that wouldn't be a bad idea at least once for testing, maybe permanently.
Does that mean you are still working on the PR or should I already review it in detail or assist somehow in regards to the e2e tests?

@ludelafo
Copy link

Looking forward for this contribution! I just stumbled upon this project and was searching how to set a subdirectory for coverage in my monorepo project.

@ewjoachim
Copy link
Member Author

Yes, that wouldn't be a bad idea at least once for testing, maybe permanently.

I did a one-off test in https://github.com/ewjoachim/python-coverage-comment-action-devenv/tree/master where coverage ran from the src folder and it did work. I guess we're good to go (when you say so @kieferro and when I've solved conflicts)

@ewjoachim
Copy link
Member Author

Coverage report

The coverage rate went from 100% to 99.87% arrow_down The branch rate is 100%.

96.15% of new lines are covered.
Diff Coverage details (click to unfold)

Also, that.

@kieferro kieferro self-requested a review June 20, 2023 16:18
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.

Looks very good, thank you. Just some small comments from my side. I also took the liberty to fix a few spelling mistakes (that were already there before) and raise the coverage to 100%.

coverage_comment/subprocess.py Outdated Show resolved Hide resolved
tests/unit/test_subprocess.py Outdated Show resolved Hide resolved
coverage_comment/subprocess.py Show resolved Hide resolved
@ewjoachim ewjoachim force-pushed the run-coverage-in-subdir branch 2 times, most recently from a7b816b to f7cde42 Compare July 23, 2023 06:43
@ewjoachim
Copy link
Member Author

Okay, hopefully, we should be good :)

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.

Okay, that looks good so far. However, I did some more tests with a copy of our example repo and for push everything works, but for PR the action crashes. This is because diff-cover always specifies the file paths relative to the root of the repo no matter where you run the command and the other coverage data is always relative to the COVERAGE_PATH.
I would therefore recommend that we always add COVERAGE_PATH to the file paths that are stored in the coverage data. This would also solve another problem. With the change in this PR it is no longer necessarily apparent to which files the comment refers, because absolute paths are no longer used. This can be very confusing, especially when several comments are posted (which will probably happen with #213), because you would have to figure out from the context which code it is about.

It might also be useful to add an integration test that completely tests a case with COVERAGE_PATH once. This way we would probably have noticed the problem earlier.
But I just tried to write such a test myself and I already see that it is not easy if you don't want to duplicate all fixtures. I'm still trying things out a bit. But if you have an idea in that direction, feel free to implement it.

README.md Outdated Show resolved Hide resolved
@ewjoachim ewjoachim force-pushed the run-coverage-in-subdir branch 2 times, most recently from 8505bd0 to 3231d6c Compare July 26, 2023 18:42
@ewjoachim
Copy link
Member Author

ewjoachim commented Jul 26, 2023

Good news everyone: I've set up the e2e tests to use a src repo, and hopefully, this will reproduce the issue (though I'm still struggling a little)

Also, it's very tedious to launch the action locally :( And I don't reproduce locally :( but I've reproduced on a dev-env GH repo.

@ewjoachim ewjoachim force-pushed the run-coverage-in-subdir branch 5 times, most recently from c138851 to 5102eb3 Compare July 26, 2023 22:28
@ewjoachim
Copy link
Member Author

Dammit, I don't reproduce the issue :(

@ewjoachim
Copy link
Member Author

There seem to be an awful lot of unrelated commits in this PR :/ Sorry about that, tell me if you'd rather I'd move them in a different one.

@kieferro kieferro self-requested a review July 29, 2023 16:07
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.

There seem to be an awful lot of unrelated commits in this PR :/ Sorry about that, tell me if you'd rather I'd move them in a different one.

Thank you, very considerate. But it wasn't that bad.

Now everything looks perfect. I also tested it again in a repo, but with the e2e tests (thanks again for all the work you put in to reproduce the issue) it shouldn't be a problem anymore anyway. I guess we should be ready to merge then, right?

@czesiu89
Copy link

czesiu89 commented Aug 2, 2023

Hey :)
I just wanted to say that I love the project, it's minimalism in regards of output look etc., but I can't use it without relative paths being merged (monorepo... :)). Are there any time frames on when it will be merged and released :)?

@ewjoachim ewjoachim merged commit 0325d3e into v3 Aug 3, 2023
2 checks passed
@ewjoachim ewjoachim deleted the run-coverage-in-subdir branch August 3, 2023 07:57
@ewjoachim
Copy link
Member Author

Are there any time frames on when it will be merged and released :)?

I'd say "days", no promises.

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.

No coverage comment
4 participants