-
Notifications
You must be signed in to change notification settings - Fork 388
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
coverlet.collector producing empty coverage file in CI only #1088
Comments
Is it only |
StrongInject.Tests.Unit is empty Locally they all have results |
That one is weird. Can you try adding diagnostic logging and share the resulting file? Description on how to do that with coverlet.collectors here: https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/Troubleshooting.md#collectors-integration |
Sure will do. Really appreciate your assistance! By the way if it's easier for you than going backwards and forwards, feel free to modify the GitHub actions yourself and open a PR to trigger CI. Obviously happy to do this all myself, so only if you actually prefer doing it yourself |
It's easier if you try it in your branch, so please go ahead :) |
You can see the diag file here: https://github.com/YairHalberstadt/stronginject/runs/1927012701 under "Move Tests Coverage Reports" where I cat it. Would copy and paste it here, but it's huuuge |
Thanks, not much useful in |
Ok, here's a gist with all coverlet logs files just for StrongInject.Tests.Unit: https://gist.github.com/YairHalberstadt/fec5b93708c8d773595a08691ca376a8 I can't tell you where one ends and the next begins, as I just did cat log* I'm afraid. The test run is here: https://github.com/YairHalberstadt/stronginject/runs/1933761369?check_suite_focus=true EDIT: Note the display in github is truncated. Go here to see the full file |
The only issues I see there are related to xunit and the testhost, and I don't think that's something that can cause an issue with the coverage:
|
(EDIT: updated after reading up on source generators.) I only have one other thought, at this point: since StrongInject.Extensions.DependencyInjection.Tests is the only one that produces a coverage result, there is a rather interesting difference between that and the other test projects. The Unit and Integration test projects include the source generator only:
The StrongInject.Extension.DependencyInjection.Test.csproj use that, but also a regular project reference to the extension package:
StrongInject.Extensions.DependencyInjection.csproj in turn references StrongInject\StrongInject.csproj, but as a regular ProjectReference. Now I'm just guessing, but I reckon the coverage that the last test picks up is through this transitive reference, while there's something with the source generator reference that doesn't work in the CI build but does locally. |
I see that your source generator produces file with the suffix It seems far-fetched that could cause a problem in CI only and not locally, but maybe worth a shot? |
Sorry I haven't tried your previous suggestion - I've been very busy and haven't got round to it. I'll give both your ideas a spin, hopefully soon. Thanks for all your help! |
It looks like the problem is that StrongInject multitargets .Net Standard 2.0, and .Net Standard 2.1. The generator part is only included in the .Net Standard 2.0 target, and so my unit tests reference the .Net Standard 2.0 target. I have no idea why that should only affect CI build, and not normal build. |
Closing for stale conversation, feel free to reopen if needed. |
I'm experimenting with using coverlet for stronginject.
This is fine locally, but in the CI the coverlet file is empty:
Deterministic build is enabled, but we're using .Net 5, which I think should just automatically work according to your documentation.
reproducing
This is running in github actions on one of my branches.
You can see the github action results here: https://github.com/YairHalberstadt/stronginject/runs/1910881809
In the "Move Tests Coverage Reports" I cat one of the files, so you can see the coverage report:
You can view the workflow file here: https://github.com/YairHalberstadt/stronginject/actions/runs/571715677/workflow
Any help would be much appreciated, thanks!
The text was updated successfully, but these errors were encountered: