Skip to content

Commit

Permalink
[geometry] Add CircleCI and Coveralls integration, add icons to the R…
Browse files Browse the repository at this point in the history
…EADME.
  • Loading branch information
awulkiew committed Jun 16, 2015
1 parent 3209b53 commit 3d61ca7
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ Boost.Geometry, part of collection of the [Boost C++ Libraries](http://github.co
* **index** - examples and tests for the Spatial Index
* **test** - Boost.Geometry unit tests

### Test results

@ | Build | Tests coverage | More info
----------------|-------------- | -------------- |-----------
Develop branch: | [![Build Status](https://img.shields.io/circleci/project/awulkiew/geometry/develop.png)](https://circleci.com/gh/awulkiew/geometry) | [![Coverage Status](https://coveralls.io/repos/awulkiew/geometry/badge.png?branch=develop%0A)](https://coveralls.io/r/awulkiew/geometry?branch=develop) | [details...](http://www.boost.org/development/tests/develop/developer/geometry.html)
Master branch: | - | - | [details...](http://www.boost.org/development/tests/master/developer/geometry.html)

### More information

* [Wiki](http://github.com/boostorg/geometry/wiki)
Expand Down
90 changes: 90 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Use, modification, and distribution are
# subject to the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
# Copyright Antony Polukhin 2014.
# Copyright Adam Wulkiewicz 2015.

machine:
environment:
BOOST_ROOT: boost-local
COVERAGE_DIR: $CIRCLE_ARTIFACTS
#COVERAGE_DIR: coverage

dependencies:
pre:
- mkdir $BOOST_ROOT
# on CircleCI it's impossible to switch working dir with cd
- cd $BOOST_ROOT && git init .
- cd $BOOST_ROOT && git remote add --no-tags -t $CIRCLE_BRANCH origin https://github.com/boostorg/boost.git
- cd $BOOST_ROOT && git fetch --depth=1
- cd $BOOST_ROOT && git checkout $CIRCLE_BRANCH
- cd $BOOST_ROOT && git submodule update --init --merge
- cd $BOOST_ROOT && git remote set-branches --add origin $CIRCLE_BRANCH
- cd $BOOST_ROOT && git pull --recurse-submodules
- cd $BOOST_ROOT && git submodule update --init
- cd $BOOST_ROOT && git checkout $CIRCLE_BRANCH
- cd $BOOST_ROOT && git submodule foreach "git reset --quiet --hard; git clean -fxd"
- cd $BOOST_ROOT && git reset --hard; git clean -fxd
- cd $BOOST_ROOT && git status
- cd $BOOST_ROOT && rm -rf libs/geometry/
- mkdir $BOOST_ROOT/libs/geometry
- cp -R `ls -A | grep -v $BOOST_ROOT` $BOOST_ROOT/libs/geometry/
- cd $BOOST_ROOT && ./bootstrap.sh
- cd $BOOST_ROOT && ./b2 headers

test:
override:
# `--coverage` flags required to generate coverage info for Coveralls
# temporary for test purposes
- cd $BOOST_ROOT/libs/geometry && ../../b2 cxxflags="--coverage" linkflags="--coverage" test/algorithms/detail
#- cd $BOOST_ROOT/libs/geometry && ../../b2 cxxflags="--coverage" linkflags="--coverage" test
#- cd $BOOST_ROOT/libs/geometry && ../../b2 cxxflags="--coverage" linkflags="--coverage" index/test/algorithms
#- cd $BOOST_ROOT/libs/geometry && ../../b2 cxxflags="--coverage" linkflags="--coverage" index/test/rtree/exceptions
post:
## Copying Coveralls data to a separate folder
- find $BOOST_ROOT/bin.v2/ -name "*.gcda" -exec cp "{}" $COVERAGE_DIR \;
- find $BOOST_ROOT/bin.v2/ -name "*.gcno" -exec cp "{}" $COVERAGE_DIR \;

## Preparing Coveralls data by
## ... installing the tools
- sudo apt-get install -qq python-yaml lcov

# TEST
- find $BOOST_ROOT/bin.v2/ \( -name "*.gcda" -o -name "*.gcno" \) -exec ls "{}" \;
- find $BOOST_ROOT/bin.v2/ -name "*.gcno" -execdir lcov --directory . --base-directory $BOOST_ROOT/libs/geometry --capture --output-file ./coverage.info \;

## ... changind data format to a readable one
- cd $BOOST_ROOT/libs/geometry && lcov --directory $COVERAGE_DIR --base-directory ./ --capture --output-file $COVERAGE_DIR/coverage.info

## ... erasing /test/ /example/ folder data
- lcov --remove $COVERAGE_DIR/coverage.info "/usr*" -o $COVERAGE_DIR/coverage.info
- lcov --remove $COVERAGE_DIR/coverage.info "*/geometry/test/*" "*/geometry/example/*" "*/geometry/*/test/*" "*/geometry/*/example/*" -o $COVERAGE_DIR/coverage.info

## ... erasing data that is not related to this project directly
# method 1 - doesn't work on CircleCI, and not all directories are filtered
#- grep "submodule .*" $BOOST_ROOT/.gitmodules | sed 's/\[submodule\ "\(.*\)"\]/"\*\/boost\/\1\.hpp" "\*\/boost\/\1\/\*"/g'| sed "/\"\*\/boost\/geometry\/\*\"/d" | sed ':a;N;$!ba;s/\n/ /g'
#- lcov --remove $COVERAGE_DIR/coverage.info `grep "submodule .*" $BOOST_ROOT/.gitmodules | sed 's/\[submodule\ "\(.*\)"\]/"\*\/boost\/\1\.hpp" "\*\/boost\/\1\/\*"/g'| sed "/\"\*\/boost\/geometry\/\*\"/d" | sed ':a;N;$!ba;s/\n/ /g'` -o $COVERAGE_DIR/coverage.info

## ... method 2.1 - doesn't work on CircleCI
#- ls $BOOST_ROOT/boost | sed -r '/(geometry.*)/d' | sed -r 's/(.+)/"*\/boost\/\1\/*"/g' | sed -r 's/(.+\.hpp)\/\*/\1/g' | sed ':a;N;$!ba;s/\n/ /g'
#- lcov --remove $COVERAGE_DIR/coverage.info `ls $BOOST_ROOT/boost | sed -r '/(geometry.*)/d' | sed -r 's/(.+)/"*\/boost\/\1\/*"/g' | sed -r 's/(.+\.hpp)\/\*/\1/g' | sed ':a;N;$!ba;s/\n/ /g'` -o $COVERAGE_DIR/coverage.info
## ... method 2.2 - doesn't work on CircleCI
#- ls $BOOST_ROOT/boost | sed -r '/(geometry.*)/d' | sed -r 's/(.+)/"*\/boost\/\1\/*"/g' | sed -r 's/(.+\.hpp)\/\*/\1/g' | sed ':a;N;$!ba;s/\n/ /g' > $COVERAGE_DIR/other_libs.txt
#- lcov --remove $COVERAGE_DIR/coverage.info `cat $COVERAGE_DIR/other_libs.txt` -o $COVERAGE_DIR/coverage.info

## ... method 3
- ls $BOOST_ROOT/boost | sed -r '/(geometry.*)/d' | sed -r 's/(.+)/"*\/boost\/\1\/*"/g' | sed -r 's/(.+\.hpp)\/\*/\1/g' | sed ':a;N;$!ba;s/\n/ /g' | xargs lcov --remove $COVERAGE_DIR/coverage.info -o $COVERAGE_DIR/coverage.info

## ... sanity check
- ls -lah $COVERAGE_DIR

## Sending data to Coveralls
- gem install coveralls-lcov

## ... convert data with coveralls-lcov
# used only for test purposes
- coveralls-lcov -v -n $COVERAGE_DIR/coverage.info > $COVERAGE_DIR/coverage.json

## ... send
- coveralls-lcov --repo-token=$COVERALLS_REPO_TOKEN $COVERAGE_DIR/coverage.info

0 comments on commit 3d61ca7

Please sign in to comment.