Skip to content

Commit

Permalink
Measure code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
kishikawakatsumi committed Feb 6, 2018
1 parent 85a55b7 commit 55df8c3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions scripts/coverage.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 55df8c3

Please sign in to comment.