Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/cake-contrib/cake.codecov

Adds Codecov support to Cake.
https://github.com/cake-contrib/cake.codecov

build cake cake-addin cake-build codecov coverage hacktoberfest script

Last synced: 22 days ago
JSON representation

Adds Codecov support to Cake.

Awesome Lists containing this project

README

        

# Cake.Codecov

[![All Contributors][all-contributorsimage]](#contributors)
[![AppVeyor branch](https://img.shields.io/appveyor/build/cakecontrib/cake-codecov/develop?logo=appveyor)](https://ci.appveyor.com/project/cakecontrib/cake-codecov/branch/develop)
[![GitHub Build](https://img.shields.io/github/actions/workflow/status/cake-contrib/Cake.Codecov/build.yml?logo=github)](https://github.com/cake-contrib/Cake.Codecov/actions/workflows/build.yml?query=branch%3Adevelop)
[![NuGet](https://img.shields.io/nuget/v/Cake.Codecov?logo=nuget)](https://www.nuget.org/packages/Cake.Codecov/)
[![Codecov](https://img.shields.io/codecov/c/github/cake-contrib/Cake.Codecov?logo=codecov)](https://codecov.io/gh/cake-contrib/Cake.Codecov)

A [Cake](https://cakebuild.net) addin that extends Cake with the ability to use
the official
[Codecov](https://docs.codecov.com/docs/codecov-uploader#using-the-cli) CLI that
have been repackaged as a NuGet package named [CodecovUploader](https://www.nuget.org/packages/CodecovUploader).

## Table of Contents

- [Usage](#usage)
- [Documentation](#documentation)
- [Codecov Tips](#codecov-tips)
- [Questions](#questions)
- [Known Issues](#known-issues)
- [Contributors](#contributors)

## Usage

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

```csharp
#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.

```csharp
Task("Upload-Coverage")
.Does(() =>
{
// Upload a coverage report.
Codecov("coverage.xml");
});
```

```csharp
Task("Upload-Coverage")
.Does(() =>
{
// Upload coverage reports.
Codecov(new[] { "coverage1.xml", "coverage2.xml" });
});
```

```csharp
Task("Upload-Coverage")
.Does(() =>
{
// Upload a coverage report by providing the Codecov upload token.
Codecov("coverage.xml", "00000000-0000-0000-0000-000000000000");
});
```

```csharp
Task("Upload-Coverage")
.Does(() =>
{
// Upload coverage reports by providing the Codecov upload token.
Codecov(new[] { "coverage1.xml", "coverage2.xml" }, "00000000-0000-0000-0000-000000000000");
});
```

```csharp
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](https://cakebuild.net/extensions/cake-codecov/).

## 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](https://github.com/cake-contrib/Cake.Codecov/issues) or ask a question in [GitHub Discussions](https://github.com/cake-build/cake/discussions) under the [Extension Q&A](https://github.com/cake-build/cake/discussions/categories/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*)

```csharp
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 { { "APPVEYOR_BUILD_VERSION", buildVersion } }
};
Codecov(settings);
});
```

## Contributors

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/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](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!

[all-contributors]: https://github.com/all-contributors/all-contributors
[all-contributorsimage]: https://img.shields.io/github/all-contributors/cake-contrib/Cake.Codecov.svg?color=orange&style=flat-square