codacy / codacy-coverage-reporter-action

GitHub Action for the codacy-coverage-reporter
Other
58 stars 15 forks source link

[CY-3396] Error: File [path]/lcov.info does not exist #24

Closed darkterra closed 3 years ago

darkterra commented 3 years ago

Hello,

I think, there is somme thing wrong with the path of reporter file (see image on je first and last line) : image


Here the lines concerned :

Run ls -al /home/runner/work/mongo-scheduler/mongo-scheduler/coverage
total 20
drwxr-xr-x  3 runner docker 4096 Dec 26 00:15 .
drwxr-xr-x 10 runner docker 4096 Dec 26 00:15 ..
drwxr-xr-x  3 runner docker 4096 Dec 26 00:15 lcov-report
-rw-r--r--  1 runner docker 5941 Dec 26 00:15 lcov.info
 --> Failed!
2020-12-26 00:15:10.922Z  info [ReportRules] Parsing coverage data from: /home/runner/work/mongo-scheduler/mongo-scheduler/coverage/lcov.info ...  - (ReportRules.scala:43)
2020-12-26 00:15:10.922Z  info [ReportRules] 
To complete the reporting process, call coverage-reporter with the final flag.
 Check https://docs.codacy.com/coverage-reporter/adding-coverage-to-your-repository/#multiple-reports
 for more information.  - (ReportRules.scala:80)
2020-12-26 00:15:10.922Z error [CodacyCoverageReporter] File /home/runner/work/mongo-scheduler/mongo-scheduler/coverage/lcov.info does not exist.  - (CodacyCoverageReporter.scala:25)

And here my GHAction file :


# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:

    runs-on: ubuntu-latest

    strategy:
      matrix:
#         node-version: [10.x, 12.x, 14.x, 15.x]
#         mongodb-version: [4.0, 4.2, 4.4]
        node-version: [15.x]
        mongodb-version: [4.4]

    steps:
    - uses: actions/checkout@v2
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}

    - name: Start MongoDB
      uses: supercharge/mongodb-github-action@1.3.0
      with:
        mongodb-version: ${{ matrix.mongodb-version }}

    - run: npm ci && npm i -g projectz badges
    - run: npm run build --if-present
    - run: npm run test:coverage

    - run: cat ${{ github.workspace }}/coverage/lcov.info
    - run: ls -al ${{ github.workspace }}/coverage

    - name: Run codacy-coverage-reporter
      uses: codacy/codacy-coverage-reporter-action@master
      with:
        project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
        coverage-reports: lcov.info
```bash
github-actions[bot] commented 3 years ago

Internal ticket created : CY-3396

lolgab commented 3 years ago

Hi @darkterra, Left a PR here. I'm not sure that it will work because ( of course ) secrets are not passed to forks. Not sure yet about the exact root cause the files seems missing.. I changed the coverage-reports to use the relative path coverage/lcov.info

darkterra commented 3 years ago

Hello @lolgab ! Thank you for your reply !!!

So, My mistake is to have tried to use ${{ github.workspace }} in the line: path: ${{ github.workspace }}/coverage/lcov.info ?

You found or made a mistake and it works now, thank you very much!

lolgab commented 3 years ago

The problem seems to be that our reporter only works with relative paths to the project root at the moment. Changing it to relative made it. Happy it is now working for you 😃