问题
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