From 047a6251b35f937c837c96f3949c9c8aba12683a Mon Sep 17 00:00:00 2001 From: equalsraf Date: Sat, 20 Jun 2020 14:20:39 +0100 Subject: [PATCH] Enable coveralls Circle CI cpp-coveralls is used to collect coverage and upload into coveralls.io. Service specific settings are loaded from yaml files in contrib. I have added comments for Travis CI as well but I am facing issues there, coverage keeps getting reported as 0%. --- .circleci/config.yml | 9 ++++++++- .travis.yml | 8 +++++++- contrib/coveralls-circle.yml | 8 ++++++++ contrib/coveralls-travis.yml | 8 ++++++++ 4 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 contrib/coveralls-circle.yml create mode 100644 contrib/coveralls-travis.yml diff --git a/.circleci/config.yml b/.circleci/config.yml index e9447fc62..923474f84 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -14,7 +14,9 @@ jobs: command: sudo apt-get update - run: name: Install dependencies - command: sudo apt-get install -y cmake libqt5svg5 libqt5svg5-dev neovim python3-dev python3-jinja2 python3-msgpack python3-pip qt5-default + command: | + sudo apt-get install -y cmake libqt5svg5 libqt5svg5-dev neovim python3-dev python3-jinja2 python3-msgpack python3-pip qt5-default + pip install --user cpp-coveralls PyYAML - run: name: build command: | @@ -29,4 +31,9 @@ jobs: command: | cd build ctest -VV + - run: + name: Upload coverage report + # trick cpp-coveralls into doing the right thing + # https://github.com/eddyxu/cpp-coveralls/issues/143 + command: TRAVIS_JOB_ID="#${CIRCLE_BUILD_NUM}" ~/.local/bin/cpp-coveralls -y contrib/coveralls-circle.yml -E '.*/build/.*' -E '.*/third-party/.*' -E '.*/test/.*' -E '.*/bindings/.*' diff --git a/.travis.yml b/.travis.yml index 3b1c5e74f..9346d57ab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,10 +12,16 @@ before_install: - brew ls | grep -wq cmake || brew install cmake - brew ls | grep -wq qt5 || brew install qt5 - brew ls | grep -wq msgpack || brew install msgpack + # cpp-coveralls https://github.com/eddyxu/cpp-coveralls + - pip install cpp-coveralls PyYAML script: - mkdir build - cd build - - cmake -DUSE_SYSTEM_MSGPACK=OFF .. + - cmake -DUSE_SYSTEM_MSGPACK=OFF -DUSE_GCOV=ON .. - make - nvim --version - ctest --output-on-failure +#after_success: +# # collect coverage +# - cd $TRAVIS_BUILD_DIR +# - coveralls -y contrib/coveralls-travis.yml -E '.*/build/.*' -E '.*/third-party/.*' -E '.*/test/.*' -E '.*/bindings/.*' diff --git a/contrib/coveralls-circle.yml b/contrib/coveralls-circle.yml new file mode 100644 index 000000000..4bec845a3 --- /dev/null +++ b/contrib/coveralls-circle.yml @@ -0,0 +1,8 @@ +gcov_options: '\-lp' +root: '.' +build_root: 'build' +service_name: 'circle-ci' +# Do not set exclude rules as they skip running gcov entirely +# which is too broad https://github.com/eddyxu/cpp-coveralls/issues/145#issuecomment-521623753 +# instead check the travis recipe for post filters +#exclude: ['test', 'build', 'third-party'] diff --git a/contrib/coveralls-travis.yml b/contrib/coveralls-travis.yml new file mode 100644 index 000000000..e4848b29f --- /dev/null +++ b/contrib/coveralls-travis.yml @@ -0,0 +1,8 @@ +gcov_options: '\-lp' +root: '.' +build_root: 'build' +service_name: 'travis-ci' +# Do not set exclude rules as they skip running gcov entirely +# which is too broad https://github.com/eddyxu/cpp-coveralls/issues/145#issuecomment-521623753 +# instead check the travis recipe for post filters +#exclude: ['test', 'build', 'third-party']