Marusyk / grok.net

.NET implementation of the grok 📝
MIT License
287 stars 55 forks source link

Generate code coverage badge #39

Closed Adityanr closed 2 years ago

Adityanr commented 2 years ago

build.cake modified to generate coverage badge in README.md using opencover and reportgenerator Closes #30

Adityanr commented 2 years ago

Hi @Marusyk Can you please register grok.NET repository at https://coveralls.io ?

I have done the following:

The following needs to be done now:

  1. Register grok.net repository (https://github.com/Marusyk/grok.net) at coveralls.
  2. Click on details next to the newly registered repository name.
  3. Fetch the generated or supposedly generated badge URL from the bottom section as follows: markdown_url_coverage
  4. Send me the coverage badge markdown URL obtained above so I can update README.md with the new badge URL and set the PR ready for review.
  5. Add the Coveralls repo token obtained as an environment variable (COVERALLS_REPO_TOKEN) in the CI post merge build for main branch.
  6. Update github workflows with Upload-Coverage-Report as target instead of Run-Unit-Tests

Thank you!

Marusyk commented 2 years ago

Hi @Adityanr wow, thank you very much for this

I've added the token as a Repository secret. Here is markdown

[![Coverage Status](https://coveralls.io/repos/github/Marusyk/grok.net/badge.svg?branch=main)](https://coveralls.io/github/Marusyk/grok.net?branch=main)
Adityanr commented 2 years ago

Hi @Adityanr wow, thank you very much for this

I've added the token as a Repository secret. Here is markdown

[![Coverage Status](https://coveralls.io/repos/github/Marusyk/grok.net/badge.svg?branch=main)](https://coveralls.io/github/Marusyk/grok.net?branch=main)

Hi @Marusyk I have update README.md with the new badge for main branch! It will display new coverage after main branch CI pipeline build is run. All it needs now is github workflow update. I don't seem to have a push access for that. Can you please make that change if this PR gets merged?

Marusyk commented 2 years ago

@Adityanr Could you please check Windows.yml image

Adityanr commented 2 years ago

sure, lemme check @Marusyk

Adityanr commented 2 years ago

Hi, @Marusyk The build steps are working fine locally. Is the windows build server running as a container? If so maybe the user does not have appropriate permissions to register the opencover profiler. The following modification to Run-Unit-Tests target can be made for this to work:

Task("Run-Unit-Tests")
    .IsDependentOn("Build")
    .Does(() =>
{
    var projectFile = Directory("./src/Grok.Net.Tests") + File("Grok.Net.Tests.csproj");

    if(!BuildSystem.IsLocalBuild)
    {
        DotNetCoreTest(System.IO.Path.GetFullPath(projectFile), new DotNetCoreTestSettings()
        {
            Configuration = configuration
        });
    }
    else
    {
        OpenCover(tool => {
                tool.DotNetCoreTest(
                System.IO.Path.GetFullPath(projectFile),
                new DotNetCoreTestSettings()
                {
                    Configuration = configuration
                }
                );
            },
            testResultFile, new OpenCoverSettings() {
                Filters = { "-[*xunit*]*", "-[GrokNetTests.UnitTests]*", "+[*]*" },
                Register = "User"
            }
        );
    }
});

Added the Register = "User" for OpenCoverSettings. Should i raise another PR for the same? local_execution

Marusyk commented 2 years ago

Should i raise another PR for the same? Yes please