ajsecord / example-objc

Codecov example for Xcode

Home Page:https://codecov.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Codecov Objective-C Example

This repository serves as an example on how to use Codecov Global for Xcode in both Objective-C and Swift.

PS there is a Swift specific example here https://github.com/codecov/example-swift

codecov.io

Setup

  • 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.

Travis CI

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.

Private Repos

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.

Build specific projects

# match ExampleName and ExampleNameTests
bash <(curl -s https://codecov.io/bash) -J 'ExampleName'

# user regexp to match only ExampleName and not ExampleNameTests
bash <(curl -s https://codecov.io/bash) -J '^ExampleName$'

View source and learn more about Codecov Global Uploader

About

Codecov example for Xcode

https://codecov.io


Languages

Language:Objective-C 100.0%