Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

GitHub Action that uploads coverage to Codecov ☂️

License

NotificationsYou must be signed in to change notification settings

codecov/codecov-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

GitHub MarketplaceFOSSA StatusWorkflow for Codecov Action

Easily upload coverage reports to Codecov from GitHub Actions

v5 Release

v5 of the Codecov GitHub Action will use theCodecov Wrapper to encapsulate theCLI. This will help ensure that the Action gets updates quicker.

Migration Guide

Thev5 release also coincides with the opt-out feature for tokens for public repositories. In theGlobal Upload Token section of the settings page of an organization in codecov.io, you can set the ability for Codecov to receive a coverage reports from any source. This will allow contributors or other members of a repository to upload without needing access to the Codecov token. For more details seehow to upload without a token.

Warning

The following arguments have been changed

  • file (this has been deprecated in favor offiles)
  • plugin (this has been deprecated in favor ofplugins)

The following arguments have been added:

  • binary
  • gcov_args
  • gcov_executable
  • gcov_ignore
  • gcov_include
  • report_type
  • skip_validation
  • swift_project

You can see their usage in theaction.ymlfile.

v4 Release

v4 of the Codecov GitHub Action will use theCodecov CLI to upload coverage reports to Codecov.

Breaking Changes

  • Tokenless uploading is unsupported. However, PRs made from forks to the upstream public repos will support tokenless (e.g. contributors to OSS projects do not need the upstream repo's Codecov token). For details,see our docs
  • Various arguments to the Action have been removed

Dependabot

  • For repositories usingDependabot, users will need to ensure that it has access to the Codecov token for PRs from Dependabot to upload coverage. To do this, please add yourCODECOV_TOKEN as a Dependabot Secret. For more information, see"Configuring access to private registries for Dependabot."

v3 versions and below will not have access to CLI features (e.g. global upload token, ATS).

Usage

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

This Action also requires you toprovide an upload token fromcodecov.io (tip: in order to avoid exposing your token,store it as asecret).

Currently, the Action will identify linux, macos, and windows runners. However, the Action may misidentify other architectures. The OS can be specified as

  • alpine
  • alpine-arm64
  • linux
  • linux-arm64
  • macos
  • windows

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

steps:-uses:actions/checkout@main-uses:codecov/codecov-action@v4with:fail_ci_if_error:true# optional (default = false)files:./coverage1.xml,./coverage2.xml# optionalflags:unittests# optionalname:codecov-umbrella# optionaltoken:${{ secrets.CODECOV_TOKEN }}# requiredverbose:true# optional (default = false)

The Codecov token can also be passed in via environment variables:

steps:-uses:actions/checkout@main-uses:codecov/codecov-action@v4with:fail_ci_if_error:true# optional (default = false)files:./coverage1.xml,./coverage2.xml# optionalflags:unittests# optionalname:codecov-umbrella# optionalverbose:true# optional (default = false)env:CODECOV_TOKEN:${{ secrets.CODECOV_TOKEN }}

Note

This assumes that you've set your Codecov token insideSettings > Secrets asCODECOV_TOKEN. If not, you canget an upload token for your specific repo oncodecov.io. Keep in mind that secrets arenot available to forks of repositories.

Using OIDC

For users withOpenID Connect(OIDC) enabled, the Codecov token is not necessary. You can use OIDC with theuse_oidc argument as following.

-uses:codecov/codecov-action@v4with:use_oidc:true

Any token supplied will be ignored, as Codecov will default to the OIDC token for verification.

Arguments

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

InputDescriptionRequired
tokenRepository Codecov token. Used to authorize report uploads*Required
codecov_yml_pathSpecify the path to the Codecov YMLOptional
commit_parentOverride to specify the parent commit SHAOptional
directoryDirectory to search for coverage reports.Optional
disable_searchDisable search for coverage files. This is helpful when specifying what files you want to upload with the --file option.Optional
disable_file_fixesDisable file fixes to ignore common lines from coverage (e.g. blank lines or empty brackets)Optional
dry_runDon't upload files to CodecovOptional
env_varsEnvironment variables to tag the upload with (e.g. PYTHON | OS,PYTHON)Optional
excludeFolders to exclude from searchOptional
fail_ci_if_errorSpecify whether or not CI build should fail if Codecov runs into an error during uploadOptional
filePath to coverage file to uploadOptional
filesComma-separated list of files to uploadOptional
flagsFlag upload to group coverage metrics (e.g. unittests | integration | ui,chrome)Optional
handle_no_reports_foundRaise no exceptions when no coverage reports foundOptional
job_codeThe job codeOptional
nameUser defined upload name. Visible in Codecov UIOptional
osOverride the assumed OS. Options are linux | macos | windows | .Optional
override_branchSpecify the branch nameOptional
override_buildSpecify the build numberOptional
override_build_urlThe URL of the build where this is runningOptional
override_commitSpecify the commit SHAOptional
override_prSpecify the pull request numberOptional
pluginplugins to run. Options: xcode, gcov, pycoverage. The default behavior runs them all.Optional
pluginsComma-separated list of plugins for use during upload.Optional
report_codeThe code of the report. If unsure, do not includeOptional
root_dirUsed to specify the location of your .git root to identify project root directoryOptional
slugSpecify the slug manually (Enterprise use)Optional
urlSpecify the base url to upload (Enterprise use)Optional
use_legacy_upload_endpointUse the legacy upload endpointOptional
use_oidcUse OpenID Connect for verification instead of token. This will ignore any token supplied. Please seeGitHub documentation for details.
verboseSpecify whether the Codecov output should be verboseOptional
versionSpecify which version of the Codecov CLI should be used. Defaults tolatestOptional
working-directoryDirectory in which to execute codecov.shOptional

Exampleworkflow.yml with Codecov Action

name:Example workflow for Codecovon:[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@main    -name:Setup Pythonuses:actions/setup-python@mainwith:python-version:3.10    -name:Generate coverage reportrun:|        pip install pytest        pip install pytest-cov        pytest --cov=./ --cov-report=xml    -name:Upload coverage to Codecovuses:codecov/codecov-action@v4with:directory:./coverage/reports/env_vars:OS,PYTHONfail_ci_if_error:truefiles:./coverage1.xml,./coverage2.xml,!./cacheflags:unittestsname:codecov-umbrellatoken:${{ secrets.CODECOV_TOKEN }}verbose:true

Contributing

Contributions are welcome! Check out theContribution Guide.

License

The code in this project is released under theMIT License.

FOSSA Status


[8]ページ先頭

©2009-2025 Movatter.jp