codecov-exe
codecov-exe copied to clipboard
.exe report uploader for Codecov https://codecov.io
🚨🚨 Deprecation Notice 🚨🚨
This uploader is being deprecated by the Codecov team. We recommend migrating to our new uploader as soon as possible to prevent any lapses in coverage. The new uploader is open source, and we highly encourage submitting Issues and Pull Requests.
You can visit our blog post to learn more about our deprecation plan
On February 1, 2022 this uploader will be completely deprecated and will no longer be able to upload coverage to Codecov.
Codecov global executable uploader for .NET Framework/Core based builds.
| https://codecov.io/ | @codecov | [email protected] |
|---|
Introduction
-
This uploader supports Windows 7 (x64) and above, Linux (x64), and OS X (x64).
-
See the following section of supported CI providers.
-
Many Codecov CLI options are supported. Run
.\codecov.exe --helpor see CommandLineOptions.cs for more details. -
On windows you can download the exe from NuGet or Chocolatey. There is also the .Net tool called Codecov.Tool which supports all platforms. As an alternative to NuGet or Chocolatey you can download the exe as the asset Codecov-{os}.zip under the release. The following PowerShell (version 5) commands might be helpful.
(New-Object System.Net.WebClient).DownloadFile("<url>", (Join-Path $pwd "Codecov.zip")) # Download Codecov.zip from github release.
Expand-Archive .\Codecov.zip -DestinationPath . # UnZip the file.
.\Codecov\codecov.exe # Run codecov.exe with whatever commands you need.
Quick Start
For a basic use case, in PowerShell run the following commands,
> choco install codecov
> codecov.exe -f <path to coverage report> -t <Codecov upload token>
or using the .NET Core tool
dotnet tool install --global Codecov.Tool
codecov -f <path to coverage report> -t <Codecov upload token>
For an AppVeyor build, the appveyor.yml file would look something like
before_build:
- choco install codecov # Can be changed to dotnet tool install --global Codecov.Tool
test_script:
# Note that, a Codecov upload token is not required.
- codecov -f <path to coverage report>
You may also use globbing patterns for specifying files and codecov-exe will take care of resolving these paths, make sure to quote the path or depending on your shell it may be resolved before calling codecov-exe.
codecov -f "artifacts/coverage/**/*.xml" -t <Codecov upload token>
You can see additional globbing patterns supported by codecov-exe by heading over to: https://github.com/kthompson/glob/#supported-pattern-expressions
MSBuild Integration
Alternatively, you can use the Codecov.MSBuild NuGet pacakge which provides the Codecov task for use in your project files.
For example, to upload reports generated with the coverlet.msbuild task which produces the CoverletReport items:
<Target Name="UploadCoverageToCodecov" AfterTargets="GenerateCoverageResultAfterTest">
<Codecov ReportFiles="@(CoverletReport)" />
</Target>
The only required parameter is ReportFiles, all other parameters are automatically guessed based on current environment variables and git repository status but you can override them if needed. See Codecov.cs for the complete list of supported parameters.
Cake Addin
If you use Cake (C# Make) for your builds, you may be intrested in the Cake.Codecov addin.
CI Providers
The following CI providers are supported:
| Company | Supported | Token Required |
|---|---|---|
| AppVeyor | Yes | Private only |
| Azure Pipelines | Yes | Private |
| Git | Yes (as a fallback) | Public & Private |
| GitHub Actions | Yes | Private only |
| Jenkins | Yes | Public & Private |
| TeamCity | Yes (See below) | Public & Private |
| Travis CI | Yes | Private only |
TeamCity
TeamCity does not automatically make build parameters available as environment variables. You will need to add the following environment parameters to the build configuration. To do this make sure your Branch specification under the VCS Root is configured correctly,
Then set your environment variables,
Note that, the above environment variables (except for env.TEAMCITY_BUILD_URL) can alternatively be set via the command line,
env.TEAMCITY_BUILD_BRANCH => --branch
env.TEAMCITY_BUILD_ID => --build
env.TEAMCITY_BUILD_COMMIT => --sha
env.TEAMCITY_BUILD_REPOSITORY => --slug
Questions and Contributions
All types of contributions are welcome! Feel free to open an issue or contact us through the gitter channel mentioning either @larzw or @AdmiringWorm.
Known Issues
- Specifiyng file paths with spaces is currently not possible without a workaround. This is expected to be fixed when a new major release of codecov-exe is released (See issue #71 for possible workaround and tracking).
- If you're seeing an HTTP 400 error when uploading reports to S3, make sure you've updated to at least version 1.11.0.
Maintainers
To create a relase, please do the following:
- Creating hotfix releases
- Create a branch called
hotfix/versionlocally (replace the version with the actual version to release) (Make sure that a milestone exist for this release, and all fixed/resolved issues are attached to that milestone) - Make any changes that needs to be included in the release while targeting the hotfix branch
- Merge the hotfix branch into
masterusinggit merge hotfix/version --no-ff - Push the merged branch upstream to github
- Wait for a new release and a tag have been created
- Backmerge the tag into the
developbranch
- Create a branch called
- Creating new feature releases
- Make sure that all commits have been targeted to the
developbranch - Create a new release branch using the name
release/versionlocally (replace version with actual version to release) (Make sure that a milestone exist for this release, and all fixed/resolved issues are attached to that milestone) - Make any additional changes that are necessary to this branch
- Merge the release branch into
masterusinggit merge release/version --no-ff - Push the merged branch upstream to github
- Wait for a new release and a tag have been created
- Backmerge the tag into the
developbranch
- Make sure that all commits have been targeted to the
NOTE: As soon as changes are pushed to the master branch the automated release procedure is started. This procedure will create Release notes, create a new github release, upload archived assets, upload chocolatey and nuget packages and comment on issues when the release have been completed.