Measure code coverage

This commit is contained in:
Kishikawa Katsumi 2018-02-06 21:17:58 +09:00
parent 85a55b7727
commit 55df8c3a0e
2 changed files with 12 additions and 1 deletions

View File

@ -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

10
scripts/coverage.rb Normal file
View File

@ -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