rsm-hcd / AndcultureCode.Cli

and-cli command-line tool to manage the development of software applications
https://andculture.com
Apache License 2.0
14 stars 15 forks source link

Codecov is not uploading/commenting with coverage report #191

Closed brandongregoryscott closed 3 years ago

brandongregoryscott commented 3 years ago

Looks like codecov has not been consistently uploading coverage reports since we ported over to Github Actions. Sifted through a couple of the recent PRs and I believe this is the only one that commented w/ the coverage report after the CI refactor: https://github.com/AndcultureCode/AndcultureCode.Cli/pull/167

Looks like others started reporting a similar error as of recently:

https://github.com/codecov/codecov-node/issues/284

Output from a recent build:

  _____          _  
 / ____|        | |  
| |     ___   __| | ___  ___ _____   __  
| |    / _ \ / _` |/ _ \/ __/ _ \ \ / /  
| |___| (_) | (_| |  __/ (_| (_) \ V /  
 \_____\___/ \__,_|\___|\___\___/ \_/  
                                v3.8.1
==> Detecting CI Provider
    GitHub Actions CI Detected
==> Configuration: 
    Endpoint: https://codecov.io
{ commit: '7f36e100e64f67a96c9f38098bb894a8b77c33c9',
  branch: 'feature/list-commands-2',
  package: 'node-v3.8.1' }
==> Building file structure
==> Scanning for reports
    + D:\a\AndcultureCode.Cli\AndcultureCode.Cli\coverage\lcov.info
    + D:\a\AndcultureCode.Cli\AndcultureCode.Cli\coverage\clover.xml
==> Uploading reports
(node:1700) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'startsWith' of undefined
    at Object.getAgent (C:\npm\prefix\node_modules\codecov\node_modules\teeny-request\build\src\agents.js:30:22)
    at requestToFetchOptions (C:\npm\prefix\node_modules\codecov\node_modules\teeny-request\build\src\index.js:86:30)
    at teenyRequest (C:\npm\prefix\node_modules\codecov\node_modules\teeny-request\build\src\index.js:143:14)
    at C:\npm\prefix\node_modules\codecov\lib\codecov.js:213:9
    at C:\npm\prefix\node_modules\codecov\node_modules\teeny-request\build\src\index.js:233:13
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)
(node:1700) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1700) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
cmd08 commented 3 years ago

I had this issue - it's because the CODECOV_TOKEN was not in the GitHub Actions environment. The error message from codecov is not very helpful!

brandongregoryscott commented 3 years ago

Interesting catch @cmd08, thanks. The messaging in my Codecov repo settings is a bit misleading, then:

The token below is used exclusively for uploading coverage reports.

Note: Token not required for public repositories uploading from Travis, CircleCI, AppVeyor, Azure Pipelines or GitHub Actions.

It looks like they built a custom action for uploading coverage, which might be an option too.

I'll try this out first and see if it resolves the issue - thank you!

cmd08 commented 3 years ago

I have confirmed following the instructions from the GitHub Actions docs here has resolved the issue. I just had my CODECOV_TOKEN listed as a secret, but I wasn't passing it into the environment.

brandongregoryscott commented 3 years ago

Looks like that did the trick, thanks a bunch @cmd08

  _____          _  
 / ____|        | |  
| |     ___   __| | ___  ___ _____   __  
| |    / _ \ / _` |/ _ \/ __/ _ \ \ / /  
| |___| (_) | (_| |  __/ (_| (_) \ V /  
 \_____\___/ \__,_|\___|\___\___/ \_/  
                                v3.8.2
==> Detecting CI Provider
    GitHub Actions CI Detected
==> Configuration: 
    Endpoint: https://codecov.io
{ commit: '969d3dc0984ac6fd5e1b08060260b100cb500fc1',
  branch: 'main',
  package: 'node-v3.8.2' }
==> Building file structure
==> Scanning for reports
    + D:\a\AndcultureCode.Cli\AndcultureCode.Cli\coverage\lcov.info
    + D:\a\AndcultureCode.Cli\AndcultureCode.Cli\coverage\clover.xml
==> Uploading reports
    Success!
    View report at: https://codecov.io/github/AndcultureCode/AndcultureCode.Cli/commit/969d3dc0984ac6fd5e1b08060260b100cb500fc1
brandongregoryscott commented 3 years ago

Spoke too soon. It seemed to work on a merge commit, but not this recent build: https://github.com/AndcultureCode/AndcultureCode.Cli/pull/196/checks?check_run_id=2538997923 or the build that ran after I updated this pull request https://github.com/AndcultureCode/AndcultureCode.Cli/pull/190/checks?check_run_id=2529650526

May need to look into using the official Codecov Github Action