Closed antonmarin closed 7 years ago
:+1: I agree with that. It'd also be great to document how to leverage the Travis-CI environment variables so you don't need to put your secret token inside the Git repository (this is especially troubling in open source projects).
then in .travis.yml:
addons:
code_climate:
repo_token: $CODECLIMATE_REPO_TOKEN
@antonmarin Agreed that this repo should at least link to TravisCI's documentation for the Code Climate addon.
@1ma As far as I know, you shouldn't have to configure Code Climate as an addon and add the environment variable separately within your TravisCI repo config.
From what I've gathered, the intended behavior of the addon should be to install the correct test reporter automatically given your repo language and set the right env variable from the repo_token
config.
Hopefully that's the case using the addon with a php repo, although I did run into an issue recently configuring the addon for a javascript project: https://github.com/codeclimate/javascript-test-reporter/pull/37. I ended up installing the test reporter manually just before sending the report as a workaround.
It looks like we have some Travis-specific docs available here.
In general, our aim is to centralize documentation on docs.codeclimate.com and link to those from succinct project README's -- to avoid duplication and confusion. This project's README hasn't been rewritten in that style yet, but when it is we should include a link to these docs, and that should close this Issue IMO.
The documentation on the codeclimate is awful with respect to travis-ci usage. I have had a few builds complete after simply adding the following:
addons:
code_climate:
repo_token: ***
and I still get an unknown code coverage, with travis-ci logs showing nothing done with regards to codeclimate.
The available documentation doesn't even mention the need to use travis-ci environment variables to keep the key hidden.
I agree with @carbontwelve - the documentation on setting this up is mystifying. The doc pages seem to circularly link to each other with none of them adding helpful info 😢
I think that covering usage of travis environments on the page is enough to successfully setup
I couldn't get the code coverage to work with the travis integration, which is likely because some of my tests change the current working directory and therefore phpunit doesn't save the clover xml file where the test-reporter is expecting it (I am still not sure where on my machine it saved the file to, because I can't find it unless I provide an absolute output path.)
I ended up fixing this with the following (which are now only executed once for one version of PHP):
vendor/bin/phpunit --coverage-clover=$TRAVIS_BUILD_DIR/build/logs/clover.xml
vendor/bin/test-reporter
Does the travis-ci integration set an absolute path for --coverage-clover
as per my example above? Because sometimes phpunit will not save the output where you expect it to be if you only provide a relative path.
Potential root cause: https://github.com/codeclimate/codeclimate/issues/660
Hey @antonmarin,
Thank for the issue. We're winding down development on this PHP-specific reporter.
I'd recommend checking out our new test reporter and migrating to it if you're interested!
https://github.com/codeclimate/test-reporter https://codeclimate.com/changelog/591c99570d51f6481f001291
It's decoupled from the coverage tool used to generate the report, distributed as a static binary, and has support for parallelized builds. 🎉
We've also worked with Travis CI on an update to their Code Climate documentation which you can find here: https://docs.travis-ci.com/user/code-climate/
No info about how to configure travis addon to use custom coverage-report file (test-reporter [--coverage-report COVERAGE-REPORT])
For example: