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
- Write unit tests
- Setup your CI
Add to your .travis.yml
file.
language: objective-c
script:
- xctool -project {{path_to_xcproject}} -scheme {{your_testing_schema}} 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.
env:
global:
- CODECOV_TOKEN=:uuid-repo-token
after_success:
- bash <(curl -s https://codecov.io/bash)
View source and learn more about Codecov Global Uploader