Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Add new Codecov.MSBuild package providing a CodecovMSBuild task #135

Merged
merged 4 commits into from
Feb 13, 2021

Conversation

0xced
Copy link
Contributor

@0xced 0xced commented Sep 20, 2020

  • Refactored the UploadFacade class to depend on interfaces instead of CommandLineOptions so that it's usable from the MSBuild task
  • Added documentation in the README about the new Codecov.MSBuild package
  • Updated Cake scripts to handle the new Codecov.MSBuild package

@codecov
Copy link

codecov bot commented Sep 20, 2020

Codecov Report

Merging #135 (3f937c1) into develop (9e267ad) will increase coverage by 5.58%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #135      +/-   ##
===========================================
+ Coverage    65.15%   70.74%   +5.58%     
===========================================
  Files           39       37       -2     
  Lines         1013      916      -97     
  Branches       130      118      -12     
===========================================
- Hits           660      648      -12     
+ Misses         353      268      -85     

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9e267ad...3f937c1. Read the comment docs.

@AdmiringWorm AdmiringWorm added this to the vNext milestone Nov 10, 2020
@0xced 0xced force-pushed the msbuild-task branch 4 times, most recently from 096ce02 to fc38e3b Compare January 21, 2021 12:55
So that it can be re-used outside of the CLI tool. For example, in an MSBuild task.

Also, split the Uploader() function into two functions: LogContinuousIntegrationAndVersionControlSystem() + UploadReports().
@0xced
Copy link
Contributor Author

0xced commented Jan 23, 2021

I just rebased and fixed the continuous integration build in 3f937c1.

@0xced
Copy link
Contributor Author

0xced commented Jan 23, 2021

I would love to see this merged. Currently I'm using the codecov dotnet tool and it's not as elegant as the proposed MSBuild task.

With the dotnet tool:

<Target Name="UploadCoverageToCodecov" AfterTargets="GenerateCoverageResultAfterTest" Condition="$(ContinuousIntegrationBuild) == 'true'">
  <!-- For reference: the file `.config/dotnet-tools.json` was created by running `dotnet new tool-manifest && dotnet tool install Codecov.Tool` -->
  <Exec Command="dotnet tool restore" />
  <Exec Command="dotnet codecov --file &quot;@(CoverletReport, '&quot; &quot;')&quot;" />
</Target>

With the proposed MSBuild task:

<Target Name="UploadCoverageToCodecov" AfterTargets="GenerateCoverageResultAfterTest" Condition="$(ContinuousIntegrationBuild) == 'true'">
  <Codecov ReportFiles="@(CoverletReport)" />
</Target>

Also, logging is top notch with the MSBuild task.

The dictionary assertions provide better error messages if a key does not exist in a dictionary. This should help to diagnose why the following test [failed on continuous integration](https://github.com/codecov/codecov-exe/runs/1140518035?check_suite_focus=true#step:7:391).

```
Codecov.Tests.Coverage.EnviornmentVariables.EnviornmentVariablesTests.Should_Include_EnviornmentVariables_From_Options [6ms]
  Error Message:
   System.Collections.Generic.KeyNotFoundException : The given key 'foo' was not present in the dictionary.
```
It is causing this error:

```
Run SET DOTNET_31_ROOT=%DOTNET_ROOT:3.1.300=2.1.806%
  SET DOTNET_31_ROOT=%DOTNET_ROOT:3.1.300=2.1.806%
  xcopy /s /y /d %DOTNET_31_ROOT% %DOTNET_ROOT%
  shell: C:\windows\system32\cmd.EXE /D /E:ON /V:OFF /S /C "CALL "{0}""
  env:
    DOTNET_ROOT: C:\Users\runneradmin\AppData\Local\Microsoft\dotnet
Cannot perform a cyclic copy
0 File(s) copied
Error: Process completed with exit code 4.
```

Moreover, this workaround should no longer be required, see actions/setup-dotnet#25
Copy link
Collaborator

@AdmiringWorm AdmiringWorm left a comment

Choose a reason for hiding this comment

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

LGTM, sorry about the delay to merge this PR

@AdmiringWorm AdmiringWorm merged commit 7dd36ef into codecov:develop Feb 13, 2021
@AdmiringWorm
Copy link
Collaborator

@0xced your changes have been merged, thanks for your contribution 👍

I have decided that this change will be included with the next version of codecov-exe, just need to find time to be able to create a new release and check out all of the pr's to update the dependencies first.

@0xced 0xced deleted the msbuild-task branch February 13, 2021 10:25
@0xced
Copy link
Contributor Author

0xced commented Feb 13, 2021

Excellent, thanks for merging! 🥳

No need to apologise for the delay, better work at a your own pace than experience open source burnout.

@github-actions
Copy link

🎉 This issue has been resolved in version 1.13.0 🎉

The release is available on:

Your friendly GitReleaseManager bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants