diff --git a/.travis.yml b/.travis.yml index 57cebc1..74a1582 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,8 @@ script: -sdk "$SDK" -destination "$DESTINATION" -derivedDataPath build -enableCodeCoverage YES ENABLE_TESTABILITY=YES "$ACTION" after_success: -- bash <(curl -s https://codecov.io/bash) +- ruby scripts/coverage.rb "$SCHEME" +- bash <(curl -s https://codecov.io/bash) -f 'coverage.txt' env: matrix: - SDK=iphonesimulator CONFIGURATION=Debug ACTION=test diff --git a/scripts/coverage.rb b/scripts/coverage.rb new file mode 100644 index 0000000..404fec1 --- /dev/null +++ b/scripts/coverage.rb @@ -0,0 +1,10 @@ +project_name = ARGV[0] +profdata = Dir.glob(File.join('build', '/**/Coverage.profdata')).first +Dir.glob(File.join('build', "/**/#{project_name}")) do |target| + output = `xcrun llvm-cov report -instr-profile "#{profdata}" "#{target}" -arch=x86_64` + if $?.success? + puts output + `xcrun llvm-cov show -instr-profile "#{profdata}" "#{target}" -arch=x86_64 -use-color=0 > coverage.txt` + break + end +end