• Stars
    star
    1,469
  • Rank 32,013 (Top 0.7 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 5 years ago
  • Updated about 1 month 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
424
star
2

example-python

Python coverage example
Python
301
star
3

codecov-node

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

codecov-bash

Global coverage report uploader for Codecov
Shell
233
star
5

browser-extension

Codecov Browser Extension
JavaScript
213
star
6

codecov-api

Code for the API of Codecov
Python
213
star
7

example-go

Go coverage example
Go
213
star
8

example-node

Example repo for uploading reports to Codecov
JavaScript
192
star
9

codecov-python

Python report uploader for Codecov
Python
184
star
10

example-android

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

example-cpp11-cmake

CMake
144
star
12

example-swift

Codecov: Swift coverage example
Swift
127
star
13

example-csharp

Codecov: C# example repository
C#
115
star
14

uploader

Codecov's universal binary uploader.
TypeScript
104
star
15

timestring

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

example-rust

Rust
89
star
17

example-php

PHP coverage example
PHP
88
star
18

example-java-gradle

Java
86
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
72
star
21

example-java

Java Example
70
star
22

example-java-maven

Java
58
star
23

example-bash

Codecov: Bash/Shell coverage example
Ruby
50
star
24

codecov-cli

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

worker

Code for Background Workers of Codecov
Python
47
star
26

example-typescript

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

gazebo

React SPA
TypeScript
45
star
28

example-c

Upload reports to Codecov using C/C++
C
35
star
29

example-scala

Scala coverage example
Scala
35
star
30

codecov-browser-extension

A browser extension for Codecov. Works for Chrome and Firefox
TypeScript
35
star
31

feedback

A place to discuss feedback about the pull request and web product experience.
34
star
32

opentelem-laravel

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

dart

Codecov Dart coverage report uploader
Dart
29
star
34

example-objc

Codecov example for Xcode
Objective-C
26
star
35

codecov-exe

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

example-perl

Perl
23
star
37

example-fortran

Example repo for uploading reports to Codecov
Fortran
22
star
38

codecov-circleci-orb

Python
20
star
39

example-ruby

Ruby coverage example
Ruby
20
star
40

swift-standard

Codecov coverage standard for Swift
Swift
19
star
41

example-kotlin

Kotlin coverage example
Kotlin
19
star
42

example-r

R
17
star
43

example-elixir

Elixir
16
star
44

go-standard

Codecov coverage standard for go
Python
14
star
45

codecov-perl

Backend for Codecov reporting of coverage
Perl
14
star
46

contributing

14
star
47

example-clojure

Example Clojure integration with Codecov
Clojure
14
star
48

python-standard

Codecov coverage standard for Python
Python
14
star
49

shared

Shared code between worker and api
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

kotlin-standard

Codecov coverage standard for Kotlin
Kotlin
9
star
55

typescript-standard

Codecov coverage standard for TypeScript
JavaScript
9
star
56

java-standard

Codecov coverage standard for Java
Python
9
star
57

standards

List of Codecov language standards
C++
8
star
58

example-groovy

Groovy coverage example
Groovy
7
star
59

example-lua

Shell
7
star
60

vscode

A Codecov vscode extention which helps validate and configure new repositories.
Python
7
star
61

cpp-11-standard

Codecov coverage standard for c++ 11
C++
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

nginx

Dockerfile
4
star
71

test-results-action

TypeScript
4
star
72

codecov-javascript-bundler-plugins

Set of bundler plugins that allow users to upload bundle stats to Codecov.
TypeScript
4
star
73

media

Press and marketing resources
3
star
74

example-xtend

Xtend coverage example
Xtend
3
star
75

example-scala-maven

Scala via Maven coverage example
Scala
3
star
76

codecov-ats

GitHub Action that uploads returns selected test labels to CI ☂️
Shell
3
star
77

ruby-standard-2

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

example-haskell

3
star
79

example-delphi

2
star
80

ruby-standard-1

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

example-csharp-sharpcover

C#
2
star
82

example-azure-pipelines

Azure Pipelines coverage example
Python
2
star
83

example-kotlin-flat

Kotlin codecov example with standard file structure
Kotlin
2
star
84

opentelem-python

Open Telemetry Python Prototype
Python
2
star
85

enterprise-rhe

Shell
2
star
86

codecov-slack-app

Python
2
star
87

codecov-bitrise

Shell
1
star
88

node-static-alpine

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

example-java-ant

1
star
90

impact-analysis-example-laravel

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

example-gradle-multiproject

Java
1
star
92

xcode-poc

Swift
1
star
93

ci-repo

debug and ci only
Python
1
star
94

prometheus

Shell
1
star
95

example-javascript

JavaScript
1
star
96

.github

Community Health Files for the Codecov Organization
1
star
97

engineering-team

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

grafana

Dockerfile
1
star
99

node-alpine-static

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

codecov-interview-api

Python
1
star