AakLak
AakLak

Reputation: 129

Configuring CodeClimate test coverage with TravisCI on Rails

Relevant lines of my .travis.yml file, which I got from the sample here: https://docs.codeclimate.com/v1.0/docs/travis-ci-test-coverage

env:
  global:
    - CC_TEST_REPORTER_ID=MY_ACTUAL_ID

services:
  - postgresql

before_script:
  - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-darwin-amd64 > ./cc-test-reporter
  - chmod +x ./cc-test-reporter
  - ./cc-test-reporter before-build
  - psql -c 'create database travis_ci_test;' -U postgres

script:
  - bundle exec rake db:migrate
  - bundle exec rspec

after_script:
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT

Error:

$ ./cc-test-reporter before-build
/home/travis/.travis/job_stages: line 57: ./cc-test-reporter: cannot execute binary file: Exec format error
The command "./cc-test-reporter before-build" failed and exited with 126 during .

Thanks

Solved:

I realized that while my development machine may be MacOS, the TravisCI environment is on Linux.

Changing test-reporter URL to https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 did the trick!

Upvotes: 0

Views: 972

Answers (2)

mpp
mpp

Reputation: 169

The latest version 0.9.0 on linux is throwing the same format error.

The executable has been compiled incorrectly.

As a workaround you can use the previous version:

curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-0.7.0-linux-amd64 > ./cc-test-reporter

Upvotes: 4

AakLak
AakLak

Reputation: 129

I realized that while my development machine may be MacOS, the TravisCI environment is on Linux.

Changing test-reporter URL to https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 did the trick!

Upvotes: 0

Related Questions