From 58dc393ce2af93c259ea6d0eae10a3c234a66036 Mon Sep 17 00:00:00 2001 From: equalsraf Date: Sat, 20 Jun 2020 14:20:39 +0100 Subject: [PATCH 1/3] Enable coveralls Travis/Circle CI cpp-coveralls is used to collect coverage and upload into coveralls.io. Service specific settings are loaded from yaml files in contrib. --- .circleci/config.yml | 9 ++++++++- .travis.yml | 8 +++++++- contrib/coveralls-circle.yml | 5 +++++ contrib/coveralls-travis.yml | 5 +++++ 4 files changed, 25 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 e9447fc628..fdbe41ba23 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 diff --git a/.travis.yml b/.travis.yml index 3b1c5e74fa..cece5c2605 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 diff --git a/contrib/coveralls-circle.yml b/contrib/coveralls-circle.yml new file mode 100644 index 0000000000..16a512f29a --- /dev/null +++ b/contrib/coveralls-circle.yml @@ -0,0 +1,5 @@ +gcov_options: '\-lp' +root: '.' +build_root: 'build' +service_name: 'circle-ci' +#exclude: ['test', 'build', 'third-party'] diff --git a/contrib/coveralls-travis.yml b/contrib/coveralls-travis.yml new file mode 100644 index 0000000000..8609c317d2 --- /dev/null +++ b/contrib/coveralls-travis.yml @@ -0,0 +1,5 @@ +gcov_options: '\-lp' +root: '.' +build_root: 'build' +service_name: 'travis-ci' +exclude: ['test', 'build', 'third-party'] From e5f1de923e52b789caf7e20948f9b7ef707797af Mon Sep 17 00:00:00 2001 From: equalsraf Date: Sun, 21 Jun 2020 19:20:29 +0100 Subject: [PATCH 2/3] fixup --- contrib/coveralls-circle.yml | 3 +++ contrib/coveralls-travis.yml | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/contrib/coveralls-circle.yml b/contrib/coveralls-circle.yml index 16a512f29a..4bec845a35 100644 --- a/contrib/coveralls-circle.yml +++ b/contrib/coveralls-circle.yml @@ -2,4 +2,7 @@ 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 index 8609c317d2..e4848b29f4 100644 --- a/contrib/coveralls-travis.yml +++ b/contrib/coveralls-travis.yml @@ -2,4 +2,7 @@ gcov_options: '\-lp' root: '.' build_root: 'build' service_name: 'travis-ci' -exclude: ['test', 'build', 'third-party'] +# 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'] From e0ca6944a0e352d2203bcedb986615124cc8a6c8 Mon Sep 17 00:00:00 2001 From: equalsraf Date: Sun, 21 Jun 2020 20:15:34 +0100 Subject: [PATCH 3/3] Set coveralls exclusion rules cpp-coveralls -e exclude rules prevent gcov from being executed, which is not what we need, e.g. https://github.com/eddyxu/cpp-coveralls/issues/145#issuecomment-521623753 we want to exclude from the coverage reports - autogenerated Qt/CMake code - test code - code from third-party/ This can be done as exclusion (python) regular expressions. --- .circleci/config.yml | 2 +- .travis.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fdbe41ba23..b1e9f64930 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -35,5 +35,5 @@ jobs: 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 + command: TRAVIS_JOB_ID="#${CIRCLE_BUILD_NUM}" ~/.local/bin/cpp-coveralls -y contrib/coveralls-travis.yml -E '.*/build/.*' -E '.*/third-party/.*' -E '.*/test/.*' diff --git a/.travis.yml b/.travis.yml index cece5c2605..02af3bb361 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,4 +24,4 @@ script: after_success: # collect coverage - cd $TRAVIS_BUILD_DIR - - coveralls -y contrib/coveralls-travis.yml + - coveralls -y contrib/coveralls-travis.yml -E '.*/build/.*' -E '.*/third-party/.*' -E '.*/test/.*'