Why won't Travis CI run the CodeClimate script for my Node app?

二次信任 提交于 2019-12-11 12:38:40

问题


I have followed the instructions to add CodeClimate to my .travis.yml file:

language: node_js
script:
  - gulp
  - npm test
after_script:
  - codeclimate < coverage/**/lcov.info
addons:
  code_climate:
    repo_token: [ my token ]

Everything in my build runs without error, except the codeclimate script at the end:

[0K$ codeclimate < coverage/**/lcov.info
/home/travis/build.sh: line 41: codeclimate: command not found

What am I missing?


回答1:


I added my CODECLIMATE_REPO_TOKEN to my Travis-CI > Settings > Environment Variables and removed it from my .travis.yml file.

I don't want it installing if the build failed (for performance), so I only install it on success in my .travis.yml file, like so:

after_success:
  - npm install codeclimate-test-reporter
  - codeclimate-test-reporter < coverage/lcov.info

I think the codeclimate-test-reporter binary was renamed from codeclimate to codeclimate-test-reporter and perhaps Travis-CI didn't notice the change yet. This must be why it's broken all of the sudden (I had the same issue).




回答2:


I got this working by installing CodeClimate locally:

npm install --save-dev codeclimate-test-reporter

I guess Travis CI's Code Climate addon isn't working, or I'm just not specifying it correctly.



来源:https://stackoverflow.com/questions/29566310/why-wont-travis-ci-run-the-codeclimate-script-for-my-node-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!