codeclimate / test-reporter

Code Climate Test Reporter
MIT License
156 stars 76 forks source link

Unable to get working w/ Simplecov + Semaphore #472

Closed bradherman closed 3 years ago

bradherman commented 3 years ago

Using simplecov (0.21.2)

When running the following semaphore pipeline, I am unable to get reporting to Codeclimate. semaphore.yml and output included below:

- name: Rspec tests
    task:
      env_vars:
        - name: TEST_DB_USER
          value: postgres
      prologue:
        commands:
          - checkout
          - cache restore
          - sem-service start redis
          - sem-service start postgres
          - sem-version ruby 3.0.1
          - bundle install -j 4 --path vendor/bundle
          - 'RAILS_ENV=test bundle exec rails db:create db:migrate'
          - 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
      jobs:
        - name: Rspec
          commands:
            - bundle exec rspec
      epilogue:
        always:
          commands:
            - 'exitcode=$(if [ "$SEMAPHORE_JOB_RESULT" == "passed" ]; then echo 0; else echo 1; fi)'
            - ./cc-test-reporter after-build --exit-code $exitcode
Coverage report generated for RSpec to /home/semaphore/jeevz-api/coverage. 4123 / 7489 LOC (55.05%) covered.
export SEMAPHORE_JOB_RESULT=passed
exitcode=$(if [ "$SEMAPHORE_JOB_RESULT" == "passed" ]; then echo 0; else echo 1; fi)
./cc-test-reporter after-build --exit-code $exitcode
Error: json: cannot unmarshal object into Go struct field resultSet.coverage of type []formatters.NullInt
bradherman commented 3 years ago

Figured it out... It was a configuration issue on my end, nothing on yours. Sorry!