Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Open more actions menu

Repository files navigation

Cake.Codecov

All Contributors AppVeyor branch GitHub Build NuGet Codecov

A Cake addin that extends Cake with the ability to use the official Codecov CLI that have been repackaged as a NuGet package named CodecovUploader.

Table of Contents

Usage

In order to use this addin, add to your Cake script

#tool nuget:?package=CodecovUploader
#addin nuget:?package=Cake.Codecov // Any versions before 1.1.0 is not guaranteed to work anymore.

Then use one of the following snippets to upload your coverage report to Codecov.

Task("Upload-Coverage")
    .Does(() =>
{
    // Upload a coverage report.
    Codecov("coverage.xml");
});
Task("Upload-Coverage")
    .Does(() =>
{
    // Upload coverage reports.
    Codecov(new[] { "coverage1.xml", "coverage2.xml" });
});
Task("Upload-Coverage")
    .Does(() =>
{
    // Upload a coverage report by providing the Codecov upload token.
    Codecov("coverage.xml", "00000000-0000-0000-0000-000000000000");
});
Task("Upload-Coverage")
    .Does(() =>
{
    // Upload coverage reports by providing the Codecov upload token.
    Codecov(new[] { "coverage1.xml", "coverage2.xml" }, "00000000-0000-0000-0000-000000000000");
});
Task("Upload-Coverage")
    .Does(() =>
{
    // Upload a coverage report using the CodecovSettings.
    Codecov(new CodecovSettings {
        Files = new[] { "coverage.xml" },
        Token = "00000000-0000-0000-0000-000000000000",
        Flags = "ut"
    });
});

Documentation

Documentation for the addin can be found on the Cake Website.

Codecov Tips

  1. While CI Service like GitHub Action, these workflows are likely to hit a rate limit on Codecov. As such it is recommended to always pass in a repository or global token when one is available.
  2. Do not set NonZero to true when running without a Codecov token.

Questions

Feel free to open an issue or ask a question in GitHub Discussions under the Extension Q&A category, and by tagging us: @larzw and/or @AdmiringWorm.

Known Issues

  • Coverage report upload fails when using gitversion (or other tools that change the appveyor build version) Workaround: Add the following in your Upload Coverage task (only needed if gitversion is run on the same call as the uploading of coverage reports in appveyor.yml)

    Task("Upload-Coverage")
        .Does(() =>
    {
        // The logic may differ from what you actually need.
        // This way is for the use with GitVersion.
        // Basically, the buildVersion format needs to be exactly the
        // same as the build version shown on appveyor when the build is done.
        var buildVersion = string.Format("{0}.build.{1}",
            variableThatStores_GitVersion_FullSemVer,
            BuildSystem.AppVeyor.Environment.Build.Number
        );
        var settings = new CodecovSettings {
            Files = new[] { "coverage.xml" },
            EnvironmentVariables = new Dictionary<string,string> { { "APPVEYOR_BUILD_VERSION", buildVersion } }
        };
        Codecov(settings);
    });

Contributors

Thanks goes to these wonderful people (emoji key):

Larz White
Larz White

🚧
Kim J. Nordmo
Kim J. Nordmo

🚧
Gary Ewan Park
Gary Ewan Park

👀 🤔
Vishal Bishnoi
Vishal Bishnoi

💻
Pascal Berger
Pascal Berger

🤔
Toni Wenzel
Toni Wenzel

🤔
jericho
jericho

🤔
Sean Fausett
Sean Fausett

💻
C. Augusto Proiete
C. Augusto Proiete

📖 🤔
Nils Andresen
Nils Andresen

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

Morty Proxy This is a proxified and sanitized view of the page, visit original site.