Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverage file only picked up in repo root #862

Closed
FelixS90 opened this issue Oct 27, 2022 · 1 comment
Closed

Coverage file only picked up in repo root #862

FelixS90 opened this issue Oct 27, 2022 · 1 comment

Comments

@FelixS90
Copy link

Summary

I am currently setting up codecov in the context of ZEISS/libczi#7 on Windows. I am following https://about.codecov.io/blog/how-to-set-up-codecov-with-c-plus-plus-and-github-actions/. I have been facing the issue that coverage file are not uploaded although being there.

I tried several things with manipulating the directory or files property of the action - with no success.

I confirmed by inspecting the directory where the coverage file is expected that the coverage file is there - in all scenarios mentioned below.

The only solution/workaround was to put the coverage file in the root of the repo.

Scenario 1: FAIL

Putting coverage.xml somewehere nested below the root and using absolute path for files property

Minimal Repro Steps

- name: Get Coverage
  working-directory: ${{github.workspace}}/build/Src/libCZI_UnitTests/${{matrix.build}}
  shell: cmd
  run: OpenCppCoverage.exe --export_type cobertura:coverage.xml --config_file "${{github.workspace}}\opencppcoverage.txt" -- libCZI_UnitTests.exe
      
- name: Upload Coverage
  uses: codecov/codecov-action@v3
  with:
    files: ${{github.workspace}}\build\Src\libCZI_UnitTests\${{matrix.build}}\coverage.xml
    fail_ci_if_error: true
    verbose: true
    flags: unit,${{matrix.OS}}

Result

2022-10-26T22:46:44.7841793Z [2022-10-26T22:46:44.768Z] ['verbose'] Start of uploader: 1666824404768...
2022-10-26T22:46:44.7842563Z [2022-10-26T22:46:44.770Z] ['info'] 
2022-10-26T22:46:44.7842986Z      _____          _
2022-10-26T22:46:44.7843328Z     / ____|        | |
2022-10-26T22:46:44.7843632Z    | |     ___   __| | ___  ___ _____   __
2022-10-26T22:46:44.7843926Z    | |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
2022-10-26T22:46:44.7844235Z    | |___| (_) | (_| |  __/ (_| (_) \ V /
2022-10-26T22:46:44.7844549Z     \_____\___/ \__,_|\___|\___\___/ \_/
2022-10-26T22:46:44.7847171Z 
2022-10-26T22:46:44.7847911Z   Codecov report uploader 0.3.2
2022-10-26T22:46:44.8125872Z [2022-10-26T22:46:44.798Z] ['info'] => Project root located at: D:/a/libczi/libczi
2022-10-26T22:46:44.8163816Z [2022-10-26T22:46:44.802Z] ['info'] -> No token specified or token is empty
2022-10-26T22:46:44.8164491Z [2022-10-26T22:46:44.802Z] ['verbose'] Start of network processing...
2022-10-26T22:46:44.8165162Z [2022-10-26T22:46:44.802Z] ['verbose'] Searching for files in D:/a/libczi/libczi
2022-10-26T22:46:44.8464733Z [2022-10-26T22:46:44.832Z] ['verbose'] coveragepy is not installed
2022-10-26T22:46:44.8465394Z [2022-10-26T22:46:44.832Z] ['info'] Searching for coverage files...
2022-10-26T22:46:44.9454699Z [2022-10-26T22:46:44.929Z] ['verbose'] Preparing to clean the following coverage paths: D:\a\libczi\libczi\build\Src\libCZI_UnitTests\Debug\coverage.xml
2022-10-26T22:46:44.9457198Z [2022-10-26T22:46:44.930Z] ['error'] None of the following appear to exist as files: D:\a\libczi\libczi\build\Src\libCZI_UnitTests\Debug\coverage.xml
2022-10-26T22:46:44.9458174Z [2022-10-26T22:46:44.930Z] ['error'] There was an error running the uploader: Error while cleaning paths. No paths matched existing files!
2022-10-26T22:46:44.9458923Z [2022-10-26T22:46:44.930Z] ['verbose'] The error stack is: Error: Error while cleaning paths. No paths matched existing files!
2022-10-26T22:46:44.9459451Z     at cleanCoverageFilePaths (C:\snapshot\project\dist\src\helpers\files.js)
2022-10-26T22:46:44.9459902Z     at main (C:\snapshot\project\dist\src\index.js)
2022-10-26T22:46:44.9460355Z     at processTicksAndRejections (node:internal/process/task_queues:96:5)
2022-10-26T22:46:44.9460939Z [2022-10-26T22:46:44.931Z] ['verbose'] End of uploader: 163 milliseconds
2022-10-26T22:46:44.9725232Z ##[error]Codecov: Failed to properly upload: The process 'D:\a\_actions\codecov\codecov-action\v3\dist\codecov.exe' failed with exit code 4294967295

Scenario 2: FAIL

Putting coverage.xml somewehere nested below the root and using relativ paths in directory and files property

Minimal Repro Steps

- name: Get Coverage
  working-directory: ${{github.workspace}}/build/Src/libCZI_UnitTests/${{matrix.build}}
  shell: cmd
  run: OpenCppCoverage.exe --export_type cobertura:coverage.xml --config_file "${{github.workspace}}\opencppcoverage.txt" -- libCZI_UnitTests.exe

- name: Upload Coverage
  uses: codecov/codecov-action@v3
  with:
    directory: ./build/Src/libCZI_UnitTests/${{matrix.build}}/
    files: ./coverage.xml
    fail_ci_if_error: true
    verbose: true
    flags: unit,${{matrix.OS}}

Result

2022-10-26T23:31:45.2290388Z [2022-10-26T23:31:45.218Z] ['verbose'] Start of uploader: 1666827105218...
2022-10-26T23:31:45.2292385Z [2022-10-26T23:31:45.219Z] ['info'] 
2022-10-26T23:31:45.2292733Z      _____          _
2022-10-26T23:31:45.2293011Z     / ____|        | |
2022-10-26T23:31:45.2293300Z    | |     ___   __| | ___  ___ _____   __
2022-10-26T23:31:45.2293597Z    | |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
2022-10-26T23:31:45.2293905Z    | |___| (_) | (_| |  __/ (_| (_) \ V /
2022-10-26T23:31:45.2296208Z     \_____\___/ \__,_|\___|\___\___/ \_/
2022-10-26T23:31:45.2296818Z 
2022-10-26T23:31:45.2297060Z   Codecov report uploader 0.3.2
2022-10-26T23:31:45.2557090Z [2022-10-26T23:31:45.246Z] ['info'] => Project root located at: D:/a/libczi/libczi
2022-10-26T23:31:45.2590567Z [2022-10-26T23:31:45.249Z] ['info'] -> No token specified or token is empty
2022-10-26T23:31:45.2591177Z [2022-10-26T23:31:45.249Z] ['verbose'] Start of network processing...
2022-10-26T23:31:45.2591753Z [2022-10-26T23:31:45.249Z] ['verbose'] Searching for files in D:/a/libczi/libczi
2022-10-26T23:31:45.2865573Z [2022-10-26T23:31:45.276Z] ['verbose'] coveragepy is not installed
2022-10-26T23:31:45.2866186Z [2022-10-26T23:31:45.277Z] ['info'] Searching for coverage files...
2022-10-26T23:31:45.3219472Z [2022-10-26T23:31:45.297Z] ['verbose'] Preparing to clean the following coverage paths: ./coverage.xml
2022-10-26T23:31:45.3221141Z [2022-10-26T23:31:45.298Z] ['error'] None of the following appear to exist as files: ./coverage.xml
2022-10-26T23:31:45.3221983Z [2022-10-26T23:31:45.298Z] ['error'] There was an error running the uploader: Error while cleaning paths. No paths matched existing files!
2022-10-26T23:31:45.3222652Z [2022-10-26T23:31:45.299Z] ['verbose'] The error stack is: Error: Error while cleaning paths. No paths matched existing files!
2022-10-26T23:31:45.3223191Z     at cleanCoverageFilePaths (C:\snapshot\project\dist\src\helpers\files.js)
2022-10-26T23:31:45.3223641Z     at main (C:\snapshot\project\dist\src\index.js)
2022-10-26T23:31:45.3224068Z     at processTicksAndRejections (node:internal/process/task_queues:96:5)
2022-10-26T23:31:45.3224571Z [2022-10-26T23:31:45.299Z] ['verbose'] End of uploader: 81 milliseconds
2022-10-26T23:31:45.3920551Z ##[error]Codecov: Failed to properly upload: The process 'D:\a\_actions\codecov\codecov-action\v3\dist\codecov.exe' failed with exit code 4294967295

Scenario 3: SUCCESS

Putting coverage.xml in root

Minimal Repro Steps

- name: Get Coverage
  working-directory: ${{github.workspace}}/build/Src/libCZI_UnitTests/${{matrix.build}}
  shell: cmd
  run: OpenCppCoverage.exe --export_type cobertura:${{github.workspace}}\coverage.xml --config_file "${{github.workspace}}\opencppcoverage.txt" -- libCZI_UnitTests.exe
  
- name: Upload Coverage
  uses: codecov/codecov-action@v3
  with:
    files: ./coverage.xml
    fail_ci_if_error: true
    verbose: true
    flags: unit,${{matrix.OS}}

Result

2022-10-27T05:17:49.9705394Z [2022-10-27T05:17:49.956Z] ['verbose'] Start of uploader: 1666847869956...
2022-10-27T05:17:49.9752406Z [2022-10-27T05:17:49.957Z] ['info'] 
2022-10-27T05:17:49.9784201Z      _____          _
2022-10-27T05:17:49.9848437Z     / ____|        | |
2022-10-27T05:17:49.9901912Z    | |     ___   __| | ___  ___ _____   __
2022-10-27T05:17:49.9929033Z    | |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
2022-10-27T05:17:49.9965692Z    | |___| (_) | (_| |  __/ (_| (_) \ V /
2022-10-27T05:17:49.9991914Z     \_____\___/ \__,_|\___|\___\___/ \_/
2022-10-27T05:17:50.0027030Z 
2022-10-27T05:17:50.0089020Z   Codecov report uploader 0.3.2
2022-10-27T05:17:50.0176536Z [2022-10-27T05:17:50.007Z] ['info'] => Project root located at: D:/a/libczi/libczi
2022-10-27T05:17:50.0237497Z [2022-10-27T05:17:50.011Z] ['info'] -> No token specified or token is empty
2022-10-27T05:17:50.0274913Z [2022-10-27T05:17:50.011Z] ['verbose'] Start of network processing...
2022-10-27T05:17:50.0374528Z [2022-10-27T05:17:50.011Z] ['verbose'] Searching for files in D:/a/libczi/libczi
2022-10-27T05:17:50.0829719Z [2022-10-27T05:17:50.073Z] ['verbose'] coveragepy is not installed
2022-10-27T05:17:50.0926419Z [2022-10-27T05:17:50.074Z] ['info'] Searching for coverage files...
2022-10-27T05:17:50.1906737Z [2022-10-27T05:17:50.173Z] ['verbose'] Preparing to clean the following coverage paths: ./coverage.xml
2022-10-27T05:17:50.2179910Z [2022-10-27T05:17:50.173Z] ['info'] => Found 1 possible coverage files:
2022-10-27T05:17:50.2253623Z   ./coverage.xml
2022-10-27T05:17:50.2254695Z [2022-10-27T05:17:50.173Z] ['verbose'] End of network processing
2022-10-27T05:17:50.2255368Z [2022-10-27T05:17:50.173Z] ['info'] Processing ./coverage.xml...

Possibly Related PRs

#770
#577
#537
#385

@thomasrockhu-codecov
Copy link
Contributor

@FelixS90 please open a topic in our community boards for this, so that I can better debug your issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants