EDIT: It is currently not possible to merge multiple coverage results generated by Code Climate. In a parallel build where more than one container reports the coverage to Code Climate, only the very first payload received for a certain build will be interpreted. Additional coverage reports sent in will be discarded. The only way to work around this is to use an alternative coverage solution.
To make sure that the coverage is reported correctly to Code Climate in your parallel builds, you’ll need to make sure that, after the coverage run has finished, the results are concentrated on a single machine (for example container 0), merged together and reported from there.
We suggest using the SSH between build containers feature to transfer the coverage info between machines. For example, the following will copy the ~/SampleProject/coverage.xml file to the container 0 from containers 1 to 5:
test:
post:
- "for i in $(seq 1 5) ; do scp node$i:~/SampleProject/coverage.xml coverage-node$i.xml ; done"
You can use Code Climate CLI to merge the coverage into a single file before reporting it back to Code Climate.
Sorry for the delay here. I got in touch with Code Climate about this, and looks like there is no way to merge multiple result files with the Code Climate CLI. I am very sorry for all the confusion this discussion has created so far.
The only thing we can offer right now is to use an alternative coverage solution.
For anyone willing to do some work, I believe that Indiegogo’s Simplecov merge solution should be adaptable to this problem. Indiegogo’s solution has 2 key steps:
Copy test results into an artifacts folder and ensure the last node merges them.
Parse the partial results and use Simplecov’s merge_resultset method(s) to handle the merge logic.
Code Climate’s ruby test reporter is based on Simplecov. In the code climate reporter specs, the formatter refers to the result as simplecov_result, so I think it’s likely that Code Climate reporter results are Simplecov compatible.
That gist has one problem where it doesn’t wait until all parallel builds are done. @matthewford how did you set it up so that you know all other containers are done with their coverage reports?