Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting threshold #554

Closed
serialbandicoot opened this issue Oct 11, 2021 · 14 comments
Closed

Setting threshold #554

serialbandicoot opened this issue Oct 11, 2021 · 14 comments

Comments

@serialbandicoot
Copy link

I'm trying to set threshold, I've added as below, however it doesn't seem to make any difference. Can you please point me in the direction of the docs.

with:
     token: ${{ secrets.CODECOV_TOKEN }}
     files: coverage.xml
     env_vars: OS,PYTHON
     fail_ci_if_error: true
     threshold: 2%
@serialbandicoot
Copy link
Author

I'm getting a warning with the following list of acceptable values. So can I assume this is not the way to approach Threshold and guess I must provide another mechanism. Any pointers would be super-helpful!

run (ubuntu-latest)Unexpected input(s)
 'threshold', valid inputs are ['token', 'files', 'directory', 'flags', 'commit_parent', 'dry_run', 'env_vars', 'fail_ci_if_error', 'file', 'functionalities', 'move_coverage_to_trash', 'name', 'override_branch', 'override_build', 'override_commit', 'override_pr', 'override_tag', 'os', 'root_dir', 'slug', 'url', 'verbose', 'version', 'working-directory']

--

@abhinavsingh
Copy link

We have codecov.yml file in repo root, but looks like it is being ignored completely for threshold. CI fails even with 0.01% of coverage diff. I am unsure if this is a side-effect of parallel tests on matrix of OS/Python versions.

Our config file -- https://github.com/abhinavsingh/proxy.py/blob/develop/codecov.yml
Example CI failure which seems to ignore the threshold settings in the config -- abhinavsingh/proxy.py#897

This seemed to work fine with v1 afaik

@yaboi
Copy link

yaboi commented Jan 14, 2022

Having this same issue... config seems to be ignored but can't add to action...

@kettanaito
Copy link

The threshold option is not supported by the action—it will do nothing:

inputs:
token:
description: 'Repository upload token - get it from codecov.io. Required only for private repositories'
required: false
files:
description: 'Comma-separated list of files to upload'
required: false
directory:
description: 'Directory to search for coverage reports.'
required: false
flags:
description: 'Flag upload to group coverage metrics (e.g. unittests | integration | ui,chrome)'
required: false
commit_parent:
description: '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 providers API, the parent is determined via finding the closest ancestor to the commit.'
required: false
dry_run:
description: "Don't upload files to Codecov"
required: false
env_vars:
description: 'Environment variables to tag the upload with (e.g. PYTHON | OS,PYTHON)'
required: false
fail_ci_if_error:
description: 'Specify whether or not CI build should fail if Codecov runs into an error during upload'
required: false
file:
description: 'Path to coverage file to upload'
required: false
functionalities:
description: 'Comma-separated list, see the README for options and their usage'
required: false
gcov:
description: 'Run with gcov support'
required: false
gcov_args:
description: 'Extra arguments to pass to gcov'
required: false
gcov_ignore:
description: 'Paths to ignore during gcov gathering'
required: false
gcov_include:
description: 'Paths to include during gcov gathering'
required: false
move_coverage_to_trash:
description: 'Move discovered coverage reports to the trash'
required: false
name:
description: 'User defined upload name. Visible in Codecov UI'
required: false
override_branch:
description: 'Specify the branch name'
required: false
override_build:
description: 'Specify the build number'
required: false
override_commit:
description: 'Specify the commit SHA'
required: false
override_pr:
description: 'Specify the pull request number'
required: false
override_tag:
description: 'Specify the git tag'
required: false
os:
description: 'Override the assumed OS. Options are alpine | linux | macos | windows.'
required: false
root_dir:
description: 'Used when not in git/hg project to identify project root directory'
required: false
slug:
description: 'Specify the slug manually (Enterprise use)'
required: false
url:
description: 'Change the upload host (Enterprise use)'
required: false
verbose:
description: 'Specify whether the Codecov output should be verbose'
required: false
version:
description: 'Specify which version of the Codecov Uploader should be used. Defaults to `latest`'
required: false
working-directory:
description: 'Directory in which to execute codecov.sh'
required: false
branding:
color: 'red'
icon: 'umbrella'

I don't see the way to point to the codecov.yml file either.

Can this action determine the root-level codecov.yml configuration file? Can we mention this in the README?

@mataide
Copy link

mataide commented Aug 4, 2022

There no threshold?

@trajan0x
Copy link

Is there anyway to point to thecodecov.yml file?

@arkodg
Copy link

arkodg commented Sep 27, 2022

@thomasrockhu-codecov @mitchell-codecov can you please advise us on how to proceed with this issue ?

@thomasrockhu-codecov
Copy link
Contributor

thomasrockhu-codecov commented Sep 28, 2022

Hi all,

The codecov.yml file holds configuration pieces like threshold. At the repository level, it can be named

  • codecov.yml (preferred)
  • codecov.yaml
  • .codecov.yml
  • .codecov.yaml

and must be directly in one of these directories

  • / (root)
  • 'dev/`
  • .github/

@arkodg
Copy link

arkodg commented Sep 28, 2022

great thanks for the pointer @thomasrockhu-codecov, this should unblock us. If you gave us some hints on how to enhance the GHA, one of us from the community could help out !

@noxan
Copy link

noxan commented Nov 28, 2022

After setting threshold the wrong way top level, I saw in the docs, that it is a value nested quite deep into the configuration file (as already explained perfectly prior):

coverage:
  status:
    project:
      default:
        threshold: 1%

Or see the pull request we used in our project.

@ethanhanjiahao
Copy link

ethanhanjiahao commented Dec 10, 2022

Hi all,

The codecov.yml file holds configuration pieces like threshold. At the repository level, it can be named

  • codecov.yml (preferred)
  • codecov.yaml
  • .codecov.yml
  • .codecov.yaml

and must be directly in one of these directories

  • / (root)
  • 'dev/`
  • .github/

After setting threshold in .github/codecov.yml,

coverage:
  status:
    project:
      default:
        # basic
        target: 60%
        threshold: 5%
        if_ci_failed: error

The same configuration in my repository, it works.
image

but in remote repository, it not work, CI success. Can you give me some advises or information?

@thomasrockhu-codecov
Copy link
Contributor

@ethanhanjiahao does your remote repo also have the Codecov yaml file?

@arkodg
Copy link

arkodg commented Dec 19, 2022

hi @thomasrockhu-codecov, answering on behalf of @ethanhanjiahao, it does, and its here, yet we saw in this PR that a drop in the coverage below threshold didn't fail the CI

@thomasrockhu-codecov
Copy link
Contributor

@arkodg please add the Codecov GitHub app to the repo. I suspect that's why it isn't getting picked up properly.

If you are still having an issue, please open an issue on our community boards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants