19f33c0e71
This adds support for http://coveralls.io/ to the cmake project. This can then be run via a new Travis job, which uploads json containing the coverage data to the website. To use this, please login usin github at http://coveralls.io/ and enable the Jansson project. You can then get a nice percentage badge for code coverage after each Travis buid. Coveralls will also comment on pull request with coverage info. To test and run it locally do: ```bash $ mkdir build && cd build $ cmake -DJANSSON_COVERALLS=ON -DCMAKE_BUILD_TYPE=Debug .. $ cmake --build . # $ make $ cmake --build . --target coveralls # $ make coveralls ``` There is also another script that generates a local HTML page using lcov CodeCoverage.cmake which can be run using ```bash $ make coverage ``` The required depdencies to run this are: gcov curl lcov (is needed for the normal CodeCoverage script)
23 lines
1.3 KiB
YAML
23 lines
1.3 KiB
YAML
env:
|
|
matrix:
|
|
- JANSSON_BUILD_METHOD=cmake JANSSON_CMAKE_OPTIONS="-DJANSSON_TEST_WITH_VALGRIND=ON" JANSSON_EXTRA_INSTALL="valgrind"
|
|
- JANSSON_BUILD_METHOD=autotools
|
|
- JANSSON_BUILD_METHOD=coverage JANSSON_CMAKE_OPTIONS="-DJANSSON_COVERAGE=ON -DJANSSON_COVERALLS=ON -DCMAKE_BUILD_TYPE=Debug" JANSSON_EXTRA_INSTALL="lcov curl"
|
|
language: c
|
|
compiler:
|
|
- gcc
|
|
- clang
|
|
matrix:
|
|
exclude:
|
|
- compiler: clang
|
|
env: JANSSON_BUILD_METHOD=coverage JANSSON_CMAKE_OPTIONS="-DJANSSON_COVERAGE=ON -DJANSSON_COVERALLS=ON -DCMAKE_BUILD_TYPE=Debug" JANSSON_EXTRA_INSTALL="lcov curl"
|
|
allow_failures:
|
|
- env: JANSSON_BUILD_METHOD=coverage JANSSON_CMAKE_OPTIONS="-DJANSSON_COVERAGE=ON -DJANSSON_COVERALLS=ON -DCMAKE_BUILD_TYPE=Debug" JANSSON_EXTRA_INSTALL="lcov curl"
|
|
install:
|
|
- sudo apt-get update -qq
|
|
- sudo apt-get install -y -qq cmake $JANSSON_EXTRA_INSTALL
|
|
script:
|
|
- if [ "$JANSSON_BUILD_METHOD" = "autotools" ]; then autoreconf -f -i && CFLAGS=-Werror ./configure && make check; fi
|
|
- if [ "$JANSSON_BUILD_METHOD" = "cmake" ]; then mkdir build && cd build && cmake $JANSSON_CMAKE_OPTIONS .. && cmake --build . && ctest --output-on-failure; fi
|
|
- if [ "$JANSSON_BUILD_METHOD" = "coverage" ]; then mkdir build && cd build && cmake $JANSSON_CMAKE_OPTIONS .. && cmake --build . && cmake --build . --target coveralls; fi
|