Skip to content

Commit

Permalink
[CI] Fix coverage collection
Browse files Browse the repository at this point in the history
Binaries are build multiple times with different configurations.
Copying them into 1 folder will collapse that to one random
configuration.
Hence just use lcov to gather all data
  • Loading branch information
Flamefire committed Jul 14, 2020
1 parent f712b0c commit 9e9b5ed
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ addons:
- xsltproc
- docbook-xsl
- docbook-xml
- python-yaml
- lcov

before_install:
- DOCBOOK_XSL_DIR=/usr/share/xml/docbook/stylesheet/docbook-xsl
Expand Down Expand Up @@ -78,25 +80,14 @@ script:
- ctest --output-on-failure --build-config Debug

after_success:
- COVERALS_DIR=$PROJECT_DIR/coverals

# Copying Coveralls data to a separate folder
- mkdir -p $COVERALS_DIR
- find $PROJECT_DIR/test/bin/ -name "*.gcda" -exec cp "{}" $COVERALS_DIR/ \;
- find $PROJECT_DIR/test/bin/ -name "*.gcno" -exec cp "{}" $COVERALS_DIR/ \;

- cd $PROJECT_DIR
# Preparing Coveralls data by
# ... installing the tools
- sudo apt-get install -qq python-yaml lcov
# ... changing data format to a readable one
- lcov --directory $COVERALS_DIR --base-directory $PROJECT_DIR/test --capture --output-file $COVERALS_DIR/coverage.info

# ... erasing /test/ /example/ folder data
- lcov --remove $COVERALS_DIR/coverage.info "/usr*" "/test/*" $IGNORE_COVERAGE "tests/*" "*/doc/examples/*" -o $COVERALS_DIR/coverage.info
- lcov --directory "$PROJECT_DIR/test" --capture --output-file coverage.info
# ... erasing /test/ /doc/example/ folder data
- lcov --remove coverage.info "/usr*" $IGNORE_COVERAGE "*/test/*" "*/doc/example/*" -o coverage.info
# Output what was collected
- lcov --list $COVERALS_DIR/coverage.info

- lcov --list coverage.info
# Sending data to Coveralls
- cd $PROJECT_DIR
- gem install coveralls-lcov
- coveralls-lcov $COVERALS_DIR/coverage.info
- coveralls-lcov coverage.info

0 comments on commit 9e9b5ed

Please sign in to comment.