codecov / codecov-exe

.exe report uploader for Codecov https://codecov.io
MIT License
25 stars 21 forks source link

Add a dotnet tool for codecov exe #44

Closed StefH closed 5 years ago

StefH commented 5 years ago

Can you make a dotnet global tool from codecov ?

So that it can be easily used in e.g. Azure Pipelines? Like

dotnet tool install --global dotnet-codecov

or

dotnet tool install --global codecov

See also this list from all supported tools until now: https://github.com/natemcmaster/dotnet-tools

AdmiringWorm commented 5 years ago

I'm not familiar with writing dotnet tools. But I'm guessing it would require quite the rewrite of the application to work as expected, which unfortunately I doubt I would have the time for anytime soon. Nor am I familiar with azure pipelines for that matter.

I'm not against the idea though.

StefH commented 5 years ago

I think it's very easy to convert codecov into a dotnet tool, only things needed are small updates in the .csproj file.

Example:

<PackAsTool>true</PackAsTool>

And then upload as NuGet. (Maybe you need another name because codecov is already there)

See this page: https://docs.microsoft.com/en-us/dotnet/core/tools/global-tools-how-to-create Azure Pipelines was just an example.

AdmiringWorm commented 5 years ago

That may be the only change if we were to only provide the dotnet tool, but doing that would also break pretty much every project using codecov-exe already.

I have a few ideas to test out, but unfortunately isn't really in a position to do that right now.

StefH commented 5 years ago

An easy work-around is to wrap that extra setting in an IF condition which checks for an environment variable.

Example where this xml is only used when the buildType environment variable is set to "DOTNET_TOOL".

<PropertyGroup Condition=" '$(buildType)' == 'DOTNET_TOOL' ">
  <PackAsTool>true</PackAsTool>
</PropertyGroup>
AdmiringWorm commented 5 years ago

@StefH this is one of the paths I was considering to test out.

AdmiringWorm commented 5 years ago

The Codecov.Tool package was just pushed to nuget, it is still indexing so give it some time until it can be used.

Thank you @ViktorHofer for providing the project file to make this available.

ViktorHofer commented 5 years ago

Thanks for providing the tool! 👍