Codecov: Swift coverage example
Add to your .travis.yml
file.
language: swift # or objective-c
osx_image: xcode7
script:
- xcodebuild -scheme SwiftExample -workspace SwiftExample.xcworkspace -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6S,OS=9.1' build test
after_success:
- bash <(curl -s https://codecov.io/bash)
Enable "Gather coverage data" in your test scheme:
Codecov
Codecov Token
Set
CODECOV_TOKEN
in your environment variables.
default
This technique will upload the plist containing coverage data.
Again, this is enabled by default.
This technique will run llvm-cov
which produces coverage reports.
To enable:
bash <(curl -s https://codecov.io/bash) -X xcodellvm
# - or -
bash <(curl -s https://codecov.io/bash) -J '^MyPackage$'
# ^^ will enable xcodellvm and only process MyPackage coverage
You may provide your Codecov token by either:
CODECOV_TOKEN
in your environment variables and adding the following to Travis:after_success:
- bash <(curl -s https://codecov.io/bash)
after_success:
- bash <(curl -s https://codecov.io/bash) -t {YOUR-TOKEN-HERE}
The uploader has a boil-the-ocean approach, which can take a longer time to complete coverage report processing. We suggest you add the following to only build reports for the project being tested:
bash <(curl -s https://codecov.io/bash) -J 'SwiftExample'
Use your project name instead of
SwiftExample
. You can also provide multiple arguments via-J 'ProjA' -J 'ProjB'
Set
CODECOV_TOKEN
in your environment variables.
Add to your .travis.yml
file.
after_success:
- bash <(curl -s https://codecov.io/bash) -t uuid-repo-token
Or you can set the environment variable
CODECOV_TOKEN
to your token.
0%
coverage.xcpretty
. Seems broken with code coverage Xcode 8...Example project with Xcode8/Swift3: yannickl/DynamicColor
Older versions of Codecov (<4.4) are not able to parse the coverage output directly from Xcode 10. As a workaround, you can feed the raw coverage information to a tool such as Slather, have it create a Cobertura XML style report, and upload that to Codecov. Detailed information on this workaround can be found (here)[https://github.com/SlatherOrg/slather#usage-with-codecov].
codecov.yml
https://docs.codecov.io/docs/codecov-yaml
We are happy to help if you have any questions. Please contact email our Support at [email protected]