Coder Social home page Coder Social logo

paambaati / codeclimate-action Goto Github PK

View Code? Open in Web Editor NEW
197.0 197.0 64.0 17.89 MB

GitHub Action to send your code coverage to CodeClimate

License: MIT License

TypeScript 100.00%
codeclimate coverage github-actions nodejs quality typescript

codeclimate-action's Introduction

GP

๐Ÿ‘‹๐Ÿฝ Hey there! My name is Ganesh Prasannah, but everyone knows me as GP.

I'm a web and infrastructure engineer & a problem solver at heart. I mostly work with Terraform and JavaScript-based runtimes & libraries like Node.js, Deno, Bun, Cloudflare Workers, TypeScript & React, and I focus on expressive, clean & performant code. I also work on DevOps & distributed systems; I'm super-comfortable with Ansible, Packer, Nomad, HAProxy, Apache Mesos & Kafka.

๐Ÿ’ฌ What I love doing

  1. Advocating for a better hiring pipeline.

  2. Building inclusive, thoughtful and solid engineering teams.

  3. Mentoring & bringing up talent.

  4. Writing beautiful robust software.

  5. Blogging about things I love or learnt.

  6. Hunting down the perfect GIF for every situation.

codeclimate-action's People

Contributors

antongolub avatar arareko avatar bennypowers avatar dependabot-preview[bot] avatar dependabot[bot] avatar fabn avatar jasonkarns avatar juanvqz avatar kengotoda avatar markvaughn avatar martinnuc avatar matthewshirley avatar miguelfrias97 avatar olly avatar paambaati avatar ralphg6 avatar rwjblue avatar sumolari avatar vladjerca avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

codeclimate-action's Issues

Split action into before-build and after-build phases

Describe the solution you'd like

I'd like to see the action split into the before-build phase and the after-build phase so I can run them separately, as opposed to having the action run the tests itself. This allows me to do things like run an entire workflow in the middle. I think the action should still allow running the full end to end if that's what's needed, but, for example, if a with command is passed, such as phase: before-build, then it will only run that phase.

Describe alternatives you've considered

I've tried doing it manually, but I'd much rather use this action. I've also found another action that does this, but I'd rather use this one as it's more official.

Coverage report doesn't appear on the Overview tab

I've set up a GitHub Actions workflow to report my test code coverage to Code Climate. The workflow uses this action. As a result, the coverage report appears in the project settings:

image image

But doesn't appear on the Overview tab in Code Climate:

image

I've directed this issue to the Code Climate support, they said that the branch name (provided by this action) must me master instead of refs/heads/master.

The full conversation

Code Climate:

Hi Surgie,

Thanks for reaching out! Happy to help and point you in the right direction.

I haven't seen this GitHub Action before -- pretty cool! I'm not sure how to make changes to the GitHub Action to make this work for you, but here's what we see on our side:

On the backend, I do see that we're successfully receiving payloads for this repo (last commit f40b844b); however, they each identify your master branch as:

refs/heads/master

To help resolve this error, we generally recommend making the path above ^^ relative to the project root.

  • You can do this by adding the --prefix flag to your to your CI's coverage configuration.
  • More information is in our docs here.
  • It should look something like --prefix /[path to directory]

This removes absolute paths in coverage payloads to make them relative to the project root. This is usually the directory in which the tests were run.

(You could also instruct your test setup to start at the root of your project.)

Again, I'm not sure how to make the above work with the GitHub Action. You might need to open an issue with the maintainer on the project itself: https://github.com/paambaati/codeclimate-action/issues

-> Once you've made changes to your setup, could you try pushing a brand new commit to master?

Let me know if you have any questions, or if there's anything else I can help with. I'll be standing by to help further.

Thanks,
Emily

I:

Hi!

I used the same PhpUnit setup and CLI command with a plain cc-test-reporter command in another repository and it worked fine. Also the reported coverage is shown in the Code section but not in the Overview section.

Will the problem be solved if my action sends the same report but with branch master instead of refs/heads/master?

Iโ€™ll make an issue in the action repository and attach our conversation.

Code Climate:

Hi Surgie,

Thanks for the additional info.

Will the problem be solved if my action sends the same report but with branch master instead of refs/heads/master?

Yes! That should do the trick ๐Ÿ‘Œ

Let me know once you're able to get that working! I'd love to make some notes for troubleshooting for anyone else who runs into the same.

Thanks,
Emily

PS: I couldn't find the output for the coverage info it in your Workflow logs, but I did some branch name troubleshooting earlier with another GitHub Workflow user.
his setup reported branch names to be HEAD
and I recommended this stackflow conversation

(here's the coverage-related Workflow logs from the other user)

Please also consider that a branch can have a slash in its name, e.g. a gitflow-style branch feature/name.

Consider deleting the 2.7.1 release

Describe the bug

The 2.7.1 release had a bug that basically cause it to silently no-op #235

This bug was fixed in the next version, but the 2.7.1 action is still available for use, and can trip folks using old documentation or who upgraded to that version and didn't notice that their reports became outdated

https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository#deleting-a-release

This may cause a surge of bug reports or broken builds, but imo (As someone who doesn't have to hear them, admittedly) that's preferable to the silent failures that could be happening now

Version of codeclimate-action you're using
v2.7.1

Example links

Expected behavior

Additional context

after-build issue with latest simplecov

Odd behaviors happening with latest simplecov, seems like an issue getting the committed at timestamp which seems unrelated to the simplecov update but wanted to mention just incase.

SimpleCov version 0.18.2

CI Code

- name: Test & publish code coverage
        uses: paambaati/[email protected]
        env:
          CC_TEST_REPORTER_ID:  foobar
        with:
          coverageCommand: bundle exec rails test
          debug: true

Error

./cc-reporter after-build --exit-code 0 --debug
time="2020-02-14T19:14:44Z" level=debug msg="about to run format-coverage" 
time="2020-02-14T19:14:44Z" level=debug msg="searching for a formatter to use" 
time="2020-02-14T19:14:44Z" level=debug msg="checking coverage.py formatter" 
time="2020-02-14T19:14:44Z" level=debug msg="checking search path coverage.xml for coverage.py formatter" 
time="2020-02-14T19:14:44Z" level=debug msg="checking lcov formatter" 
time="2020-02-14T19:14:44Z" level=debug msg="checking search path coverage/lcov.info for lcov formatter" 
time="2020-02-14T19:14:44Z" level=debug msg="checking simplecov formatter" 
time="2020-02-14T19:14:44Z" level=debug msg="checking search path coverage/.resultset.json for simplecov formatter" 
time="2020-02-14T19:14:44Z" level=debug msg="found file coverage/.resultset.json for simplecov formatter" 
time="2020-02-14T19:14:44Z" level=debug msg="couldn't load committed at from ENV, trying git..." 
Error: json: cannot unmarshal object into Go struct field input.coverage of type []formatters.NullInt

Can't read pyproject.toml errors

Describe the bug
A couple of my repos are getting Can't read 'pyproject.toml' without TOML support. Install with [toml] extra errors on recent builds. I know pytest-cov recently updated, I'm not sure if this error is related to that update.

Version of codeclimate-action you're using
v3.0.0

Example links
Failing run: https://github.com/gaphor/generic/actions/runs/1310020693
Configuration: https://github.com/gaphor/generic/blob/afd62eaa532498b40b1995b436bfa0ec1ca35aa9/.github/workflows/build.yml

Expected behavior
Passing build.

Additional context

CodeClimate Report for Go doesn't work

Error

Actions Result URL: https://github.com/toshimaru/nyan/runs/459063904

./cc-reporter after-build --exit-code 0
time="2020-02-20T23:26:31Z" level=error msg="failed to read file github.com/toshimaru/nyan/main.go\nopen github.com/toshimaru/nyan/main.go: no such file or directory" 
Error: open github.com/toshimaru/nyan/main.go: no such file or directory
Usage:
  cc-test-reporter after-build [flags]

Flags:
  -s, --batch-size int               batch size for source files (default 500)
  -e, --coverage-endpoint string     endpoint to upload coverage information to (default "https://api.codeclimate.com/v1/test_reports")
  -t, --coverage-input-type string   type of input source to use [clover, cobertura, coverage.py, excoveralls, gcov, gocov, jacoco, lcov, simplecov, xccov]
      --exit-code int                exit code of the test run
  -r, --id string                    reporter identifier (default "f4c78effd3a10a5a45239e6886b35f42475467ad53f09a01002feeb04eb92d5b")
      --insecure                     send coverage insecurely (without HTTPS)
  -p, --prefix string                the root directory where the coverage analysis was performed (default "/home/runner/work/nyan/nyan")

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

##[error]Error: The process './cc-reporter' failed with exit code 255
##[error]๐Ÿšจ CC Reporter after-build checkin failed!
(node:2888) UnhandledPromiseRejectionWarning: Error: The process './cc-reporter' failed with exit code 255
    at ExecState._setResult (/home/runner/work/_actions/paambaati/codeclimate-action/v2.4.0/node_modules/@actions/exec/lib/toolrunner.js:548:25)
    at ExecState.CheckComplete (/home/runner/work/_actions/paambaati/codeclimate-action/v2.4.0/node_modules/@actions/exec/lib/toolrunner.js:531:18)
    at ChildProcess.<anonymous> (/home/runner/work/_actions/paambaati/codeclimate-action/v2.4.0/node_modules/@actions/exec/lib/toolrunner.js:431: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:2888) 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: 1)
(node:2888) [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.

My Setting

    steps:
    - uses: actions/setup-go@v2-beta
      with:
        go-version: '^1.13.8'
    ...
    - uses: paambaati/[email protected]
      env:
        CC_TEST_REPORTER_ID: ...
      with:
        coverageCommand: go test ./... -coverprofile c.out

Other information

cc-test-reporter on TravisCI works with the following setting.

...
before_script:
  - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
  - chmod +x ./cc-test-reporter
  - ./cc-test-reporter before-build
script:
  - go build .
  - go test ./... -coverprofile c.out
after_script:
  - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT

Run a gradle command as a coverageCommand

I am trying to run a gradle tasks as coverageCommand, but the task is not found.

Here is my config:

- name: Generate and publish code coverage
uses: paambaati/[email protected]
env:
# Set CC_TEST_REPORTER_ID as secret of your repo
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
JACOCO_SOURCE_PATH: "${{github.workspace}}/src/main/java"
with:
coverageCommand: ./gradlew jacocoTestReport
# The report file must be there, otherwise Code Climate won't find it
coverageLocations:
"${{github.workspace}}/src/app/build/reports/coverage/staging/debug/report.xml::jacoco"

Is there an option to set a working directory or something. Any hints/leads what am I doing wrong.

coverageLocations fails with more than once package

Using coverageLocations fails to work. I've tried many different options and the only one that seems to work is running on a single package.

 - name: Collect and upload code coverage to Code Climate
      uses: paambaati/[email protected]
      env: 
        CC_TEST_REPORTER_ID: xxxx
      with:
        coverageCommand: yarn run jest --coverage
        coverageLocations:
          "./packages/react/fast-components-foundation-react/coverage/lcov.info:lcov",
          "./packages/react/fast-components-react-base/coverage/lcov.info:lcov"
          # './packages/react/fast-components-react-msft/coverage/lcov.info:lcov',
          # './packages/react/fast-components-styles-msft/coverage/lcov.info:lcov',
          # './packages/react/fast-jss-manager-react/coverage/lcov.info:lcov',
          # './packages/react/fast-jss-utilities/coverage/lcov.info:lcov',
          # './packages/react/fast-layouts-react/coverage/lcov.info:lcov',
          # './packages/react/fast-react-utilities/coverage/lcov.info:lcov',
          # './packages/tooling/fast-tooling/coverage/lcov.info:lcov',
          # './packages/tooling/fast-tooling-react/coverage/lcov.info:lcov',
          # './packages/utilities/fast-animation/coverage/lcov.info:lcov',
          # './packages/utilities/fast-colors/coverage/lcov.info:lcov',
          # './packages/utilities/fast-web-utilities/coverage/lcov.info:lcov'
        debug: true

Wrong commit SHA

Hi,

I trigger the tests and the coverage by pull request. When I check in Code Climate, I do see the right name, but not the right commit sha.

Based on what the great google says:

"When the action is triggered by a pull_request event, GitHub will squash and merge this branch with the base branch, generating a new commit, thus a new hash.
The commit we want (the HEAD in the branch we're merging) can be fetched by running git rev-parse origin/$GITHUB_HEAD_REF."

Request: v1, v2 major-version branches

GitHub Actions recommends (and the community has a convention) that a vN branch exists that always points to the latest minor/patch release for a given major release line. This way users can receive patch and minor updates without continually bumping their workflow manifests.

Some docs mention using a tag for this ref; but that's not really recommended practice since it runs counter to git's expectation that tags do not move; so I'd recommend using a branch. FWIW, I keep my branch up-to-date using a release workflow to advance the vN branch on each tagged release: https://github.com/nodenv/actions/blob/3f3fd551a5416f6d792793a826fadb713b376cea/.github/workflows/release.yml#L14-L23

Failed job `fatal: unsafe repository ('/__w/T-Regx/T-Regx' is owned by someone else)`

Describe the bug

Action fails with a vanilla configuration, my configuration looks like this, I think it's pretty standard.

- name: Upload coverage results to Code Climate
  if: "${{ matrix.coverage != 'none' }}"
  uses: paambaati/[email protected]
  continue-on-error: true
  env:
    CC_TEST_REPORTER_ID: ${{ secrets.CODE_CLIMATE_REPORTER_ID }}

Version of codeclimate-action you're using
v3.0.0

Example links

  1. Example build run with debug: true: https://github.com/T-Regx/T-Regx/runs/6261918186?check_suite_focus=true
  2. Workflow config: https://github.com/T-Regx/T-Regx/blob/master/.github/workflows/build.yaml

Expected behavior

The action uploads coverage to code climate.

Unexpected error during `before-build` process

Describe the bug
Unexpected error while running before-build through action. See action logs here. Screen shot below of error message.

Screen Shot 2020-12-20 at 7 59 03 PM

Version of codeclimate-action you're using
v2.7.5

Example links

  1. Debug is set to true.
  2. Github action workflow here.

Expected behavior
Should be able to check in without error and continue to test and upload coverage report to code climate.

Additional context
Was working prior to this bug.

v2.7.1 stopped sending coverage comments.

Describe the bug
CodeClimate coverage comments stopped updating after upgrading. I believe there were some failures in sending the coverage data to CodeClimate.

I'm referring to this:

Screen Shot 2020-09-28 at 10 40 00 am

Version v2.6.0 works without problems. I have reverted back to it in the mean time.

Version of codeclimate-action you're using
v2.7.1

Example links
I'll post some screenshots when I get the time.

Expected behavior
It will continue behaving as it was before.

Additional context
TODO

Coverage.py (python)

I am trying to get codeclimate-action to work with coverage.py. However I am having some issues. I switched from conda to pip which solved the issue that the command coverage isn't found. However now I have some issues with the action mangling paths it seems:

/home/runner/work/peaksql/peaksql/cc-reporter before-build
/opt/hostedtoolcache/Python/3.7.6/x64/bin/coverage xml
/home/runner/work/peaksql/peaksql/cc-reporter after-build --exit-code 0 --debug --prefix 
time="2020-02-26T08:17:55Z" level=debug msg="about to run format-coverage" 
time="2020-02-26T08:17:55Z" level=debug msg="searching for a formatter to use" 
time="2020-02-26T08:17:55Z" level=debug msg="checking cobertura formatter" 
time="2020-02-26T08:17:55Z" level=debug msg="checking search path cobertura.xml for cobertura formatter" 
time="2020-02-26T08:17:55Z" level=debug msg="checking coverage.py formatter" 
time="2020-02-26T08:17:55Z" level=debug msg="checking search path coverage.xml for coverage.py formatter" 
time="2020-02-26T08:17:55Z" level=debug msg="found file coverage.xml for coverage.py formatter" 
time="2020-02-26T08:17:56Z" level=debug msg="couldn't load committed at from ENV, trying git..." 
time="2020-02-26T08:17:56Z" level=debug msg="creating test file report for /home/runner/work/peaksql/peaksql/peaksql/__init__.py" 
time="2020-02-26T08:17:56Z" level=info msg="trimming with prefix /" 
time="2020-02-26T08:17:56Z" level=debug msg="getting fallback blob_id for source file home/runner/work/peaksql/peaksql/peaksql/__init__.py" 
time="2020-02-26T08:17:56Z" level=error msg="failed to read file home/runner/work/peaksql/peaksql/peaksql/__init__.py\nopen home/runner/work/peaksql/peaksql/peaksql/__init__.py: no such file or directory" 
Error: open home/runner/work/peaksql/peaksql/peaksql/__init__.py: no such file or directory
Usage:
  cc-test-reporter after-build [flags]

Flags:
  -s, --batch-size int               batch size for source files (default 500)
  -e, --coverage-endpoint string     endpoint to upload coverage information to (default "https://api.codeclimate.com/v1/test_reports")
  -t, --coverage-input-type string   type of input source to use [clover, cobertura, coverage.py, excoveralls, gcov, gocov, jacoco, lcov, simplecov, xccov]
      --exit-code int                exit code of the test run
  -r, --id string                    reporter identifier (default "***")
      --insecure                     send coverage insecurely (without HTTPS)
  -p, --prefix string                the root directory where the coverage analysis was performed (default "/home/runner/work/peaksql/peaksql")

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

(node:2854) UnhandledPromiseRejectionWarning: TypeError: (s || "").replace is not a function
    at escapeData (/home/runner/work/_actions/paambaati/codeclimate-action/v2.5.2/node_modules/@actions/core/lib/command.js:66:10)
    at Command.toString (/home/runner/work/_actions/paambaati/codeclimate-action/v2.5.2/node_modules/@actions/core/lib/command.js:60:35)
    at issueCommand (/home/runner/work/_actions/paambaati/codeclimate-action/v2.5.2/node_modules/@actions/core/lib/command.js:23:30)
    at Object.issue (/home/runner/work/_actions/paambaati/codeclimate-action/v2.5.2/node_modules/@actions/core/lib/command.js:27:5)
    at Object.error (/home/runner/work/_actions/paambaati/codeclimate-action/v2.5.2/node_modules/@actions/core/lib/core.js:120:15)
    at /home/runner/work/_actions/paambaati/codeclimate-action/v2.5.2/lib/main.js:163:20
    at Generator.throw (<anonymous>)
    at rejected (/home/runner/work/_actions/paambaati/codeclimate-action/v2.5.2/lib/main.js:6:65)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:2854) 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: 1)
(node:2854) [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.

It manages to find the coverage.xml file, but somehow something goes wrong with the paths. I am not sure what could be causing this. I am using the latest version (v2.5.2). This is how I call it:

    - name: Run tests
      run: |
        coverage run -m unittest discover -v test

    - uses: paambaati/[email protected]
      env:
        CC_TEST_REPORTER_ID: ${{ secrets.CodeClimate }}
      with:
        coverageCommand: coverage xml
        debug: true

'coverageCommand' not set, so skipping building coverage report!

Describe the bug

Run paambaati/[email protected]
  with:
    debug: false
  env:
    CC_TEST_REPORTER_ID: ***
/home/runner/work/apollo-elements/apollo-elements/cc-reporter before-build
โ„น๏ธ 'coverageCommand' not set, so skipping building coverage report!
/home/runner/work/apollo-elements/apollo-elements/cc-reporter after-build --exit-code 0
Test report uploaded successfully to Code Climate

Version of codeclimate-action you're using
v2.7.3

Example links
https://github.com/apollo-elements/apollo-elements/runs/1192699104?check_suite_focus=true
https://github.com/apollo-elements/apollo-elements/blob/master/.github/workflows/pull-request.yml

Expected behavior
builds regardless

Additional context
See #238

Question: Upload coverage without `coverageCommand`

I would like to use this action to upload coverage, but I don't want the action to run the tests. I want them run in a separate step. How do I upload coverage without any command run in coverageCommand?

Running 'Test and Publish Code Coverage' returns a TypeError message

Describe the bug
I am trying to send the test report to code-climate. After running the job, it says the step passed but on opening it, it only contains error messages.

(node:7164) UnhandledPromiseRejectionWarning: TypeError: (s || "").replace is not a function at escapeData (D:\a\_actions\paambaati\codeclimate-action\v2.5.6\node_modules\@actions\core\lib\command.js:66:10) at Command.toString (D:\a\_actions\paambaati\codeclimate-action\v2.5.6\node_modules\@actions\core\lib\command.js:60:35) at issueCommand (D:\a\_actions\paambaati\codeclimate-action\v2.5.6\node_modules\@actions\core\lib\command.js:23:30) at Object.issue (D:\a\_actions\paambaati\codeclimate-action\v2.5.6\node_modules\@actions\core\lib\command.js:27:5) at Object.error (D:\a\_actions\paambaati\codeclimate-action\v2.5.6\node_modules\@actions\core\lib\core.js:127:15) at D:\a\_actions\paambaati\codeclimate-action\v2.5.6\lib\main.js:85:20 at Generator.throw (<anonymous>) at rejected (D:\a\_actions\paambaati\codeclimate-action\v2.5.6\lib\main.js:6:65) (node:7164) 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: 1) (node:7164) [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.

I also get the same result after using the v2.6.0 and v2.5.7 versions.

Version of codeclimate-action you're using
v2.5.6

Example links
Github action

Expected behavior
It should run successfully and send the test report to Code climate.

Getting UnhandledPromiseRejectionWarning

I've tried setting up following the examples however I get this error and no reports are sent to CC:

(node:2154) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'split' of undefined
    at Function.<anonymous> (/home/runner/work/_actions/paambaati/codeclimate-action/v2.7.5/node_modules/@actions/glob/lib/internal-globber.js:160:36)
    at Generator.next (<anonymous>)
    at /home/runner/work/_actions/paambaati/codeclimate-action/v2.7.5/node_modules/@actions/glob/lib/internal-globber.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/home/runner/work/_actions/paambaati/codeclimate-action/v2.7.5/node_modules/@actions/glob/lib/internal-globber.js:4:12)
    at Function.create (/home/runner/work/_actions/paambaati/codeclimate-action/v2.7.5/node_modules/@actions/glob/lib/internal-globber.js:154:16)
    at Object.<anonymous> (/home/runner/work/_actions/paambaati/codeclimate-action/v2.7.5/node_modules/@actions/glob/lib/glob.js:21:56)
    at Generator.next (<anonymous>)
    at /home/runner/work/_actions/paambaati/codeclimate-action/v2.7.5/node_modules/@actions/glob/lib/glob.js:8:71
    at new Promise (<anonymous>)
(node:2154) 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:2154) [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.

Version of codeclimate-action you're using
v2.5.7

My setup is quite straightforward so not sure what is happening:

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/[email protected]
      - run: npm install
      - run: npm build
      - uses: paambaati/[email protected]
        env:
          CC_TEST_REPORTER_ID: ${{ secrets.CODE_CLIMATE_TOKEN }}
        with:
          coverageCommand: npm run test:ci:unit
          coverageLocations: ${{github.workspace}}/coverage/lcov.info

Any help, greatly appreciated!

Do you support running on mono-repositories

It's unclear if your action supports running across mono repositories where there are multiple packages with some using code coverage and others not.

Could you provide documentation and or answer to this question?

Thanks

Error: could not find any viable formatter 255

Describe the bug
Getting an error on after-build (never saw this command running in 2.7.1 and earlier):

Error: could not find any viable formatter. available formatters: clover, cobertura, coverage.py, excoveralls, gcov, gocov, jacoco, lcov, lcov-json, simplecov, xccov
Usage:
  cc-test-reporter after-build [flags]

Version of codeclimate-action you're using
v2.7.5

Expected behavior
2.7.1 an earlier versions used to work perfectly. Now I just have no clue what to do. Is that some kind of general CC change and I have to change the config, or is that just a bug? Switched to 2.7.1 atm

Additional context
My GitHub Actions cc config:

 - name: Code Test and Coverage
    uses: paambaati/[email protected]
    env:
      CC_TEST_REPORTER_ID: "${{secrets.CC_TEST_REPORTER_ID}}"
    with:
      coverageCommand: composer test-cover
      coverageLocations: "${{github.workspace}}/coverage.xml:clover"

CoveragePy Formatter not found.

Describe the bug
I'm attempting to use this action to report pytest results on a flask application. After the tests successfully run, the after-build job cannot find the CoveragePy package to use as a formatter.

Version
v2.7.4

Example links

  1. Error run with debug on https://github.com/bcgov/mines-digital-trust/runs/1533132459?check_suite_focus=true

Expected behaviour
coveragePY command runs the testsuite, but the cc-test-reporter after-build command doesn't find it. It is the supported python package by code climate. https://docs.codeclimate.com/docs/configuring-test-coverage

Error: JSON: Cannot unmarshal object into Go struct

Describe the bug
Uploading the code-coverage report fails with Error: json: cannot unmarshal object into Go struct field resultSet.coverage of type []formatters.NullInt.

##[debug]Evaluating: secrets.CC_TEST_REPORTER_ID
##[debug]Evaluating Index:
##[debug]..Evaluating secrets:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'CC_TEST_REPORTER_ID'
##[debug]=> '***'
##[debug]Result: '***'
##[debug]Evaluating condition for step: 'Run paambaati/[email protected]'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Run paambaati/[email protected]
##[debug]Loading inputs
##[debug]Loading env
Run paambaati/[email protected]
##[debug]โ„น๏ธ Downloading CC Reporter from https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 ...
##[debug]โœ… CC Reporter downloaded...
##[debug]โ„น๏ธ Verifying CC Reporter checksum...
##[debug]โœ… CC Reported checksum verification completed...
##[debug]โ„น๏ธ Verifying CC Reporter GPG signature...
##[debug]โœ… CC Reported GPG signature verification completed...
/home/runner/work/sidekiq-undertaker/sidekiq-undertaker/cc-reporter before-build
##[debug]โœ… CC Reporter before-build checkin completed...
โ„น๏ธ 'coverageCommand' not set, so skipping building coverage report!
/home/runner/work/sidekiq-undertaker/sidekiq-undertaker/cc-reporter after-build --exit-code 0 --debug
time="2022-04-27T14:00:56Z" level=debug msg="about to run format-coverage" 
time="2022-04-27T14:00:56Z" level=debug msg="searching for a formatter to use" 
time="2022-04-27T14:00:56Z" level=debug msg="checking excoveralls formatter" 
time="2022-04-27T14:00:56Z" level=debug msg="checking search path cover/excoveralls.json for excoveralls formatter" 
time="2022-04-27T14:00:56Z" level=debug msg="checking gcov formatter" 
time="2022-04-27T14:00:56Z" level=debug msg="checking search path ./ for GCov formatter" 
time="2022-04-27T14:00:56Z" level=debug msg="checking jacoco formatter" 
time="2022-04-27T14:00:56Z" level=debug msg="checking search path jacoco.xml for jacoco formatter" 
time="2022-04-27T14:00:56Z" level=debug msg="checking lcov formatter" 
time="2022-04-27T14:00:56Z" level=debug msg="checking search path coverage/lcov.info for lcov formatter" 
time="2022-04-27T14:00:56Z" level=debug msg="checking clover formatter" 
time="2022-04-27T14:00:56Z" level=debug msg="checking search path build/logs/clover.xml for clover formatter" 
time="2022-04-27T14:00:56Z" level=debug msg="checking search path clover.xml for clover formatter" 
time="2022-04-27T14:00:56Z" level=debug msg="checking coverage.py formatter" 
time="2022-04-27T14:00:56Z" level=debug msg="checking search path coverage.xml for coverage.py formatter" 
time="2022-04-27T14:00:56Z" level=debug msg="checking lcov-json formatter" 
time="2022-04-27T14:00:56Z" level=debug msg="checking simplecov formatter" 
time="2022-04-27T14:00:56Z" level=debug msg="checking search path coverage/coverage.json for simplecov formatter" 
time="2022-04-27T14:00:56Z" level=debug msg="checking search path coverage/.resultset.json for simplecov formatter" 
time="2022-04-27T14:00:56Z" level=debug msg="found file coverage/.resultset.json for simplecov formatter" 
time="2022-04-27T14:01:05Z" level=debug msg="couldn't load committed at from ENV, trying git..." 
time="2022-04-27T14:01:05Z" level=debug msg="Analyzing simplecov json output from latest format coverage/.resultset.json" 
time="2022-04-27T14:01:05Z" level=debug msg="Analyzing simplecov json output from legacy format coverage/.resultset.json" 
Error: json: cannot unmarshal object into Go struct field resultSet.coverage of type []formatters.NullInt
Usage:
  cc-test-reporter after-build [flags]

Flags:
  -s, --batch-size int               batch size for source files (default 500)
  -e, --coverage-endpoint string     endpoint to upload coverage information to (default "https://api.codeclimate.com/v1/test_reports")
  -t, --coverage-input-type string   type of input source to use [clover, cobertura, coverage.py, excoveralls, gcov, gocov, jacoco, lcov, lcov-json, simplecov, xccov]
      --exit-code int                exit code of the test run
  -r, --id string                    reporter identifier (default "***")
      --insecure                     send coverage insecurely (without HTTPS)
  -p, --prefix string                the root directory where the coverage analysis was performed (default "/home/runner/work/sidekiq-undertaker/sidekiq-undertaker")

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

(node:1580) UnhandledPromiseRejectionWarning: Error: The process '/home/runner/work/sidekiq-undertaker/sidekiq-undertaker/cc-reporter' failed with exit code 255
Error: The process '/home/runner/work/sidekiq-undertaker/sidekiq-undertaker/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:314:20)
    at maybeClose (internal/child_process.js:1022:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
(node:1580) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:1580) [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 after-build checkin failed!
##[debug]Node Action run completed with exit code 1
##[debug]Finishing: Run paambaati/[email protected]

Version of codeclimate-action you're using
v3.0.0

Example links
Failing Github Actions Run
Example Pull Request

Expected behavior
Uploading the code-coverage report should work with all versions of codeclimate-action.

Additional context
Works with version v2.7.1, but fails with versions above (like: v3.0.0).

Set the 'prefix' parameter and the action fails

Describe the bug
I sent the test reporter to the code climate, but I got this error message below:

{
"message": "Invalid path part "/" and Invalid path part "/"",
"file_document": "{"_id"=>BSON::ObjectId('5ed3c6b842ab182246002132'), "type"=>"test_file_reports", "blob_id"=>"3750e50900cfbc331b3518fb087c02bfee33a964", "coverage"=>"[null,null,null,null,null,null,null,null,4,4,0,0,0,null,null,4,null,4,0,0,null,null,4,null,4,null,null,1,1,null,1,null,1,1,null,1,null,0,0,null,0,null,1,1,null,1,null,0,0,null,0,null,1,1,null,1,null,0,0,null,4,null,null,0,null,null,null,4,0,null,4,null,4,null,null,null,null,null,null,null,4,null,0,null,4]", "covered_percent"=>60, "covered_strength"=>1.5, "line_counts"=>{"missed"=>16, "covered"=>24, "total"=>40}, "path"=>"/home/runner/work/warren-global-portfolio/warren-global-portfolio/src//Warren.Global.Portfolio.Converters/Common/PercentageConverter.cs", "test_report_id"=>BSON::ObjectId('5ed3c6b8fe05c221d3003109')}"
}

I written to the 'codeclimate' support and they tell me that I should turn the path into a relative path using the prefix parameter.

I've tried to do this in my yml file:
image

When I included the prefix parameter I receive this error for the action:

image

Version of codeclimate-action you're using
v2.6.0

Expected behavior
I don't know if my config is wrong or if has a bug when putting the prefix parameter. Maybe you could help me with this question.

Error with 2.5.6

Hey ๐Ÿ––

I encounter an error with version 2.5.6 which does not fail the job, even when trying to define a location no format is retrieved.
I don't really understand, I don't know where the problem comes from. I've downgrade the version to 2.5.0 to get it working.

The test reporter error:
https://github.com/codeclimate/test-reporter/blob/master/cmd/format-coverage.go#L86

Invalid build 2.5.6:
https://github.com/AshLePoney/node-assert-enhanced/runs/579960704?check_suite_focus=true#step:6:117

Valid build with 2.5.0:
https://github.com/AshLePoney/node-assert-enhanced/runs/579986479

Thanks

See ya, Ash

v3.0.0 fails to load

Describe the bug
When updating the action from v2.7.5 to v3.0.0, an error is shown which prevents the task to run:

Download action repository 'paambaati/[email protected]' (SHA:baef3850ca1973cd488c8c1ef005b40eb20d8f21)
Error: paambaati/codeclimate-action/v3.0.0/action.yml:
Error: paambaati/codeclimate-action/v3.0.0/action.yml: (Line: 30, Col: 51, Idx: 902) - (Line: 30, Col: 80, Idx: 931): While parsing a block mapping, did not find expected key.
Error: System.ArgumentException: Unexpected type '' encountered while reading 'action manifest root'. The type 'MappingToken' was expected.
   at GitHub.DistributedTask.ObjectTemplating.Tokens.TemplateTokenExtensions.AssertMapping(TemplateToken value, String objectDescription)
   at GitHub.Runner.Worker.ActionManifestManager.Load(IExecutionContext executionContext, String manifestFile)
Error: Fail to load paambaati/codeclimate-action/v3.0.0/action.yml

Version of codeclimate-action you're using
v3.0.0

Expected behavior
Same as v2.7.5

Prefix parameter not passed to test-reporter if coverageLocations is empty

Describe the bug
I have set the test reporter to upload without specifying the coverageLocations parameter. In this scenario, the prefix is never added to the after-build call.

Version of codeclimate-action you're using
v2.5.7

Example links

CI Step

      - name: Publish coverage to CodeClimate
        uses: paambaati/[email protected]
        env:
          CC_TEST_REPORTER_ID: demo
        with:
          debug: true
          workingDirectory: ./example_example
          prefix: /home/runner/work/example_example/example_example

Environment

 with:
    debug: true
    workingDirectory: ./example_example
    prefix: /home/runner/work/example_example/example_example
  env:
    ...

Debug

time="2020-12-04T03:52:45Z" level=debug msg="about to run format-coverage" 
time="2020-12-04T03:52:45Z" level=debug msg="searching for a formatter to use" 
time="2020-12-04T03:52:45Z" level=debug msg="checking gocov formatter" 
time="2020-12-04T03:52:45Z" level=debug msg="checking search path c.out for gocov formatter" 
time="2020-12-04T03:52:45Z" level=debug msg="checking jacoco formatter" 
time="2020-12-04T03:52:45Z" level=debug msg="checking search path jacoco.xml for jacoco formatter" 
time="2020-12-04T03:52:45Z" level=debug msg="checking lcov formatter" 
time="2020-12-04T03:52:45Z" level=debug msg="checking search path coverage/lcov.info for lcov formatter" 
time="2020-12-04T03:52:45Z" level=debug msg="checking clover formatter" 
time="2020-12-04T03:52:45Z" level=debug msg="checking search path build/logs/clover.xml for clover formatter" 
time="2020-12-04T03:52:45Z" level=debug msg="checking search path clover.xml for clover formatter" 
time="2020-12-04T03:52:45Z" level=debug msg="checking cobertura formatter" 
time="2020-12-04T03:52:45Z" level=debug msg="checking search path cobertura.xml for cobertura formatter" 
time="2020-12-04T03:52:45Z" level=debug msg="checking coverage.py formatter" 
time="2020-12-04T03:52:45Z" level=debug msg="checking search path coverage.xml for coverage.py formatter" 
time="2020-12-04T03:52:45Z" level=debug msg="found file coverage.xml for coverage.py formatter" 
time="2020-12-04T03:52:45Z" level=debug msg="couldn't load committed at from ENV, trying git..." 
time="2020-12-04T03:52:45Z" level=debug msg="creating test file report for /home/runner/work/example_example/example_example/example_example/conftest.py" 
time="2020-12-04T03:52:45Z" level=info msg="trimming with prefix /home/runner/work/example_example/example_example/example_example/" 

Expected behavior
The prefix to be added to the after-build call.

Uploaded coverage reports don't take into account original repo

Describe the bug
The reports submitted to code climate for PRs made from forks and the master branch on the original repo itself have indistinguishable names.

Version of codeclimate-action you're using
v2.7.5

Expected behavior
When I have a PR made against my repo from a fork codeclimate's diff-coverage runs. To do that it requires a coverage report from both master on my repo, and the PR itself. However, when the PR comes from a forked repo, and that repo has made its PR from it's own master, the reports submitted override eachother:

image

Should instead be something like this:

image

The consequence is that codeclimate won't run the diff checking, because it is just seeing multiple test coverage reports submitted to master. I'm not sure exactly what's expected here: whether it should be master and minut1bc/master or something else.

Additional context
I've raised an issue here just in case it is actually codeclimate's fault, but I suspect that the problem may be here instead, where the names are generated for submission.

[Bug] v3.0.0: could not find any viable formatter

Describe the bug
The action says "could not find any viable formatter" when the formatter is explicitly provided.

Version of codeclimate-action you're using
v3.0.0

Example links

Run paambaati/[email protected]
  with:
    coverageLocations:
      shared/coverage/lcov.info:lcov
      shared/coverage/**/lcov.info:lcov 
    debug: false
    verifyDownload: true
  env:
    CC_TEST_REPORTER_ID: 
/home/runner/work/unstoppable-domains-website/unstoppable-domains-website/cc-reporter before-build
โ„น๏ธ 'coverageCommand' not set, so skipping building coverage report!
/home/runner/work/unstoppable-domains-website/unstoppable-domains-website/cc-reporter after-build --exit-code 0
Error: could not find any viable formatter. available formatters: clover, cobertura, coverage.py, excoveralls, gcov, gocov, jacoco, lcov, lcov-json, simplecov, xccov
Usage:
  cc-test-reporter after-build [flags]

Flags:
  -s, --batch-size int               batch size for source files (default 500)
  -e, --coverage-endpoint string     endpoint to upload coverage information to (default "https://api.codeclimate.com/v1/test_reports")
  -t, --coverage-input-type string   type of input source to use [clover, cobertura, coverage.py, excoveralls, gcov, gocov, jacoco, lcov, lcov-json, simplecov, xccov]
      --exit-code int                exit code of the test run
  -r, --id string                    reporter identifier
      --insecure                     send coverage insecurely (without HTTPS)
  -p, --prefix string                the root directory where the coverage analysis was performed (default "/home/runner/work/unstoppable-domains-website/unstoppable-domains-website")

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

Error: The process '/home/runner/work/unstoppable-domains-website/unstoppable-domains-website/cc-reporter' failed with exit code [2](https://github.com/unstoppabledomains/unstoppable-domains-website/runs/5647938349?check_suite_focus=true#step:4:2)55
(node:1524) UnhandledPromiseRejectionWarning: Error: The process '/home/runner/work/unstoppable-domains-website/unstoppable-domains-website/cc-reporter' failed with exit code 255
    at ExecState._setResult (/home/runner/work/_actions/paambaati/codeclimate-action/v[3](https://github.com/unstoppabledomains/unstoppable-domains-website/runs/5647938349?check_suite_focus=true#step:4:3).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:[4](https://github.com/unstoppabledomains/unstoppable-domains-website/runs/5647938349?check_suite_focus=true#step:4:4)69:27)
    at ChildProcess.emit (events.js:314:20)
    at maybeClose (internal/child_process.js:1022:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:287:[5](https://github.com/unstoppabledomains/unstoppable-domains-website/runs/5647938349?check_suite_focus=true#step:4:5))
(node:1524) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:1524) [DEP001[8](https://github.com/unstoppabledomains/unstoppable-domains-website/runs/5647938349?check_suite_focus=true#step:4:8)] 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.

my config is part of a private repo

Expected behavior
for the code coverage to be submitted

Additional context
n/a

JaCoCo with Maven multi-module or Gradle multi-project builds

Describe the bug
coverageLocations can be multiple values, but JACOCO_SOURCE_PATH can only contain one value.

In a Java build that produces multiple jars, I need a different JaCoCo source path per coverage location.

Version of codeclimate-action you're using
v2.5.7

Expected behavior
I should be able to specify the source paths for each coverage location.

Additional context
This may need to be reported upstream here: https://github.com/codeclimate/test-reporter

Does this Action support mono-repositories?

We have a mono repository and would like to use this Action, however, there is no documentation or examples that indicate support for mono-repositories.

Could you provide guidance on this topic question?

Thanks,

unable to recognise "lcov" format due to a earlier failure

Describe the bug
The upload fails without causing the job to fail

Example links
image

image

Expected behavior
The coverage report should be recognised as "lcov" and correctly uploaded

Additional context
Add any other context about the problem here.
image

Handling pull_request_target event

Is your feature request related to a problem? Please describe.
A couple of my workflows are using the event pull_request_target. This event uses the default branch last commit SHA as a reference to be checked out (even if the origin is a pull request, for security reasons).

Describe the solution you'd like
I would like to pass explicitly a commit SHA/branch (as ref) to receive CC updates in the case of this event.

I would like a new optional input called ref (for example) which will be used if exists in prepareEnv, defaulting to the current configuration otherwise.
Currently, my 'workaround' is a modified fork of this repository.

Another option could be simply: handling this event like the pull_request event in prepareEnv. Mind the warning

action don't run the coverageCommand

Describe the bug
I tried to use the action but it seems not running the command
the debug flag also doesn't show any more details

Version of codeclimate-action you're using
v2.7.1

here is the usage part from my workflow file:

      - name: โœ… Test & publish code coverage
        uses: paambaati/[email protected]
        env:
          CC_TEST_REPORTER_ID: ${{ secrets.CODE_CLIMATE_REPORTER_ID }}
        with:
          coverageCommand: yarn test:unit-coverage

the running result:
Screen Shot 2020-10-01 at 8 45 32

Glob support for coverage locations

Is your feature request related to a problem? Please describe.
It would be great to use glob to describe coverage locations

Describe the solution you'd like

      - name: Jest Testing
        uses: paambaati/[email protected]
        env:
          CC_TEST_REPORTER_ID: ${{ secrets.CODE_CLIMATE_TOKEN }}
        with:
          coverageCommand: yarn test
          coverageLocations: |
            ${{github.workspace}}/packages/*/reports/jest-coverage/lcov.info:lcov

Describe alternatives you've considered
Listing every package manually

CodeClimate action for Python (conda) does not work

I think similar to #109 where it doesn't work for GoLang, it also doesn't work for Python coverage:

    - name: Test & publish code coverage
      uses: paambaati/[email protected]
      env:
        CC_TEST_REPORTER_ID: ${{ secrets.CodeClimate }}
      with:
        coverageCommand: coverage run -m unittest discover test
        debug: true

Results in:

./cc-reporter before-build
coverage run -m unittest discover test
##[error]Error: There was an error when attempting to execute the process 'coverage'. This may indicate the process failed to start. Error: spawn coverage ENOENT
##[error]๐Ÿšจ Coverage run failed!
(node:4858) UnhandledPromiseRejectionWarning: Error: There was an error when attempting to execute the process 'coverage'. This may indicate the process failed to start. Error: spawn coverage ENOENT
    at ExecState._setResult (/home/runner/work/_actions/paambaati/codeclimate-action/v2.4.0/node_modules/@actions/exec/lib/toolrunner.js:545:25)
    at ExecState.CheckComplete (/home/runner/work/_actions/paambaati/codeclimate-action/v2.4.0/node_modules/@actions/exec/lib/toolrunner.js:531:18)
    at ChildProcess.<anonymous> (/home/runner/work/_actions/paambaati/codeclimate-action/v2.4.0/node_modules/@actions/exec/lib/toolrunner.js:418:27)
    at ChildProcess.emit (events.js:210:5)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
(node:4858) 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: 1)
(node:4858) [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.

Failing unit tests does not abort the action

I was wondering why my unit tests seemingly passed, but no coverage report was generated.
I noticed in the job logs that my unit tests failed, but the action continued, making it seem that the check passed. But there's an error that gets ignored:

FAIL
coverage: 48.1% of statements
FAIL	1.210s
FAIL
(node:2733) UnhandledPromiseRejectionWarning: TypeError: (s || "").replace is not a function
    at escapeData (/home/runner/work/_actions/paambaati/codeclimate-action/v2.5.3/node_modules/@actions/core/lib/command.js:66:10)
    at Command.toString (/home/runner/work/_actions/paambaati/codeclimate-action/v2.5.3/node_modules/@actions/core/lib/command.js:60:35)
    at issueCommand (/home/runner/work/_actions/paambaati/codeclimate-action/v2.5.3/node_modules/@actions/core/lib/command.js:23:30)
    at Object.issue (/home/runner/work/_actions/paambaati/codeclimate-action/v2.5.3/node_modules/@actions/core/lib/command.js:27:5)
    at Object.error (/home/runner/work/_actions/paambaati/codeclimate-action/v2.5.3/node_modules/@actions/core/lib/core.js:120:15)
    at /home/runner/work/_actions/paambaati/codeclimate-action/v2.5.3/lib/main.js:89:20
    at Generator.throw (<anonymous>)
    at rejected (/home/runner/work/_actions/paambaati/codeclimate-action/v2.5.3/lib/main.js:6:65)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:2733) 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: 1)
(node:2733) [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.

See here: https://github.com/ccremer/znapzend-exporter/runs/475913996?check_suite_focus=true

For now, I'll have to run the unit tests twice I guess, so the job gets properly aborted.

Mono repository incorrectly reporting success

Is your feature request related to a problem? Please describe.
When running the following GitHub Action on a Lerna mono-repository if any single package fails, it still reports success.

In my example, the projectRoot incorrectly pointed to ../../../ instead of below code block, causing format_coverage to break, yet GH Action codeclimate-action to report success though really fail.

    "coverageReporters": [
      "json", 
      [
        "lcov", {"projectRoot": "../../"}
      ]
    ],

Describe the solution you'd like
Accurately report status as success and see that through on the Code Climate settings test reporting pages.

Additional context
Add any other context or screenshots about the feature request here.

Actual Error

Error: open workspace/sites/fast-component-explorer/app/app.tsx: 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, simplecov, xccov]
|   -o, --output string       output path (default "coverage/codeclimate.json")
|   -p, --prefix string       the root directory where the coverage analysis was performed (default "/github/workspace")
| 
| Global Flags:
|   -d, --debug   run in debug mode
| 
| (node:5413) UnhandledPromiseRejectionWarning: TypeError: (s || "").replace is not a function
|     at escapeData (/actions/[email protected]/node_modules/@actions/core/lib/command.js:66:10)
|     at Command.toString (/actions/[email protected]/node_modules/@actions/core/lib/command.js:60:35)
|     at issueCommand (/actions/[email protected]/node_modules/@actions/core/lib/command.js:23:30)
|     at Object.issue (/actions/[email protected]/node_modules/@actions/core/lib/command.js:27:5)
|     at Object.error (/actions/[email protected]/node_modules/@actions/core/lib/core.js:127:15)
|     at /actions/[email protected]/lib/main.js:135:28
|     at Generator.throw (<anonymous>)
|     at rejected (/actions/[email protected]/lib/main.js:6:65)
|     at processTicksAndRejections (internal/process/task_queues.js:97:5)
| (node:5413) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
| (node:5413) [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.
[CI - FAST Local Testing/build_local_linux]   โœ…  Success - Collect and upload code coverage to Code Climate

Unable to locate executable file cc-reporter

Describe the bug
The executable file does not seem to be found on Windows environment.

Version of codeclimate-action you're using
v2.7.5

Example links
https://github.com/Mulugruntz/aiosubprocess/runs/2664633651?check_suite_focus=true#step:9:24

Expected behavior
It should work, just like on macOS and linux builds.

Additional context

##[debug]โ„น๏ธ Downloading CC Reporter from https://codeclimate.com/downloads/test-reporter/test-reporter-latest-win32-amd64 ...
##[debug]โœ… CC Reporter downloaded...
Error: Unable to locate executable file: D:\a\aiosubprocess\aiosubprocess\cc-reporter. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.
Error: ๐Ÿšจ CC Reporter before-build checkin failed!

Question: Is coverageCommand required if coverage has already been created?

Is your feature request related to a problem? Please describe.
I'm already running code coverage via lerna run test --stream and the documentation is not clear if coverageCommand is required on my monorepository if /coverage has already been created.

Describe the solution you'd like
The coverageCommand should be optional.

Describe alternatives you've considered

  1. Add a script command for code coverage across 20+ packages

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.