Git Product home page Git Product logo

codecov-action's Introduction

Codecov GitHub Action

GitHub Marketplace FOSSA Status Workflow for Codecov Action

Easily upload coverage reports to Codecov from GitHub Actions

v4 Release

v4 of the Codecov GitHub Action will use the Codecov 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 OS 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 using Dependabot, 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 your CODECOV_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 a step within your workflow.yml file.

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).

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@v4
  with:
    fail_ci_if_error: true # optional (default = false)
    files: ./coverage1.xml,./coverage2.xml # optional
    flags: unittests # optional
    name: codecov-umbrella # optional
    token: ${{ secrets.CODECOV_TOKEN }} # required
    verbose: true # optional (default = false)

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

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

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.

Using OIDC

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

- uses: codecov/codecov-action@v4
  with:
    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:

Input Description Required
token Repository Codecov token. Used to authorize report uploads *Required
codecov_yml_path Specify the path to the Codecov YML Optional
commit_parent Override to specify the parent commit SHA Optional
directory Directory to search for coverage reports. Optional
disable_search Disable search for coverage files. This is helpful when specifying what files you want to upload with the --file option. Optional
disable_file_fixes Disable file fixes to ignore common lines from coverage (e.g. blank lines or empty brackets) Optional
dry_run Don't upload files to Codecov Optional
env_vars Environment variables to tag the upload with (e.g. PYTHON | OS,PYTHON) Optional
exclude Folders to exclude from search Optional
fail_ci_if_error Specify whether or not CI build should fail if Codecov runs into an error during upload Optional
file Path to coverage file to upload Optional
files Comma-separated list of files to upload Optional
flags Flag upload to group coverage metrics (e.g. unittests | integration | ui,chrome) Optional
handle_no_reports_found Raise no exceptions when no coverage reports found Optional
job_code The job code Optional
name User defined upload name. Visible in Codecov UI Optional
os Override the assumed OS. Options are linux | macos | windows | . Optional
override_branch Specify the branch name Optional
override_build Specify the build number Optional
override_build_url The URL of the build where this is running Optional
override_commit Specify the commit SHA Optional
override_pr Specify the pull request number Optional
plugin plugins to run. Options: xcode, gcov, pycoverage. The default behavior runs them all. Optional
plugins Comma-separated list of plugins for use during upload. Optional
report_code The code of the report. If unsure, do not include Optional
root_dir Used to specify the location of your .git root to identify project root directory Optional
slug Specify the slug manually (Enterprise use) Optional
url Specify the base url to upload (Enterprise use) Optional
use_legacy_upload_endpoint Use the legacy upload endpoint Optional
use_oidc Use OpenID Connect for verification instead of token. This will ignore any token supplied. Please see GitHub documentation for details.
verbose Specify whether the Codecov output should be verbose Optional
version Specify which version of the Codecov CLI should be used. Defaults to latest Optional
working-directory Directory in which to execute codecov.sh 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@main
    - name: Setup Python
      uses: actions/setup-python@main
      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@v4
      with:
        directory: ./coverage/reports/
        env_vars: OS,PYTHON
        fail_ci_if_error: true
        files: ./coverage1.xml,./coverage2.xml,!./cache
        flags: unittests
        name: codecov-umbrella
        token: ${{ secrets.CODECOV_TOKEN }}
        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

codecov-action's People

Contributors

alex avatar armano2 avatar dana-yaish avatar dependabot-preview[bot] avatar dependabot[bot] avatar drazisil avatar drazisil-codecov avatar fossabot avatar ibrahim0814 avatar ichizok avatar jsoref avatar khaeru avatar kleisauke avatar marcobiedermann avatar mheob avatar mitchell-codecov avatar mkroening avatar mmorel-35 avatar moshe-azaria-sage avatar mylifeasdog avatar ra80533 avatar reenignearcher avatar robbiemckinstry avatar rohan-at-sentry avatar samuelcolvin avatar slarse avatar stefanomunarini avatar teohhanhui avatar thomasrockhu avatar thomasrockhu-codecov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

codecov-action's Issues

unable to upload coverage report

Hi, I am unable to upload the coverage report into codecov. Below is the image. Could it be possible that github block internet access?

Screenshot 2019-12-09 at 10 13 42 AM

Build and tag Docker image

Tried running this action earlier, but using

steps:
- uses: actions/checkout@master
- uses: codecov/[email protected]
  with:
    token: ${{secrets.CODECOV_TOKEN}} #required
    file: ./coverage.xml #optional
    flags: unittests #optional
    name: codecov-umbrella #optional

it takes ages to build the Docker image.

What do you think about building and tagging an image, and then pushing it to Dockerhub?

This will significantly speed up actions!

Need help: how to set parameter "file" for multiple reports

In my case, there are two coverage reports(UI_coverage.xml and Back_end_coverage.xml)ใ€‚

The Doc. says:
image

I think it means that multiple reports are supported,
so I set "file" parameter like this:
image
And it could not work, what should I do?
image

Thanks

Add documentation on matrix build, only upload coverage once

When testing in a matrix, uploads often fail after the first one. I'm testing against different versions of Python, and I only need to upload the coverage information once, by including

if: matrix.python-version == 3.8

in the codecov job. It took me a while to figure this out, so maybe it is nice to include this in the readme.

find: 'gcov': No such file or directory

I tried to use this action on my C project and I got this:

https://github.com/isbadawi/badavi/commit/f14ae4f61dbed2b28c7a4c05168e3da3b26abc5e/checks?check_suite_id=315103590

==> GitHub Actions detected.
    project root: .
    Yaml found at: .codecov.yml
==> Running gcov in . (disable via -X gcov)
find: 'gcov': No such file or directory
find: 'gcov': No such file or directory
find: 'gcov': No such file or directory
==> Python coveragepy not found
==> Searching for coverage reports in:
    + .
--> No coverage report found.
    Please visit http://docs.codecov.io/docs/supported-languages
Codecov upload failed

It looks like gcov is not installed in the image. I worked around it by manually invoking the bash uploader -- I guess the GitHub-hosted environment has gcov.

Successful invocation: https://github.com/isbadawi/badavi/commit/ce9f937214ff55696a572dfff209af70c28cd533/checks?check_suite_id=315119018

codecov unable to find coverage on PATH because env is not inherited

I'm currently facing an issue where codecov cannot find the Python coverage program on the PATH, and therefore does not process the coverage. I believe this is because of how index.js here manages the environ.

Specifically, it fully overrides it:

codecov-action/index.js

Lines 52 to 59 in a3a6bec

options.env = {
GITHUB_ACTION: process.env.GITHUB_ACTION,
GITHUB_RUN_ID: process.env.GITHUB_RUN_ID,
GITHUB_REF: process.env.GITHUB_REF,
GITHUB_REPOSITORY: process.env.GITHUB_REPOSITORY,
GITHUB_SHA: process.env.GITHUB_SHA,
GITHUB_HEAD_REF: process.env.GITHUB_HEAD_REF || ''
};

Based on reading the exec package's source, it's clear that this is the entire env provided, it is not merged with process.env.

I think the best way to handle this would be to merge these vars with process.env. At the very least, PATH needs to be inherited so tools can be found, otherwise you simply get the system default PATH.

CodeCov upload takes too long

In our C# repo we have ~2.5K LoC recognized and tracked by CodeCov.
For some reason it takes 21 minutes to process and upload coverage reports which is eating up our GH Actions runtime quota fast and disrupting CI workflow a bit.

Is it possible enable verbose logging and/or profiling so we can see what's going on and possibly do something about it?

2020-03-19T21:55:01.8693381Z ##[group]Run codecov/codecov-action@master
2020-03-19T21:55:01.8693640Z with:
2020-03-19T21:55:01.8702733Z   token: ***
2020-03-19T21:55:01.8702940Z   file: ./Build/TestReports/CodeCoverage.xml
2020-03-19T21:55:01.8703086Z   flags: unittests
2020-03-19T21:55:01.8703223Z   name: GitHub CI
2020-03-19T21:55:01.8703357Z   fail_ci_if_error: true
2020-03-19T21:55:01.8703503Z env:
2020-03-19T21:55:01.8703651Z   NUGET: C:\hostedtoolcache\windows\nuget.exe\5.4.0\x64/nuget.exe
2020-03-19T21:55:01.8703801Z ##[endgroup]
2020-03-19T21:55:02.3235015Z [command]bash codecov.sh -f ./Build/TestReports/CodeCoverage.xml -n "GitHub CI" -F unittests -Z
2020-03-19T21:55:02.7895459Z 
2020-03-19T21:55:02.7895986Z   _____          _
2020-03-19T21:55:02.7896309Z  / ____|        | |
2020-03-19T21:55:02.7896558Z | |     ___   __| | ___  ___ _____   __
2020-03-19T21:55:02.7896799Z | |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
2020-03-19T21:55:02.7897035Z | |___| (_) | (_| |  __/ (_| (_) \ V /
2020-03-19T21:55:02.7897407Z  \_____\___/ \__,_|\___|\___\___/ \_/
2020-03-19T21:55:02.7897653Z                               Bash-tbd
2020-03-19T21:55:02.7897849Z 
2020-03-19T21:55:02.7897999Z 
2020-03-19T21:55:02.7905967Z ๏ฟฝ[0;90m==>๏ฟฝ[0m GitHub Actions detected.
2020-03-19T21:55:03.0896193Z     ๏ฟฝ[0;90mproject root:๏ฟฝ[0m D:/a/REDACTED
2020-03-19T21:55:03.0896831Z ๏ฟฝ[0;90m-->๏ฟฝ[0m token set from env
2020-03-19T21:55:03.2889476Z     ๏ฟฝ[0;32mYaml not found, that's ok! Learn more at๏ฟฝ[0m ๏ฟฝ[0;36mhttp://docs.codecov.io/docs/codecov-yaml๏ฟฝ[0m
2020-03-19T21:55:03.5740792Z     ๏ฟฝ[0;90m->๏ฟฝ[0m Found 1 reports
2020-03-19T21:55:03.5741536Z ๏ฟฝ[0;90m==>๏ฟฝ[0m Detecting git/mercurial file structure
2020-03-19T21:55:03.7606349Z ๏ฟฝ[0;90m==>๏ฟฝ[0m Reading reports
2020-03-19T21:55:03.8565040Z     ๏ฟฝ[0;32m+๏ฟฝ[0m ./Build/TestReports/CodeCoverage.xml ๏ฟฝ[0;90mbytes=1661234๏ฟฝ[0m
2020-03-19T21:55:03.9346856Z ๏ฟฝ[0;90m==>๏ฟฝ[0m Appending adjustments
2020-03-19T21:55:03.9347537Z     ๏ฟฝ[0;36mhttp://docs.codecov.io/docs/fixing-reports๏ฟฝ[0m
2020-03-19T22:16:04.3784923Z     ๏ฟฝ[0;32m+๏ฟฝ[0m Found adjustments
2020-03-19T22:16:04.7537514Z ๏ฟฝ[0;90m==>๏ฟฝ[0m Gzipping contents
2020-03-19T22:16:06.6778997Z ๏ฟฝ[0;90m==>๏ฟฝ[0m Uploading reports
2020-03-19T22:16:06.6780116Z     ๏ฟฝ[0;90murl:๏ฟฝ[0m https://codecov.io
2020-03-19T22:16:06.6780558Z     ๏ฟฝ[0;90mquery:๏ฟฝ[0m branch=master&commit=REDACTED
2020-03-19T22:16:07.2128700Z     ๏ฟฝ[0;90m->๏ฟฝ[0m Pinging Codecov
2020-03-19T22:16:07.2129847Z https://codecov.io/upload/v4?package=bash-tbd&token=REDACTED
2020-03-19T22:16:08.5617894Z     ๏ฟฝ[0;90m->๏ฟฝ[0m Uploading
2020-03-19T22:16:09.4656495Z     ๏ฟฝ[0;32m->๏ฟฝ[0m View reports at ๏ฟฝ[0;36mhttps://codecov.io/github/REDACTED๏ฟฝ[0m
2020-03-19T22:16:09.4853853Z Cleaning up orphan processes

400 error on uploading to Codecov

I've experienced a few errors with the following message:

Pinging Codecov
https://codecov.io/upload/v4?package=bash-20200214-585fef0&token=secret&branch=refs%2Fpull%2F105%2Fmerge&commit=65f5df278779f85ec4951d271f741ea963000f26&build=&build_url=http%3A%2F%2Fgithub.com%2Fopendatacube%2Fdatacube-explorer%2Factions%2Fruns%2F&name=&tag=&slug=opendatacube%2Fdatacube-explorer&service=github-actions&flags=&pr=&job=
HTTP 400
Please provide the repository token to upload reports via `-t :repository-token`

I'm configuring the action like this:

    - name: Upload coverage to Codecov
      uses: codecov/codecov-action@v1
      with:
        token: ${{ secrets.CodeCovToken }}
        file: ./coverage.xml
        fail_ci_if_error: false

And it works most of the time, as in, almost always. Just fails occassionally.

doc: how to use multiple flags

The README/doc should have an example how to use multiple flags.
(I've guessed them to be a string separated by "," (commata), as with the codecov-bash uploader itself, but it would be good to clarify)

400: pr must match pattern

I got the following error when re-running a GH Actions workflow.

https://codecov.io/upload/v4?package=bash-20200303-bc4d7e6&token=secret&branch=tokenless_coverage_uploads&commit=46572a64ab028b892260fcb39096dcd766043e4a&build=52168147&build_url=http%3A%2F%2Fgithub.com%2Faiidateam%2Faiida-core%2Factions%2Fruns%2F52168147&name=aiida-pytests-py3.5-django&tag=&slug=aiidateam%2Faiida-core&service=github-actions&flags=django&pr=refs/heads/tokenless_coverage_uploads&job=
    -> Uploading
    X> Failed to upload
    -> Sleeping for 30s and trying again...
    -> Uploading to Codecov
    HTTP 400
pr must match pattern ^(\d+|false|null|undefined|true)$

It seems it doesn't catch the PR's number, but instead the reference head.

Using v1 with the following setup in my workflow:

    - name: Upload coverage report
      uses: codecov/codecov-action@v1
      with:
        name: aiida-pytests-py3.5-${{ matrix.backend }}
        flags: ${{ matrix.backend }}
        file: ./coverage.xml
        fail_ci_if_error: true

Looking through the issues and PRs here, it seems related to the usage of actions/checkout@v2 (based on the discussion #53 and #52).

From your most recent README, it's clear actions/checkout@master is recommended, but the fact that v2 does not work is not clear.

In addition, the CI job did not fail, even though the error above was thrown (and fail_ci_if_error: true was set).

adding environment variables

similar to how codecov-bash allows you to do

bash <(curl -s https://codecov.io/bash) -e FOO,BAR,SPAM

Could either be:

env_variables: [FOO, BAR, SPAM]

or a string using github actions substitutions:

variables: ${{ format('FOO=xxx,BAR={0},SPAM={1}', matrix.bar, matrix.spam) }}

Until this is implemented, is there any work around this? I really need to add env variables to uploads.

Add flags

Add configuration where flags can be submitted by the user

Can't use codecov action with swift project

I can't run codecov report for swift project. The tests are passed in my Xcode 11.3

Here is my GitHub Action workflow:

name: Swift

on: [push]

jobs:
  build:

    runs-on: macOS-latest

    steps:
    - uses: actions/checkout@v1
    - name: Build app
      run: swift build -v
    - name: Run tests
      run: swift test -v
    - uses: codecov/codecov-action@v1
      with:
        token: ${{ secrets.CODECOV_TOKEN }}
        fail_ci_if_error: true

It seems like codecov action try to start python tests here is a log screenshot:

image

Use codecov action with a C++ project

I'm interested in porting a project that uses coveralls to codecov and therefor I'd like to use this action.
However, I'm struggling with the workflow file because I don't understand how to generate a proper report to send remotely.
Is there any example or have you any hint in this sense?

Thank you.

Ruby integration example

So I trying to replace old codecov integration in my projects (which worked fine) with Github Actions integration

My ruby.yml file looks like this:

name: Ruby
on: [push]
jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        ruby: [2.4, 2.5, 2.6, 2.7, head]
    steps:
    - uses: actions/checkout@v2
    - name: Set up Ruby ${{ matrix.ruby }}
      uses: ruby/setup-ruby@v1
      with:
        ruby-version: ${{ matrix.ruby }}
    - name: Build and test with Rake
      run: |
        gem install bundler
        bundle config set without 'development'
        bundle install --jobs 4 --retry 3
        bundle exec rake
    - name: Send test coverage report to codecov.io
      uses: codecov/codecov-action@v1
      with:
        file: ./coverage/.resultset.json

There is no error in logs:
image

But after a go to codecov here:
https://codecov.io/gh/ShockwaveNN/pocket-sinatra-interface/commits
All I see this error:
image

Can you point out that I'm doing wrong?

__init__.py files are ignored

When I use this action, init.py files are ignored but all the code is here so coverage become 100%.
I use codecov manually without this action everything works fine.

Don't rebuild container on each run

Currently the container is rebuilt each time the action is run which takes about 90 seconds. I think this is a limitation of GitHub Actions but maybe you could upload a built container to Docker Hub or GitHub Package Repository and point at that instead?

undefined: command not found

Hi, in build https://github.com/felangel/bloc/actions/runs/36031254, job https://github.com/felangel/bloc/runs/432647943?check_suite_focus=true we are facing codecov.sh: line 1: undefined: command not found. (might be relevant to #48)

image

and Actions tells this

image

It has been randomly appearing across the action runs. From the log, this is an error from your action.

Note that this specific coverage file does not exist, but that should not throw this error I believe. Other jobs where the file also doesn't exist does this (correctly):

image

"codecov.sh: line 1: undefined: command not found" on windows-latest

I have something like this in the configuration, but secrets.CODECOV_TOKEN is not configured yet:

jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os:
          - macos-latest
          - windows-latest
          - ubuntu-latest

    steps:
      # [test prep, test, etc., steps here]

      - name: Upload coverage report
        uses: codecov/codecov-action@v1
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          file: coverage.xml

Both on macos-latest and ubuntu-latest, I get an HTTP 400 error, which is fine. But on windows-latest, I get this:

Run codecov/codecov-action@v1
  with:
    file: coverage.xml
  env:
    pythonLocation: C:\hostedtoolcache\windows\Python\2.7.17\x64
##[warning]Codecov warning: connect ETIMEDOUT 35.199.43.247:443
bash codecov.sh -f coverage.xml -n "" -F "" -y ""
codecov.sh: line 1: undefined: command not found
##[warning]Codecov warning: The process 'bash' failed with exit code 127

More here.

Token-free upload for public repositories

Are there plans to support commit-status-based uploads like on other CI providers?
Besides UX improvements, the recommended way of storing token as a secret doesn't seem to work on pull requests originating from forks, because secrets aren't available there.

Is there a way to make this work with a PR from a fork

I have the codecov action working for PRs that I create in my repo, but it doesn't work for external contributors. I appears that secrets.CODECOV_TOKEN isn't getting set for external PRs. Is there anyway to get codecov working with PRs from forks?

Passing secrets.CODECOV_TOKEN not recognized

Having set up the secret CODECOV_TOKEN and passing it as ${{ secrets.CODECOV_TOKEN }} the upload fails with the message:

HTTP 400
Please provide the repository token to upload reports via `-t :repository-token`

This is both for v1 and v1.0.5 of codecov-action.

It seems that the action's environment variable CODECOV_TOKEN is not set properly or not recognized?

It should be mentioned that this has recently started failing, without changing the actions workflow otherwise, i.e., it used to work, but now throws this error.

Add support for optional directory

We are using codecov in a build which uses multiple source repositories (which we clone in addition to the default one) for which we upload codecov results for each repository. For this an optional 'directory' flag would be helpful, the action should do a cd to the specified directory before running the codecov.sh bash script

Fixing timeouts

We're seeing timeouts when running out test suite.

How can we prevent that? Is there maybe rate limiting going on?

Screen Shot 2019-11-29 at 12 33 54 PM

Screen Shot 2019-11-29 at 12 34 22 PM

Build does not fail with token and invalid input

With a given token and an invalid input, the build does not fail and completely disregards the bad input

with:
  token: xxxx
  badinput: badstuff

The above configuration passes as long as the token is correct

Support for windows

Given that github can run windows (and macOs) builds on top of linux, it will be nice if the official codecov action can run on all three.

I see that there is codecov-exe , so I suppose this is being worked on ?

Incorrect installation docs

This is how the format for actions is:

userOrOrganization/repository@branchOrTag

You mistakenly wrote the organization as actions, instead of codecov in the readme usage section.

actions/checkout@master

This will cause builds to fail with a 404 installation error.

The `yml` optional input doesn't seem to be working

If I add the codecov.yml file to my project root, everything is working fine:

However, adding the file to ./.github/codecov.yml and properly configuring my workflow yml file doesn't seem to be working:

Although the action is saying it found the file, it doesn't seem to be used if you look at codecov.io it will say "No yaml found." and my settings are not being read.

Am I doing something wrong?

Github actions output of coverage url

Hello,

I am generating a code coverage with your action and the action produces a link in where I can check coverage result lastly. Along with Github Actions we are able to get outputs such as links. For instance, build scan generates a link that includes build result and I can get output link as follows.

steps.<steps_id>.outputs.build-scan-url

Do you support such method to provide a link of coverage result like

steps.<steps_id>.outputs.codecov-url

It would be great for me to share a link with my team.

Thanks,

Permit dashes in input flags

Currently if I try to use flags that have a dash this action will fail to upload after several retries. On the last one it will display this message:

flags must match pattern ^[\w\,]+$

This issue is basically a request to permit dashes (and maybe other characters too?) in the flags attached to the uploaded report. This will allow users to employ as a flag:

flags: ${{ matrix.os }}

which currently resolves to names like ubuntu-latest or windows-latest.

All coverage uploads are made towards master

Uploading reports using this action results in the branch query parameter being empty and so CodeCov assumes that the commit belongs to master (even though it can't find it in the dashboard)

This is causing my badge to show incorrect values because now it's getting affected by coverage reports that are uploaded from other branches.

For now, I've stopped using the action and I'm instead using the bash uploader directly.

- name: Upload coverage
      if: success()
      run: bash <(curl -s https://codecov.io/bash) -t $TOKEN -B $REF
      env:
        TOKEN: "${{ secrets.CODECOV_TOKEN }}"
        REF: "${{ github.ref }}"

Conflicting error messages

I'm using the action to generate a codecov report for PRs here.

However, I'm getting the following error:

Yaml found at: ./codecov.yml
sed: can't read ././codecov.yml: No such file or directory
    -> Found 1 reports
==> Detecting git/mercurial file structure
==> Reading reports
    - file not found at ros2_ws/lcov/total_coverage.info
--> No coverage data found.
  1. Why is codecov saying that it found the file and then sed can't read it?
  2. Why does codecov say it found the file and then report that there is no coverage (when the coverage was in fact generated?

Thanks

Bash script unable to find the codecov.sh file

I am getting some warnings when running the bash script. For details see this run (https://github.com/mobxjs/mobx.dart/commit/e23826ec853fdd0e2d85766683fd35c015b704df/checks?check_suite_id=411164231).

image

Logs:

2020-01-21T02:41:53.8844708Z Collecting coverage information...                                   9ms
2020-01-21T02:41:53.9724611Z ##[group]Run codecov/codecov-action@v1
2020-01-21T02:41:53.9724813Z with:
2020-01-21T02:41:53.9725566Z   token: ***
2020-01-21T02:41:53.9725663Z   flags: flutter_mobx
2020-01-21T02:41:53.9725764Z   file: ./flutter_mobx/coverage/lcov.info
2020-01-21T02:41:53.9725872Z env:
2020-01-21T02:41:53.9725976Z   FLUTTER_CMD: /home/cirrus/sdks/flutter/bin/flutter
2020-01-21T02:41:53.9726084Z ##[endgroup]
2020-01-21T02:41:53.9739646Z ##[command]/usr/bin/docker exec  305905f350f09395dcb969a93ac8d71ff2b6dc61d7804c5620f434d9a100882e sh -c "cat /etc/*release | grep ^ID"
2020-01-21T02:41:54.1419610Z Running JavaScript Action with default external tool: node12
2020-01-21T02:41:54.7536673Z ##[warning]Codecov warning: EACCES: permission denied, open 'codecov.sh'
2020-01-21T02:41:54.7555301Z [command]bash codecov.sh -f ./flutter_mobx/coverage/lcov.info -n  -F flutter_mobx -y 
2020-01-21T02:41:54.7610843Z bash: codecov.sh: No such file or directory
2020-01-21T02:41:54.7630281Z ##[warning]Codecov warning: The process 'bash' failed with exit code 127
2020-01-21T02:41:54.7636907Z ##[warning]Codecov warning: ENOENT: no such file or directory, unlink 'codecov.sh'
2020-01-21T02:41:54.7938034Z Stop and remove container: 6bd4f0de557b4711bc352ae56507ec96_cirrusciflutterstable_be1f99
2020-01-21T02:41:54.7974359Z ##[command]/usr/bin/docker rm --force 305905f350f09395dcb969a93ac8d71ff2b6dc61d7804c5620f434d9a100882e
2020-01-21T02:41:56.4006008Z 305905f350f09395dcb969a93ac8d71ff2b6dc61d7804c5620f434d9a100882e
2020-01-21T02:41:56.4033778Z Remove container network: github_network_9e3d22c0ef7449e39f710f9b147a5803
2020-01-21T02:41:56.4037594Z ##[command]/usr/bin/docker network rm github_network_9e3d22c0ef7449e39f710f9b147a5803
2020-01-21T02:41:56.5209386Z github_network_9e3d22c0ef7449e39f710f9b147a5803
2020-01-21T02:41:56.5238378Z Cleaning up orphan processes

Does not work when using alpine image

Container distribution is alpine. Running JavaScript Action with external tool: node12_alpine
bash codecov.sh -n phpunit-php7.4 -F phpunit -Z
##[error]Codecov failed with the following error: There was an error when attempting to execute the process 'bash'. This may indicate the process failed to start. Error: spawn bash ENOENT

https://github.com/teohhanhui/api-platform-core/runs/487602279?check_suite_focus=true#step:18:13

Actions written in JS are not really cross-platform... There's actions/toolkit#285 but it seems the problem here is simply that bash is not installed in the "external" container ("node12_alpine"), and I don't see a way to specify that bash is needed there, or to install it manually.

Incorrect handling of PR builds from GitHub Actions.

Summary from the customer:

I did a bit of looking today. It appears that pull_request events use an automatic merge commit for the pull request, and the GITHUB_SHA is showing that commit hash instead of the one for the commit on the branch that was actually pushed. It makes some sense, but it's a big odd to get your head around. I believe that Travis CI does the same thing, except that they make it easy to know what the underlying commit you're trying to test about is, but GitHub actions does not expose that in an environment variable.

In order to trace it back to the commit we're really trying to identify, we need to look at the parents of the commit we're on. I'm not sure the optimal way to do that, but the commit message of the current commit has it, and of course git itself has record of what the parent commits are as well, though I'm not totally sure the best way to figure out which of the parents is really the one we're looking for.

It seems that GitHub Actions may make a merge commit build for PRs, similar to how Travis CI does. I'm not sure if they commit this SHA, but the Codecov action does not use the correct SHA in this case.

Unexpected (?) "Please provide upload token from codecov.io with valid arguments

After a few successful uses of this action, I suddenly get the following error message:

Run codecov/[email protected]
  with:
  env:
    pythonLocation: /opt/hostedtoolcache/Python/3.7.4/x64
/usr/bin/docker run --name bb81ac7a28060c2a49beacb2ccf7bb13adce_d9298b --label 04bb81 
--workdir /github/workspace --rm -e pythonLocation -e INPUT_TOKEN -e INPUT_NAME -e 
INPUT_FILE -e INPUT_FLAGS -e HOME -e GITHUB_REF -e GITHUB_SHA -e 
GITHUB_REPOSITORY -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF 
-e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_WORKSPACE -e 
GITHUB_ACTION -e GITHUB_EVENT_PATH -e RUNNER_OS -e RUNNER_TOOL_CACHE -e 
RUNNER_TEMP -e RUNNER_WORKSPACE -v "/var/run/docker.sock":"/var/run/docker.sock" -v 
"/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp
/_github_workflow":"/github/workflow" -v "/home/runner/work/kikuchipy/kikuchipy":"/github
/workspace" 04bb81:ac7a28060c2a49beacb2ccf7bb13adce  "" "" "" ""
Please provide an upload token from codecov.io with valid arguments
##[error]Docker run failed with exit code 1

My .codecov.yml:

comment:
  layout: "diff, flags, files"

and .github/workflows/build.yml unchanged between the successful and unsuccessful action uses:

name: Build
on:
  pull_request:
    branches:
      - master
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@master
      - name: Setup Python
        uses: actions/setup-python@master
        with:
          python-version: 3.7
      - name: Install Miniconda
        run: |
          wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
          chmod +x miniconda.sh
          ./miniconda.sh -b -p $HOME/miniconda
          hash -r
      - name: Setup environment and install dependencies
        env:
          ENV_NAME: testenv
        run: |
          source $HOME/miniconda/bin/activate root
          conda config --append channels conda-forge
          conda create --name $ENV_NAME --yes
          conda activate $ENV_NAME
          conda info -a
          df -h
          conda install --yes hyperspy pyxem pytest pytest-cov
          pip install .
      - name: Run pytests and generate coverage report
        env:
          ENV_NAME: testenv
        run: |
          source $HOME/miniconda/bin/activate $ENV_NAME
          export MPLBACKEND=Agg
          pytest --cov=kikuchipy --cov-report=xml
      - name: Upload coverage report to Codecov
        uses: codecov/[email protected]
        with:
          token: ${{ secrets.CODECOV_TOKEN }}

The CODECOV_TOKEN available via codecov.io is registred in my settings.

I'm sorry if I missed anything obvious. Are anybody able to help me out? Thanks a lot in advance.

Why don't use Alpine image?

ubuntu:latest is cached in VM (ref). However, it still takes time with high IO.

Step 1/6 : FROM ubuntu:latest
latest: Pulling from library/ubuntu
5667fdb72017: Pulling fs layer
d83811f270d5: Pulling fs layer
ee671aafb583: Pulling fs layer
7fc152dfb3a6: Pulling fs layer
7fc152dfb3a6: Waiting
d83811f270d5: Verifying Checksum
d83811f270d5: Download complete
ee671aafb583: Verifying Checksum
ee671aafb583: Download complete
7fc152dfb3a6: Verifying Checksum
7fc152dfb3a6: Download complete
5667fdb72017: Verifying Checksum
5667fdb72017: Download complete
5667fdb72017: Pull complete

To shorten this, we can use Alpine.

Add file path

There's currently no way to configure an option where a user can input a filepath to the coverage report

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.