]>
Commit | Line | Data |
---|---|---|
1 | # Use, modification, and distribution are | |
2 | # subject to the Boost Software License, Version 1.0. (See accompanying | |
3 | # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
4 | # | |
5 | # Copyright Antony Polukhin 2014. | |
6 | # Copyright Adam Wulkiewicz 2015-2016. | |
7 | ||
8 | general: | |
9 | branches: | |
10 | only: | |
11 | - master | |
12 | - develop | |
13 | - test | |
14 | ||
15 | machine: | |
16 | environment: | |
17 | # define tests list, if parallelism is enabled they are run in parallel | |
18 | TESTS: test index/test | |
19 | ||
20 | # this is not fully bulletproof, ideally one should check | |
21 | # if the current branch originates in master or develop | |
22 | # but it's good enough | |
23 | # test library using corresponding branch of Boost repository | |
24 | BOOST_BRANCH: $([[ "$CIRCLE_BRANCH" = "master" ]] && echo master || echo develop) | |
25 | ||
26 | # required directories | |
27 | BOOST_DIR: boost-local | |
28 | COVERAGE_DIR: coverage-local | |
29 | ||
30 | # helper variables | |
31 | PROJECT_ROOT: $HOME/$CIRCLE_PROJECT_REPONAME | |
32 | BOOST_ROOT: $PROJECT_ROOT/$BOOST_DIR | |
33 | COVERAGE_ROOT: $PROJECT_ROOT/$COVERAGE_DIR | |
34 | #COVERAGE_ROOT: $CIRCLE_ARTIFACTS | |
35 | ||
36 | dependencies: | |
37 | pre: | |
38 | - sudo apt-get update | |
39 | ||
40 | # gcc, g++, gcov | |
41 | - sudo apt-get install gcc-4.9 g++-4.9 build-essential | |
42 | #- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 10 | |
43 | #- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 10 | |
44 | - sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-4.9 10 | |
45 | #- sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 20 | |
46 | #- sudo update-alternatives --set cc /usr/bin/gcc | |
47 | #- sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 20 | |
48 | #- sudo update-alternatives --set c++ /usr/bin/g++ | |
49 | #- sudo update-alternatives --config gcc | |
50 | #- sudo update-alternatives --config g++ | |
51 | - sudo update-alternatives --config gcov | |
52 | ||
53 | # coveralls-lcov for lcov *.info to JSON conversion | |
54 | - gem install coveralls-lcov | |
55 | ||
56 | # jq for JSON handling | |
57 | - sudo apt-get install jq | |
58 | ||
59 | # curl for HTTP | |
60 | - sudo apt-get install curl | |
61 | ||
62 | # clone boost repository | |
63 | - mkdir $BOOST_ROOT | |
64 | - cd $BOOST_ROOT && git init . | |
65 | - cd $BOOST_ROOT && git remote add --no-tags -t $BOOST_BRANCH origin https://github.com/boostorg/boost.git | |
66 | - cd $BOOST_ROOT && git fetch --depth=1 | |
67 | - cd $BOOST_ROOT && git checkout $BOOST_BRANCH | |
68 | - cd $BOOST_ROOT && git submodule update --init --merge | |
69 | - cd $BOOST_ROOT && git remote set-branches --add origin $BOOST_BRANCH | |
70 | - cd $BOOST_ROOT && git pull --recurse-submodules | |
71 | - cd $BOOST_ROOT && git submodule update --init | |
72 | - cd $BOOST_ROOT && git checkout $BOOST_BRANCH | |
73 | - cd $BOOST_ROOT && git submodule foreach "git reset --quiet --hard; git clean -fxd" | |
74 | - cd $BOOST_ROOT && git reset --hard; git clean -fxd | |
75 | - cd $BOOST_ROOT && git status | |
76 | # replace the content of the library with the currently tested repo | |
77 | - cd $BOOST_ROOT && rm -rf libs/geometry/ | |
78 | - mkdir $BOOST_ROOT/libs/geometry | |
79 | - cp -R `ls -A | grep -v $BOOST_DIR` $BOOST_ROOT/libs/geometry/ | |
80 | # build b2 and create headers | |
81 | - cd $BOOST_ROOT && ./bootstrap.sh | |
82 | - cd $BOOST_ROOT && ./b2 headers | |
83 | ||
84 | # wait with the modifications of the project directory until now | |
85 | # to avoid copying into the $BOOST_ROOT/libs/geometry/ | |
86 | ||
87 | # download and install the latest lcov | |
88 | # do not use the old one from sources | |
89 | - wget http://downloads.sourceforge.net/ltp/lcov-1.12.tar.gz | |
90 | - tar xvzf lcov-1.12.tar.gz | |
91 | - cd lcov-1.12 && sudo make install | |
92 | ||
93 | # create a direcotry for temporary coverage data | |
94 | - if [ ! -d $COVERAGE_ROOT ]; then mkdir $COVERAGE_ROOT; fi | |
95 | ||
96 | test: | |
97 | override: | |
98 | # `--coverage` flags required to generate coverage info for Coveralls | |
99 | # temporary for test purposes | |
100 | #- cd $BOOST_ROOT/libs/geometry && ../../b2 cxxflags="--coverage" linkflags="--coverage" test/algorithms | |
101 | #- cd $BOOST_ROOT/libs/geometry && ../../b2 cxxflags="--coverage" linkflags="--coverage" test/algorithms/detail | |
102 | #- cd $BOOST_ROOT/libs/geometry && ../../b2 cxxflags="--coverage" linkflags="--coverage" test/algorithms/relational_operations | |
103 | #- cd $BOOST_ROOT/libs/geometry && ../../b2 cxxflags="--coverage" linkflags="--coverage" test | |
104 | #- cd $BOOST_ROOT/libs/geometry && ../../b2 cxxflags="--coverage" linkflags="--coverage" index/test/algorithms | |
105 | #- cd $BOOST_ROOT/libs/geometry && ../../b2 cxxflags="--coverage" linkflags="--coverage" index/test/rtree/exceptions | |
106 | # this is the first step of the first approach to automatic balancing | |
107 | # the problem is that first the upper-level dir is handled | |
108 | # then the tests from lower dir are executed, so the tests in various containers overlap | |
109 | #- cd $BOOST_ROOT/libs/geometry && index=0 ; run_tests() { for i in "$1"/* ; do if [ -f "$i"/Jamfile* ] ; then ((index++)) ; echo "$index - $i" ; ../../b2 cxxflags="--coverage" linkflags="--coverage" "$i" ; run_tests "$i" ; fi ; done } ; run_tests test | |
110 | ||
111 | # so for now just run the tests from the list | |
112 | - cd $BOOST_ROOT/libs/geometry && status=0; index=0 ; for t in ${TESTS[@]} ; do if [ $(((index++)%CIRCLE_NODE_TOTAL)) == $CIRCLE_NODE_INDEX ] ; then ../../b2 cxxflags="--coverage" linkflags="--coverage" $t ; fi || status=$? ; done ; exit $status : | |
113 | parallel: true | |
114 | ||
115 | post: | |
116 | ## Copying Coveralls data to a separate folder | |
117 | #- find $BOOST_ROOT/bin.v2/ -name "*.gcda" -exec mv "{}" $COVERAGE_ROOT \; | |
118 | #- find $BOOST_ROOT/bin.v2/ -name "*.gcno" -exec mv "{}" $COVERAGE_ROOT \; | |
119 | # upgraded version - change the file name if exists | |
120 | - find $BOOST_ROOT/bin.v2/ -name "*.gcda" -exec bash -c 'filen=$(basename $1) ; filen=${filen%.*} ; dirn=$(dirname $1) ; dstfilen=$filen ; while [ -f $COVERAGE_ROOT/$dstfilen.gcda ]; do dstfilen=$filen.$RANDOM ; done ; mv $dirn/$filen.gcda $COVERAGE_ROOT/$dstfilen.gcda ; mv $dirn/$filen.gcno $COVERAGE_ROOT/$dstfilen.gcno ; echo $dstfilen' bash "{}" \; : | |
121 | parallel: true | |
122 | ||
123 | ## Preparing Coveralls data by | |
124 | ||
125 | ## ... changind data format to a readable one | |
126 | ||
127 | - cd $BOOST_ROOT/libs/geometry && lcov --directory $COVERAGE_ROOT --base-directory ./ --capture --output-file $COVERAGE_ROOT/coverage.info : | |
128 | parallel: true | |
129 | ||
130 | ## ... erasing /usr and unneeded directories data | |
131 | - lcov --remove $COVERAGE_ROOT/coverage.info "/usr*" "*/libs/geometry/*" -o $COVERAGE_ROOT/coverage.info : | |
132 | parallel: true | |
133 | ||
134 | ## ... erasing data that is not related to this project directly | |
135 | - 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_ROOT/coverage.info -o $COVERAGE_ROOT/coverage.info : | |
136 | parallel: true | |
137 | ||
138 | ## ... sanity check | |
139 | - ls -lah $COVERAGE_ROOT : | |
140 | parallel: true | |
141 | ||
142 | ## Sending data to Coveralls | |
143 | ||
144 | ## ... gather all files in one container | |
145 | - if [ $CIRCLE_NODE_INDEX = 0 ]; then mv $COVERAGE_ROOT/coverage.info $COVERAGE_ROOT/coverage0.info ; else scp $COVERAGE_ROOT/coverage.info node0:$COVERAGE_ROOT/coverage$CIRCLE_NODE_INDEX.info ; fi : | |
146 | parallel: true | |
147 | ||
148 | ## ... merge info files | |
149 | - lcov `ls $COVERAGE_ROOT/coverage*.info | sed -r 's/(.+)/--add-tracefile \1/g'` -o $COVERAGE_ROOT/coverage.info | |
150 | ||
151 | ## ... handle sending manually | |
152 | ## ... convert data with coveralls-lcov | |
153 | - coveralls-lcov --repo-token=$COVERALLS_REPO_TOKEN -v -n $COVERAGE_ROOT/coverage.info > $COVERAGE_ROOT/coverage.json #: | |
154 | #parallel: true | |
155 | ||
156 | ## ... alter the json file | |
157 | - jq -c ".service_name = \"circle-ci\" | .service_number = \"$CIRCLE_BUILD_NUM\" | .git .branch =\"$CIRCLE_BRANCH\"" $COVERAGE_ROOT/coverage.json > $COVERAGE_ROOT/processed.json | |
158 | #- jq -c ".service_name = \"circle-ci\" | .service_number = \"$CIRCLE_BUILD_NUM\" | .parallel = true | .git .branch =\"$CIRCLE_BRANCH\"" $COVERAGE_ROOT/coverage.json > $COVERAGE_ROOT/processed.json #: | |
159 | #parallel: true | |
160 | ||
161 | ## ... send it to Coveralls | |
162 | - curl --retry 3 -F "json_file=@$COVERAGE_ROOT/processed.json" 'https://coveralls.io/api/v1/jobs' #: | |
163 | #parallel: true | |
164 | ||
165 | ## ... notify Coveralls that the parallel build has ended | |
166 | # this doesn't work - Coveralls returns an error | |
167 | #- echo "{\"payload\":{\"build_num\":\"$CIRCLE_BUILD_NUM\",\"status\":\"done\"}}" > $COVERAGE_ROOT/payload.json && curl --retry 3 -F "json_file=@$COVERAGE_ROOT/payload.json" "https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN" | |
168 | #- echo "{\"payload\":{\"build_num\":\"$CIRCLE_BUILD_NUM\",\"status\":\"done\"}}" > $COVERAGE_ROOT/payload.json && curl --retry 3 -d "@$COVERAGE_ROOT/payload.json" "https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN" | |
169 | ||
170 | ## This doesn't work - no effect | |
171 | #notify: | |
172 | # webhooks: | |
173 | # Notify Coveralls that the build has ended | |
174 | #- url: https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN |