codecov / feedback

A place to discuss feedback about the pull request and web product experience.
38 stars 9 forks source link

Failed to properly upload report: #296

Closed kalyani-msf closed 8 months ago

kalyani-msf commented 8 months ago

name: Code coverage on: workflow_dispatch: jobs: internal: runs-on: ubuntu-latest

------------
- name: Run tests & coverage
  run: |
    cd xxxx
    ./gradlew clean testdevDebugUnitTest
    ./gradlew jacocoTestDevDebugUnitTestReport
    zip -r cover.zip app/build/jacocoHtml

- name: Setup repo root for Codecov 
  run: git config --global --add safe.directory "$GITHUB_WORKSPACE" (Not sure if this is required, same error with and without 

this line)

- name: Upload coverage artifact
  uses: actions/upload-artifact@v3
  with:
        name: cover
        path: xxxx/cover.zip

upload_coverage: needs: internal runs-on: ubuntu-latest steps:

Complete details attached

Screenshot 2024-03-07 at 11 44 21 PM
drazisil-codecov commented 8 months ago

Hi @kalyani-msf It looks like you are checking out to specific path. You will need to pass that to the action as well, so it can locate your repo's root folder. (two lines above the red error)

kalyani-msf commented 8 months ago

Thanks for the response @drazisil-codecov I'm actually passing path to action as well. Following is the complete code,

`name: Code coverage on: workflow_dispatch: jobs: internal: runs-on: ubuntu-latest concurrency: group: ${{ github.head_ref || github.run_id }} cancel-in-progress: true steps:

` Please have a look and let me know if i'm missing anything.

drazisil-codecov commented 8 months ago

Hi @kalyani-msf,

You should also set root_dir to the path of the checked out repo. This will allow Codecov to locate your files, so we can match them to the files listed in the coverage report.

kalyani-msf commented 8 months ago

@drazisil-codecov I'm setting root directory in the follwoing way,

- name: Setup repo root for Codecov
  run: git config --global --add safe.directory "xxxx"

I'm setting up root once the coverage is generated. You can refer above code shared. I've changed to "xxxx" instead of $GITHUB_WORKSPACE" is that correct? If not how to set root_dir or where should we set that path? Please give me some example.

drazisil-codecov commented 8 months ago

Hi @kalyani-msf ,

My apologies , I thought I had added a link.

Setting safe.directory tells the action where it can download the binary, in case of permission issues.

Adding root_dir: <checked out path> under the with: section of the action tells the CLI where to start looking for your repo's files.

https://github.com/codecov/codecov-action?tab=readme-ov-file#arguments

kalyani-msf commented 8 months ago

Thanks @drazisil-codecov .
Adding "root_dir" to action helped.