Closed kalyani-msf closed 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)
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:
uses: actions/checkout@v4 with: path: xxxx
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"
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:
uses: actions/checkout@v4 with: path: xxxx
name: Download coverage artifact uses: actions/download-artifact@v3 with: name: cover
name: Upload coverage reports uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} flags: unittests # optional files: "app/build/jacocoHtml/index.html" fail_ci_if_error: true
` Please have a look and let me know if i'm missing anything.
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.
@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.
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
Thanks @drazisil-codecov .
Adding "root_dir" to action helped.
name: Code coverage on: workflow_dispatch: jobs: internal: runs-on: ubuntu-latest
this line)
upload_coverage: needs: internal runs-on: ubuntu-latest steps:
uses: actions/checkout@v4 with: path: xxxx
name: Download coverage artifact uses: actions/download-artifact@v3 with: name: cover
name: Upload coverage reports uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} flags: unittests files: "xxxx/build/cover.xml" fail_ci_if_error: true
Complete details attached