https://codecov.io | @codecov | hello@codecov.io |
---|
This repository serves as an example on how to use Codecov Global for Xcode in both Objective-C and Swift.
- Create a shared scheme for your test target https://i.imgur.com/JKNFq0G.png
- At the highest, your deployment target can be 8.1 or earlier. This will update as Travis supports more simulators.
- Write unit tests
- Setup your CI
xctool
also does not respect the /Scheme/TestAction/@codeCoverageEnabled setting in .xcscheme files. Make sure-enableCodeCoverage YES
is set.
Add to your .travis.yml
file.
language: objective-c
script:
- xctool -project {{path_to_xcodeproj}} -scheme {{your_testing_scheme}} build test -sdk iphonesimulator GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES
after_success:
- bash <(curl -s https://codecov.io/bash)
Reference http://docs.travis-ci.com/user/languages/objective-c/
The two important parts are:
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES
(To have Xcode create code coverage files)bash <(curl -s https://codecov.io/bash)
(To upload code coverage to Codecov.io)
This is used to have Xcode output code coverage files for Codecov.io to process.
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 enviornment variable
CODECOV_TOKEN
to your token.
View source and learn more about Codecov Global Uploader