paambaati / codeclimate-action

GitHub Action to send your code coverage to CodeClimate
MIT License
201 stars 63 forks source link

Cannot unmarshal object into Go struct field resultSet.coverage #609

Closed msxavi closed 2 years ago

msxavi commented 2 years ago

Describe the bug

Hello there, I am not quite sure what I am missing here. I'm running my tests with RSpec inside a container. Can you please help out? I tried many different things already.

    - name: Run tests
      run: docker-compose run --rm -e RAILS_ENV=test web bin/rails spec
      env:
        CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}

    - name: Publish code coverage
      uses: paambaati/codeclimate-action@v3.0.0
      env:
        CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
      with:
        debug: true
        coverageLocations: ${{github.workspace}}/coverage/coverage.json:simplecov

The error I am getting:

Run paambaati/codeclimate-action@v3.0.0
/home/runner/work/p/p/cc-reporter before-build
ℹ️ 'coverageCommand' not set, so skipping building coverage report!
/home/runner/work/p/p/cc-reporter after-build --exit-code 0 --debug
time="2022-09-25T07:00:19Z" level=debug msg="about to run format-coverage" 
time="2022-09-25T07:00:19Z" level=debug msg="searching for a formatter to use" 
time="2022-09-25T07:00:19Z" level=debug msg="checking coverage.py formatter" 
time="2022-09-25T07:00:19Z" level=debug msg="checking search path coverage.xml for coverage.py formatter" 
level=debug msg="checking gcov formatter" 
level=debug msg="checking search path ./ for GCov formatter" 
time="2022-09-25T07:00:19Z" level=debug msg="checking gocov formatter" 
level=debug msg="checking search path c.out for gocov formatter" 
time="2022-09-25T07:00:19Z" level=debug msg="checking lcov-json formatter" 
time="2022-09-25T07:00:19Z" level=debug msg="checking simplecov formatter" 
level=debug msg="checking search path coverage/coverage.json for simplecov formatter" 
time="2022-09-25T07:00:19Z" level=debug msg="checking search path coverage/.resultset.json for simplecov formatter" 
time="2022-09-25T07:00:19Z" level=debug msg="found file coverage/.resultset.json for simplecov formatter" 
time="2022-09-25T07:00:19Z" level=debug msg="couldn't load committed at from ENV, trying git..." 
time="2022-09-25T07:00:19Z" level=debug msg="Analyzing simplecov json output from latest format coverage/.resultset.json" 
time="2022-09-25T07:00:19Z" 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:
(node:5636) UnhandledPromiseRejectionWarning: Error: The process '/home/runner/work/p/p/cc-reporter' failed with exit code 255

Version of codeclimate-action you're using v3.0.0 With simplecov gem (0.21.2)

Expected behavior

Additional context

Coverage report is automatically generated by bin/rails spec. The following debug lines suggest the process found the report files:

time="2022-09-25T07:00:19Z" level=debug msg="found file coverage/.resultset.json for simplecov formatter" 
time="2022-09-25T07:00:19Z" level=debug msg="couldn't load committed at from ENV, trying git..." 
time="2022-09-25T07:00:19Z" level=debug msg="Analyzing simplecov json output from latest format coverage/.resultset.json" 
time="2022-09-25T07:00:19Z" level=debug msg="Analyzing simplecov json output from legacy format coverage/.resultset.json" 
msxavi commented 2 years ago

This is an issue between simplecov 0.18+ and codeclimate test reporter. https://github.com/codeclimate/test-reporter/issues/495