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

Not able to find coverage file #487

Open
rossPatton opened this issue Feb 9, 2022 · 2 comments
Open

Not able to find coverage file #487

rossPatton opened this issue Feb 9, 2022 · 2 comments
Assignees

Comments

@rossPatton
Copy link

I am trying to set up coverage integration with github actions

I am using the recommended github action, paambaati/[email protected]

I get an error that doesn't really help, ie, it's unclear what I need to do in order to fix

Here's my github workflow:

on: 'push'

jobs:
  coverage:
    env:
      ...(redacted)

    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1

    - name: Setup Node
      uses: actions/setup-node@v1
      with:
        node-version: '16.2'

    - name: Cache dependencies
      uses: actions/cache@v1
      with:
        path: ./node\_modules
        key: ${{ runner.OS }}-dependencies-${{ hashFiles('\*\*/package-lock.json') }}
        restore-keys: |
          ${{ runner.OS }}-dependencies-${{ env.cache-name }}-
          ${{ runner.OS }}-dependencies-
          ${{ runner.OS }}-

    - name: Install dependencies
      run: npm ci

    - name: Test & publish code coverage
      uses: paambaati/[email protected]
      env:
        CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
      with:
        coverageCommand: npm test
        coverageLocations: |
          client/coverage/lcov.info
          server/coverage/lcov.info
        debug: true

The lcov files do exist, and the jest tests run and pass fine.

Here's the debug log from the cc-test-reporter:

home/runner/work/StudentPortal/StudentPortal/cc-reporter format-coverage /home/runner/work/StudentPortal/StudentPortal/client/coverage/lcov.info -t lcov -o codeclimate.0.json --debug
time="2022-02-09T20:39:17Z" level=debug msg="coverage path /home/runner/work/StudentPortal/StudentPortal/client/coverage/lcov.info" 
time="2022-02-09T20:39:17Z" level=debug msg="using formatter lcov" 
time="2022-02-09T20:39:17Z" level=debug msg="checking search path /home/runner/work/StudentPortal/StudentPortal/client/coverage/lcov.info for lcov formatter" 
time="2022-02-09T20:39:19Z" level=debug msg="couldn't load committed at from ENV, trying git..." 
time="2022-02-09T20:39:19Z" level=info msg="trimming with prefix /home/runner/work/StudentPortal/StudentPortal/" 
time="2022-02-09T20:39:19Z" level=debug msg="getting fallback blob_id for source file components/index.ts" 
time="2022-02-09T20:39:19Z" level=error msg="failed to read file components/index.ts\nopen components/index.ts: no such file or directory" 
Error: open components/index.ts: no such file or directory
Usage:
cc-test-reporter format-coverage [coverage file] [flags]

Flags:
    --add-prefix string   add this prefix to file paths
-t, --input-type string   type of input source to use [clover, cobertura, coverage.py, excoveralls, gcov, gocov, jacoco, lcov, lcov-json, simplecov, xccov]
-o, --output string       output path (default "coverage/codeclimate.json")
-p, --prefix string       the root directory where the coverage analysis was performed (default "/home/runner/work/StudentPortal/StudentPortal")

Global Flags:
-d, --debug   run in debug mode

Error: The process '/home/runner/work/StudentPortal/StudentPortal/cc-reporter' failed with exit code 255
(node:2293) UnhandledPromiseRejectionWarning: Error: The process '/home/runner/work/StudentPortal/StudentPortal/cc-reporter' failed with exit code 255
  at ExecState._setResult (/home/runner/work/_actions/paambaati/codeclimate-action/v3.0.0/node_modules/@actions/exec/lib/toolrunner.js:592:25)
  at ExecState.CheckComplete (/home/runner/work/_actions/paambaati/codeclimate-action/v3.0.0/node_modules/@actions/exec/lib/toolrunner.js:575:18)
  at ChildProcess.<anonymous> (/home/runner/work/_actions/paambaati/codeclimate-action/v3.0.0/node_modules/@actions/exec/lib/toolrunner.js:469:27)
  at ChildProcess.emit (events.js:210:5)
  at maybeClose (internal/child_process.js:1021:16)
  at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
(node:2293) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:2293) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Error: 🚨 CC Reporter coverage formatting failed!
@rossPatton rossPatton changed the title Error message / General usage unclear to me Not able to find coverage file Feb 9, 2022
@David-Trejo
Copy link

@rossPatton Were you able to find a solution for this problem?

@rossPatton
Copy link
Author

It's been awhile since I've thought about this (and sorry for the slow response, I was on extended leave) but I believe we were able to get something rudimentary working, but not with codeclimate unfortunately

name: Tests & Coverage Report
on: pull_request

jobs:
  coverage_client:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3

    - uses: actions/setup-node@v3
      with:
        node-version: 16.17.0
        cache: 'npm'

    - name: Install dependencies
      run: npm ci

    - name: Run Coverage
      run: (cd client/ && npm run coverage)

    - name: Report code coverage
      # if: steps.wait-for-tests.outputs.conclusion == 'success'
      uses: zgosalvez/[email protected]
      with:
        coverage-files: client/coverage/lcov.info
        minimum-coverage: 70
        artifact-name: client-coverage-report
        github-token: ${{ secrets.GITHUB_TOKEN }}
        working-directory: client

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

3 participants