codecov / codecov-bash

Global coverage report uploader for Codecov
https://codecov.io
Apache License 2.0
234 stars 155 forks source link

CircleCI is looking for .codecov.yml when the documentation suggest naming file without dot #281

Closed sylviamoss closed 4 years ago

sylviamoss commented 4 years ago

Hello there!

I added Codecov to a project using CircleCI to send the reports. When my codecov.yml file was named without the first dot CircleCI wasn't able to find the file. See the error below.

  _____          _
 / ____|        | |
| |     ___   __| | ___  ___ _____   __
| |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
| |___| (_) | (_| |  __/ (_| (_) \ V /
 \_____\___/ \__,_|\___|\___\___/ \_/
                              Bash-20200303-bc4d7e6

==> Circle CI detected.
    project root: .
    Yaml found at: .codecov.yml
sed: ./.codecov.yml: No such file or directory
    -> Found 1 reports

My circleci config is:

... 
- codecov/upload:
          file: coverage.txt

I renamed the codecov file by adding the dot and it worked.

There's an inconsistency with the documentation here https://docs.codecov.io/docs/codecov-yaml#section-can-i-name-the-file-codecov-yml. I suggest updating the docs or the CircleCI implementation. Let me know which one is more correct.

Thanks :)

drazisil commented 4 years ago

The docs are correct. I find it strange that the uploader said it found it, then sed failed. Let me look into this, thanks for the report.

sylviamoss commented 4 years ago

When the name contains the dot the logs are:

  _____          _
 / ____|        | |
| |     ___   __| | ___  ___ _____   __
| |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
| |___| (_) | (_| |  __/ (_| (_) \ V /
 \_____\___/ \__,_|\___|\___\___/ \_/
                              Bash-20200303-bc4d7e6

==> Circle CI detected.
    project root: .
    Yaml found at: .codecov.yml
    -> Found 1 reports

Pretty much the same but without failing. Anyways, it's working for me with the . so it's not something urgent. I'll be following this issue for updates. Thanks for replying really fast 👍

drazisil commented 4 years ago

I believe it's choking on this: https://github.com/codecov/codecov-bash/blob/master/codecov#L224-L239

Can you run without the dot, add the -v flag and share the full output? That will tell me if I'm correct.

I'm wondering if it's an indenting issue. Can you also share a commit SHA so I can make sure the YAML is actually making it though the system with no errors?

sylviamoss commented 4 years ago

How can I add the flag to CircleCI command? CircleCI is responsible for writing it, I just add the step and the orb.

If it helps, I believe all the data you need is here (from previous builds): circleci build without dot circleci build with dot the codecov file

sylviamoss commented 4 years ago
curl -s https://codecov.io/bash | bash -s -- \
  -f "coverage.txt" \
  -t "${CODECOV_TOKEN}" \
  -n "${CIRCLE_BUILD_NUM}" \
  -y ".codecov.yml" \
  -F "" \
  -Z || echo 'Codecov upload failed'

I've just realized that the CircleCI command adds the ., the command is the same for both builds. Is this something from their side? this circleci article also uses the dot.

drazisil commented 4 years ago

Oh., you are using the orb. In that case I'll dig in further here, thanks for the examples.

@thomasrockhu Do we hardcode .codecov.yml as a default in the orb, and if so can we change that, please?

thomasrockhu commented 4 years ago

@drazisil Yes I can add that to the next release