Skip to content

Commit ea0b495

Browse files
committedNov 27, 2015
Use containers for Travis builds
1 parent 789def0 commit ea0b495

File tree

3 files changed

+81
-32
lines changed

3 files changed

+81
-32
lines changed
 

‎.travis.yml

+31-29
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,35 @@
1+
sudo: false
2+
13
language: cpp
24
compiler: gcc
3-
script: make all && make test && ./coverage.sh
45

5-
before_install:
6-
# g++ 4.8.1
7-
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
8-
- sudo apt-get update -qq
6+
addons:
7+
apt:
8+
sources:
9+
- ubuntu-toolchain-r-test
10+
packages:
11+
- g++-4.9
12+
- python-dev
13+
- libbz2-dev
14+
- zlib1g-dev
15+
- lcov
16+
- ruby
17+
- rubygems
18+
- doxygen
19+
20+
before_script:
21+
- ### install Boost
22+
- wget https://github.com/Viq111/travis-container-packets/releases/download/boost-1.57.0/boost.tar.bz2
23+
- tar -xjf boost.tar.bz2
24+
- rm boost.tar.bz2
25+
- export LIBRARY_PATH=$(pwd)/boost/lib:$LIBRARY_PATH
26+
- export LD_LIBRARY_PATH=$(pwd)/boost/lib:$LD_LIBRARY_PATH
27+
- export CPLUS_INCLUDE_PATH=$(pwd)/boost/include/:$CPLUS_INCLUDE_PATH
28+
- ### install lcov and coveralls
29+
- curl http://ftp.uk.debian.org/debian/pool/main/l/lcov/lcov_1.11.orig.tar.gz -O
30+
- tar xfz lcov_1.11.orig.tar.gz
31+
- mkdir -p lcov && make -C lcov-1.11/ install PREFIX=~/lcov
32+
- export PATH=~/lcov/usr/bin:$PATH
33+
- gem install coveralls-lcov
934

10-
install:
11-
# g++4.8.1, boost and lcov
12-
- sudo apt-get install -qq g++-4.8 python-dev libbz2-dev zlib1g-dev libcppunit-dev doxygen lcov ruby rubygems
13-
- export CC="gcc-4.8"
14-
- export CXX="g++-4.8"
15-
- pushd ~
16-
- mkdir Downloads
17-
- cd Downloads
18-
- curl ftp://ftp.ripcordsoftware.com/pub/boost_1_57_0-travis-ci.tar.bz2 -O
19-
- tar xfj boost_1_57_0-travis-ci.tar.bz2
20-
- pushd boost_1_57_0
21-
- sudo ./b2 --prefix=/usr -d0 install
22-
- popd
23-
- curl http://ftp.uk.debian.org/debian/pool/main/l/lcov/lcov_1.11.orig.tar.gz -O
24-
- tar xfz lcov_1.11.orig.tar.gz
25-
- sudo make -C lcov-1.11/ install
26-
- popd
27-
- gem install coveralls-lcov
28-
- sudo rm -f /usr/bin/g++
29-
- sudo rm -f /usr/bin/gcc
30-
- sudo rm -f /usr/bin/gcov
31-
- sudo ln -s /usr/bin/g++-4.8 /usr/bin/g++
32-
- sudo ln -s /usr/bin/gcc-4.8 /usr/bin/gcc
33-
- sudo ln -s /usr/bin/gcov-4.8 /usr/bin/gcov
35+
script: make all CXX=g++-4.9 && make test CXX=g++-4.9 && ./coverage.sh gcov-4.9

‎.travis.yml.old

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
language: cpp
2+
compiler: gcc
3+
script: make all && make test && ./coverage.sh
4+
5+
before_install:
6+
# g++ 4.8.1
7+
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
8+
- sudo apt-get update -qq
9+
10+
install:
11+
# g++4.8.1, boost and lcov
12+
- sudo apt-get install -qq g++-4.8 python-dev libbz2-dev zlib1g-dev libcppunit-dev doxygen lcov ruby rubygems
13+
- export CC="gcc-4.8"
14+
- export CXX="g++-4.8"
15+
- pushd ~
16+
- mkdir Downloads
17+
- cd Downloads
18+
- curl ftp://ftp.ripcordsoftware.com/pub/boost_1_57_0-travis-ci.tar.bz2 -O
19+
- tar xfj boost_1_57_0-travis-ci.tar.bz2
20+
- pushd boost_1_57_0
21+
- sudo ./b2 --prefix=/usr -d0 install
22+
- popd
23+
- curl http://ftp.uk.debian.org/debian/pool/main/l/lcov/lcov_1.11.orig.tar.gz -O
24+
- tar xfz lcov_1.11.orig.tar.gz
25+
- sudo make -C lcov-1.11/ install
26+
- popd
27+
- gem install coveralls-lcov
28+
- sudo rm -f /usr/bin/g++
29+
- sudo rm -f /usr/bin/gcc
30+
- sudo rm -f /usr/bin/gcov
31+
- sudo ln -s /usr/bin/g++-4.8 /usr/bin/g++
32+
- sudo ln -s /usr/bin/gcc-4.8 /usr/bin/gcc
33+
- sudo ln -s /usr/bin/gcov-4.8 /usr/bin/gcov

‎coverage.sh

+17-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
11
#!/bin/bash
2-
lcov -b src/libhttpserver --directory src/libhttpserver/build/Debug/GNU-Linux-x86/ --capture --output-file coverage.info
3-
lcov --remove coverage.info 'tests/*' '/usr/*' '*/externals/*' --output-file coverage.info
4-
lcov --list coverage.info
2+
3+
GCOV_TOOL=
4+
if [ "$1" != "" ]; then
5+
GCOV_TOOL="--gcov-tool $1"
6+
else
7+
which lcov > /dev/null
8+
if [ $? -ne 0 ]; then
9+
echo "You must have lcov installed to run this script."
10+
echo "Install with 'yum install lcov' or 'apt-get install lcov'"
11+
exit 1
12+
fi
13+
fi
14+
15+
lcov -b src/libhttpserver --directory src/libhttpserver/build/Debug/GNU-Linux-x86/ --capture --output-file coverage.info ${GCOV_TOOL}
16+
lcov --remove coverage.info 'tests/*' '/usr/*' '*/externals/*' '*/boost/*' --output-file coverage.info ${GCOV_TOOL}
17+
lcov --list coverage.info ${GCOV_TOOL}
18+
519
if [ "$CI" = "true" ] && [ "$TRAVIS" = "true" ]; then
620
coveralls-lcov coverage.info
721
else

0 commit comments

Comments
 (0)
Please sign in to comment.