How I added AppVeyor, Codecov to .Net Core Open Source Project by codingdefined

View this thread on steempeak.com
· @codingdefined ·
$4.55
How I added AppVeyor, Codecov to .Net Core Open Source Project
AppVeyor is Continous Integration and Deployment solution where you can build, test and deploy your apps faster to any platform. One good advantage of using appveyor is that it is free for Open Source repositories. It's actually good when your repo is accepting pull request from people and then you can test if the pull request is merging or not. 

On the other hand, Codec helps you to do a health check on your code, i.e. it is a measurement on how many lines of your code are executed when automated tests are performing. Now 100% Code Coverage means that all your code is covered under tests, but that is very hard to achieve. 

I have to do a lot of commits to test the AppVeyor and Codecov and at last, it iwas successful and I can build and generate a code coverage report for my application. At first, I have started using NuGet package OpenCover to create code-coverage in my local environment and it was working after trial and error method.

The Script I have used is as below

```
OpenCover.Console.exe -register:user 
-target:"C:\Program Files\dotnet\dotnet.exe" 
-targetargs:"test\LetsDisc.Tests\bin\Debug\netcoreapp2.1\LetsDisc.Tests.dll -noshadow" 
-oldStyle -output:".\coverage.xml" 
-filter:"+[LetsDisc*]* -[Tests*]*" -coverbytest:"XUnit"
```
----

But as a developer, we should know that what works in local has a 100% probability that it will not work in some other environments. That is what happened in my case when I tried to run the above script in AppVeyor some or the other issues are popping up. But at last, I made it work. So the final script is

```
version: 1.0.{build}
image: Visual Studio 2017
configuration: Release
skip_tags: true
before_build:
 - nuget restore
 - nuget install OpenCover -OutputDirectory packages -Version 4.6.519
build_script:
 - msbuild /verbosity:quiet LetsDisc.sln
test_script:
 - .\packages\OpenCover.4.6.519\tools\OpenCover.Console.exe 
-register:user 
-target:"C:/Program Files/dotnet/dotnet.exe" 
-targetargs:"test --logger:trx;LogFileName=results.trx 
/p:DebugType=full 
C:\projects\letsdisc\test\LetsDisc.Tests\LetsDisc.Tests.csproj" 
-output:"coverage.xml" -filter:"+[LetsDisc*]* -[Tests*]*"
after_test:
  - ps: |
      $env:PATH = 'C:\msys64\usr\bin;' + $env:PATH
      Invoke-WebRequest -Uri 'https://codecov.io/bash' -OutFile codecov.sh
      bash codecov.sh -f "coverage.xml"
```
----

The above script means on every build I will be updating it with a version of 1.0.{buildNumber}, then use Visual Studio 2017 as an image to build the project, then use configuration as release mode and not debug so that it can be easily deployable. Before the build just restoring all the nuget package, as well as installing OpenCover specific version which works with AppVeyor. After that building the project using msbuild and then running my test script to run the tests and create the coverage report. After the test is scuccessful deploying the coverage.xml file to the Codecov website.

It was fun as well as a learning experiment where I learned to use an Appveyor app as well adding the Coverage report to my project. 

Repo : https://github.com/codingdefined/LetsDisc

----

#### Also Published to My Personal Blog: https://www.codingdefined.com/2018/10/how-i-added-appveyor-codecov-to-net.html
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 19 others
properties (23)
post_id64,352,162
authorcodingdefined
permlinkhow-i-added-appveyor-codecov-to-net-core-open-source-project
categoryblog
json_metadata{"links":["https:\/\/github.com\/codingdefined\/LetsDisc","https:\/\/www.codingdefined.com\/2018\/10\/how-i-added-appveyor-codecov-to-net.html"],"format":"markdown","tags":["blog","india","developer","programming","opensource"],"app":"steemit\/0.1"}
created2018-10-16 12:48:57
last_update2018-10-16 12:48:57
depth0
children3
net_rshares3,608,561,758,532
last_payout2018-10-23 12:48:57
cashout_time1969-12-31 23:59:59
total_payout_value3.454 SBD
curator_payout_value1.100 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length3,259
author_reputation71,157,752,447,147
root_title"How I added AppVeyor, Codecov to .Net Core Open Source Project"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (83)
@ilovecoding ·
Hello! Your post has been resteemed and upvoted by @ilovecoding because **we love coding**! Keep up good work! Consider upvoting this comment to support the @ilovecoding and increase your future rewards! ^_^ Steem On! 
 ![](https://codingforspeed.com/images/i-love-coding.jpg) 
*Reply !stop to disable the comment. Thanks!*
👍  
properties (23)
post_id64,352,170
authorilovecoding
permlink20181016t124908859z
categoryblog
json_metadata{"tags":["ilovecoding"],"app":"ilovecoding"}
created2018-10-16 12:49:09
last_update2018-10-16 12:49:09
depth1
children0
net_rshares367,004,701
last_payout2018-10-23 12:49:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length323
author_reputation40,842,386,526
root_title"How I added AppVeyor, Codecov to .Net Core Open Source Project"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (1)
@indiaunited ·
This post has been rewarded with 100% upvote from @indiaunited-bot community account. We are happy to have you as one of the valuable member of the community. 

If you would like to delegate to @IndiaUnited you can do so by clicking on the following links: [5SP](https://v2.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=indiaunited&vesting_shares=10243.049665%20VESTS), [10SP](https://v2.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=indiaunited&vesting_shares=20486.098277%20VESTS), [15SP](https://v2.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=indiaunited&vesting_shares=30729.146205%20VESTS), [20SP](https://v2.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=indiaunited&vesting_shares=40972.193747%20VESTS) [25SP](https://v2.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=indiaunited&vesting_shares=51220.989954%20VESTS), [50SP](https://v2.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=indiaunited&vesting_shares=102441.979908%20VESTS), [100SP](https://v2.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=indiaunited&vesting_shares=204883.959817%20VESTS), [250SP](https://v2.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=indiaunited&vesting_shares=512209.899542%20VESTS). Be sure to leave at least 50SP undelegated on your account. 

<center>[![](https://steemitimages.com/DQmYB5reyMkG1qziLQM3uKSVzMu6XkJvPmtRrbJafytAH2X/image.png)](https://discord.gg/8AqN2Qt)</center> 

 **Please contribute to the community by upvoting this comment and posts made by @indiaunited.**
properties (22)
post_id64,352,661
authorindiaunited
permlinkindiaunited-1539694712920
categoryblog
json_metadata{"tags":["indiaunited"]}
created2018-10-16 12:58:33
last_update2018-10-16 12:58:33
depth1
children0
net_rshares0
last_payout2018-10-23 12:58:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length1,620
author_reputation363,078,054,770
root_title"How I added AppVeyor, Codecov to .Net Core Open Source Project"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@steem-ua ·
#### Hi @codingdefined!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your **UA** account score is currently 5.111 which ranks you at **#931** across all Steem accounts.
Your rank has improved 1 places in the last three days (old rank 932).

In our last Algorithmic Curation Round, consisting of 516 contributions, your post is ranked at **#501**.
##### Evaluation of your UA score:

* You've built up a nice network.
* The readers like your work!
* Try to work on user engagement: the more people that interact with you via the comments, the higher your UA score!


**Feel free to join our [@steem-ua Discord server](https://discord.gg/KpBNYGz)**
properties (22)
post_id64,458,408
authorsteem-ua
permlinkre-how-i-added-appveyor-codecov-to-net-core-open-source-project-20181018t055842z
categoryblog
json_metadata{"app":"beem\/0.20.7"}
created2018-10-18 05:58:42
last_update2018-10-18 05:58:42
depth1
children0
net_rshares0
last_payout2018-10-25 05:58:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length705
author_reputation23,203,609,903,979
root_title"How I added AppVeyor, Codecov to .Net Core Open Source Project"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000