Created
April 2, 2020 21:56
-
-
Save qortex/7e7c49f3731391a91ee898336183acef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# See https://github.com/codeclimate/test-reporter/issues/226 | |
# And https://github.com/codeclimate/test-reporter/pull/305 | |
export CI_NAME="heroku" | |
export GIT_COMMITTED_AT="$(date +%s)" | |
# Run the ruby test suite | |
bundle exec rake | |
RETURN_VALUE=$? | |
ruby_filename="coverage/codeclimate.rb.json" | |
# Dirty hack until this is fixed: https://github.com/codeclimate/test-reporter/issues/413 | |
ruby scripts/transform.rb | |
# Format ruby coverage | |
./cc-test-reporter format-coverage "coverage/.resultset.json" --input-type simplecov # --output $ruby_filename | |
# Send to codeclimate | |
./cc-test-reporter upload-coverage | |
# Send status code of the test run | |
./cc-test-reporter after-build --exit-code $RETURN_VALUE --coverage-input-type simplecov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# download the codeclimate test reporter | |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter | |
chmod +x ./cc-test-reporter | |
./cc-test-reporter before-build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/ruby | |
# Temporary hack to get CodeClimate to work with SimpleCov 0.18 JSON format until issue is fixed | |
# upstream: https://github.com/codeclimate/test-reporter/issues/413 | |
require 'json' | |
filename = 'coverage/.resultset.json' | |
contents = JSON.parse(File.read(filename)) | |
def remove_lines_key(obj) | |
case obj | |
when Hash | |
obj.transform_values do |val| | |
val.is_a?(Hash) && val.key?('lines') ? val['lines'] : remove_lines_key(val) | |
end | |
else | |
obj | |
end | |
end | |
# overwrite | |
File.write(filename, JSON.generate(remove_lines_key(contents))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment