• Stars
    star
    1,391
  • Rank 32,604 (Top 0.7 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created almost 5 years ago
  • Updated 15 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

GitHub Action that uploads coverage to Codecov β˜‚οΈ

Codecov GitHub Action

GitHub Marketplace FOSSA Status Workflow for Codecov Action

Easily upload coverage reports to Codecov from GitHub Actions

The latest release of this Action adds support for tokenless uploads from GitHub Actions!

⚠️ Deprecation of v1

As of February 1, 2022, v1 has been fully sunset and no longer functions

Due to the deprecation of the underlying bash uploader, the Codecov GitHub Action has released v2/v3 which will use the new uploader. You can learn more about our deprecation plan and the new uploader on our blog.

We will be restricting any updates to the v1 Action to security updates and hotfixes.

Migration from v1 to v3

The v3 uploader has a few breaking changes for users

  • Multiple fields have not been transferred from the bash uploader or have been deprecated. Notably many of the functionalities and gcov_ arguments have been removed. Please check the documentation below for the full list.

Usage

To integrate Codecov with your Actions pipeline, specify the name of this repository with a tag number (@v3 is recommended) as a step within your workflow.yml file.

If you have a private repository, this Action also requires you to provide an upload token from codecov.io (tip: in order to avoid exposing your token, store it as a secret). Optionally, you can choose to include up to four additional inputs to customize the upload context. For public repositories, no token is needed

Inside your .github/workflows/workflow.yml file:

steps:
- uses: actions/checkout@master
- uses: codecov/codecov-action@v3
  with:
    token: ${{ secrets.CODECOV_TOKEN }}
    files: ./coverage1.xml,./coverage2.xml # optional
    flags: unittests # optional
    name: codecov-umbrella # optional
    fail_ci_if_error: true # optional (default = false)
    verbose: true # optional (default = false)

Note: This assumes that you've set your Codecov token inside Settings > Secrets as CODECOV_TOKEN. If not, you can get an upload token for your specific repo on codecov.io. Keep in mind that secrets are not available to forks of repositories.

Arguments

Codecov's Action supports inputs from the user. These inputs, along with their descriptions and usage contexts, are listed in the table below:

Input Description Usage
token Used to authorize coverage report uploads *Required
move_coverage_to_trash Move discovered coverage reports to the trash Optional
commit_parent The commit SHA of the parent for which you are uploading coverage. If not present, the parent will be determined using the API of your repository provider. When using the repository provider's API, the parent is determined via finding the closest ancestor to the commit. Optional
dry_run Don't upload files to Codecov Optional
env_vars Environment variables to tag the upload with. Multiple env variables can be separated with commas (e.g. OS,PYTHON) Optional
fail_ci_if_error Specify if CI pipeline should fail when Codecov runs into errors during upload. Defaults to false Optional
files Comma-separated paths to the coverage report(s). Negated paths are supported by starting with ! Optional
flags Flag the upload to group coverage metrics (unittests, uitests, etc.). Multiple flags are separated by a comma (ui,chrome) Optional
full_report Specify the path of a full Codecov report to re-upload Optional
functionalities Toggle functionalities Optional
-- network Disable uploading the file network Optional
-- fixes Enable file fixes to ignore common lines from coverage Optional
-- search Disable searching for coverage files Optional
gcov Run with gcov support Optional
gcov_args Extra arguments to pass to gcov Optional
gcov_ignore Paths to ignore during gcov gathering Optional
gcov_include Paths to include during gcov gathering Optional
gcov_executable gcov executable to run. Defaults to gcov. Optional
name Custom defined name for the upload Optional
network_filter Specify a filter on the files listed in the network section of the Codecov report. Useful for upload-specific path fixing Optional
network_prefix Specify a prefix on files listed in the network section of the Codecov report. Useful to help resolve path fixing Optional
os Specify the OS (linux, macos, windows, alpine) Optional
override_branch Specify the branch name Optional
override_build Specify the build number Optional
override_commit Specify the commit SHA Optional
override_pr Specify the pull request number Optional
override_tag Specify the git tag Optional
root_dir Used when not in git/hg project to identify project root directory Optional
directory Directory to search for coverage reports. Optional
slug Specify the slug manually (Enterprise use) Optional
swift Run with swift coverage support Optional
-- swift_project Specify the swift project to speed up coverage conversion Optional
upstream_proxy The upstream http proxy server to connect through Optional
url Change the upload host (Enterprise use) Optional
verbose Specify whether the Codecov output should be verbose Optional
version Specify which version of the Codecov Uploader should be used. Defaults to latest Optional
working-directory Directory in which to execute codecov.sh Optional
xtra_args Add additional uploader args that may be missing in the Action Optional

Example workflow.yml with Codecov Action

name: Example workflow for Codecov
on: [push]
jobs:
  run:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
    env:
      OS: ${{ matrix.os }}
      PYTHON: '3.10'
    steps:
    - uses: actions/checkout@master
    - name: Setup Python
      uses: actions/setup-python@master
      with:
        python-version: 3.10
    - name: Generate coverage report
      run: |
        pip install pytest
        pip install pytest-cov
        pytest --cov=./ --cov-report=xml
    - name: Upload coverage to Codecov
      uses: codecov/codecov-action@v3
      with:
        token: ${{ secrets.CODECOV_TOKEN }}
        directory: ./coverage/reports/
        env_vars: OS,PYTHON
        fail_ci_if_error: true
        files: ./coverage1.xml,./coverage2.xml,!./cache
        flags: unittests
        name: codecov-umbrella
        verbose: true

Contributing

Contributions are welcome! Check out the Contribution Guide.

License

The code in this project is released under the MIT License.

FOSSA Status

More Repositories

1

self-hosted

Example of how to setup Codecov with docker compose
Shell
379
star
2

example-python

Python coverage example
Python
299
star
3

codecov-node

Global coverage report uploader for Codecov in NodeJS
JavaScript
291
star
4

codecov-bash

Global coverage report uploader for Codecov
Shell
231
star
5

browser-extension

Codecov Browser Extension
JavaScript
212
star
6

example-go

Go coverage example
Go
210
star
7

codecov-api

Code for the API of Codecov
Python
206
star
8

example-node

Example repo for uploading reports to Codecov
JavaScript
191
star
9

codecov-python

Python report uploader for Codecov
Python
184
star
10

example-android

Android code coverage example with https://codecov.io
Java
144
star
11

example-cpp11-cmake

CMake
143
star
12

example-swift

Codecov: Swift coverage example
Swift
127
star
13

example-csharp

Codecov: C# example repository
C#
115
star
14

timestring

Making time easier since "Jan 17th, 2013 at 3:59pm"
Python
101
star
15

uploader

Codecov's universal binary uploader.
TypeScript
101
star
16

example-rust

Rust
87
star
17

example-php

PHP coverage example
PHP
86
star
18

example-java-gradle

Java
84
star
19

sourcegraph-codecov

See code coverage information from Codecov on GitHub, Sourcegraph, and other tools.
TypeScript
74
star
20

codecov-ruby

Ruby uploader for Codecov
Ruby
70
star
21

example-java

Java Example
69
star
22

example-java-maven

Java
54
star
23

example-bash

Codecov: Bash/Shell coverage example
Ruby
50
star
24

example-typescript

Example repo for uploading reports to Codecov https://codecov.io
TypeScript
47
star
25

worker

Code for Background Workers of Codecov
Python
45
star
26

codecov-cli

Codecov's Command Line Interface. Used for uploading to Codecov in your CI, Test Labelling, Local Upload, and more
Python
43
star
27

gazebo

React SPA
TypeScript
42
star
28

example-scala

Scala coverage example
Scala
35
star
29

example-c

Upload reports to Codecov using C/C++
C
34
star
30

feedback

A place to discuss feedback about the pull request and web product experience.
33
star
31

dart

Codecov Dart coverage report uploader
Dart
29
star
32

codecov-browser-extension

A browser extension for Codecov. Works for Chrome and Firefox
TypeScript
29
star
33

opentelem-laravel

A WIP exporter for Laravel to capture and export opentelem data.
PHP
28
star
34

codecov-exe

.exe report uploader for Codecov https://codecov.io
C#
25
star
35

example-objc

Codecov example for Xcode
Objective-C
25
star
36

example-fortran

Example repo for uploading reports to Codecov
Fortran
22
star
37

example-perl

Perl
22
star
38

example-kotlin

Kotlin coverage example
Kotlin
21
star
39

example-ruby

Ruby coverage example
Ruby
20
star
40

swift-standard

Codecov coverage standard for Swift
Swift
19
star
41

codecov-circleci-orb

Shell
18
star
42

example-r

R
17
star
43

example-elixir

Elixir
15
star
44

codecov-perl

Backend for Codecov reporting of coverage
Perl
14
star
45

example-clojure

Example Clojure integration with Codecov
Clojure
14
star
46

contributing

14
star
47

go-standard

Codecov coverage standard for go
Python
13
star
48

shared

Shared code between worker and api
Python
13
star
49

python-standard

Codecov coverage standard for Python
Python
13
star
50

example-vala

Vala
12
star
51

cf-flags-demo

A demo of Codecov's carryforward flags feature.
Python
12
star
52

example-julia

Julia
11
star
53

example-d

Example repository for D and Codecov
D
10
star
54

java-standard

Codecov coverage standard for Java
Python
9
star
55

kotlin-standard

Codecov coverage standard for Kotlin
Kotlin
8
star
56

typescript-standard

Codecov coverage standard for TypeScript
JavaScript
8
star
57

cpp-11-standard

Codecov coverage standard for c++ 11
C++
7
star
58

example-groovy

Groovy coverage example
Groovy
7
star
59

example-lua

Shell
7
star
60

standards

List of Codecov language standards
C++
7
star
61

vscode

A Codecov vscode extention which helps validate and configure new repositories.
Python
6
star
62

helm-charts

Public Helm Charts
6
star
63

example-fsharp

Example of codecov in fsharp
F#
6
star
64

example-actions-bundled

Python
5
star
65

codecov-demo-full

JavaScript
5
star
66

codecov-racket

Codecov support for Cover.
Racket
5
star
67

opentelem-node

A WIP OpenTelemetry Exporter for Runtime Insights
JavaScript
4
star
68

example-erlang

Erlang
4
star
69

example-cpp

4
star
70

media

Press and marketing resources
3
star
71

example-xtend

Xtend coverage example
Xtend
3
star
72

example-scala-maven

Scala via Maven coverage example
Scala
3
star
73

ruby-standard-2

Codecov coverage standard for Ruby using Codecov's Bash uploader
Ruby
3
star
74

nginx

Dockerfile
3
star
75

example-haskell

3
star
76

example-delphi

2
star
77

ruby-standard-1

Codecov coverage standard for Ruby using the Codecov gem
Ruby
2
star
78

example-csharp-sharpcover

C#
2
star
79

example-kotlin-flat

Kotlin codecov example with standard file structure
Kotlin
2
star
80

opentelem-python

Open Telemetry Python Prototype
Python
2
star
81

codecov-javascript-bundler-plugins

Set of bundler plugins that allow users to upload bundle stats to Codecov.
TypeScript
2
star
82

codecov-bitrise

Shell
1
star
83

node-static-alpine

Internal Node builder for the Alpine version of the uploader
1
star
84

example-gradle-multiproject

Java
1
star
85

example-java-ant

1
star
86

impact-analysis-example-laravel

An example repository demonstrating runtime insights with Laravel
PHP
1
star
87

xcode-poc

Swift
1
star
88

ci-repo

debug and ci only
Python
1
star
89

prometheus

Shell
1
star
90

impact-analysis-example-ruby

Ruby
1
star
91

example-javascript

JavaScript
1
star
92

codecov-ats

GitHub Action that uploads returns selected test labels to CI β˜‚οΈ
Shell
1
star
93

.github

Community Health Files for the Codecov Organization
1
star
94

engineering-team

This is a general repo to use with GH Projects
1
star
95

grafana

Dockerfile
1
star
96

node-alpine-static

Builds a fully static copy of NodeJS from source to be used by codecov/uploader
1
star
97

codecov-interview-api

Python
1
star
98

example-azure-pipelines

Azure Pipelines coverage example
Python
1
star
99

fork-test

Python
1
star
100

impact-analysis-example-python

HTML
1
star