From 160ce092ff70cddfe5d0f3982d8748139544518a Mon Sep 17 00:00:00 2001 From: Benoit Blanchon Date: Sun, 30 Nov 2014 15:11:19 +0100 Subject: [PATCH] Added code coverage badge --- .travis.yml | 10 ++++++++-- CMakeLists.txt | 5 +++++ README.md | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index f6f78ff8..6fccf676 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,5 +2,11 @@ language: c++ compiler: - gcc - clang -before_script: cmake . -script: make && make test \ No newline at end of file +before_install: + - sudo pip install cpp-coveralls +before_script: + - cmake -DCOVERAGE=true . +script: + - make && make test +after_success: + - coveralls --include include --include src --gcov-options '\-lp' \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 994504f4..47f23e27 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,5 +11,10 @@ if(MSVC) add_definitions(-D_CRT_SECURE_NO_WARNINGS -W4) endif() +if(${COVERAGE}) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -coverage") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -coverage") +endif() + add_subdirectory(src) add_subdirectory(test) \ No newline at end of file diff --git a/README.md b/README.md index fcd0763d..ae744885 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Arduino JSON library ==================== -[![Build Status](https://travis-ci.org/bblanchon/ArduinoJson.svg?branch=master)](https://travis-ci.org/bblanchon/ArduinoJson) +[![Build Status](https://travis-ci.org/bblanchon/ArduinoJson.svg?branch=master)](https://travis-ci.org/bblanchon/ArduinoJson) [![Coverage Status](https://img.shields.io/coveralls/bblanchon/ArduinoJson.svg)](https://coveralls.io/r/bblanchon/ArduinoJson?branch=master) *An elegant and efficient JSON library for embedded systems.*