-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy path.travis.yml
126 lines (118 loc) · 3.58 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
git:
depth: 10
branches:
except:
gh-pages
install:
# /usr/bin/gcc is 4.6 always, but gcc-X.Y is available.
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi
# /usr/bin/clang is 3.4, lets override with modern one.
- if [ "$CXX" = "clang++" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then export CXX="clang++-3.7" CC="clang-3.7"; fi
- echo ${PATH}
- echo ${CXX}
- ${CXX} --version
- ${CXX} -v
# Installing lcov
- |
if [[ ( $TRAVIS_OS_NAME = linux ) && ( $CXX = g++-4.9 ) ]]; then
cd ${TRAVIS_BUILD_DIR}
wget http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.13.orig.tar.gz
tar xf lcov_1.13.orig.tar.gz
cd lcov-1.13/
sudo make install
cd ..
sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-4.9 90
fi
addons:
apt:
# List of whitelisted in travis packages for ubuntu-precise can be found here:
# https://github.com/travis-ci/apt-package-whitelist/blob/master/ubuntu-precise
# List of whitelisted in travis apt-sources:
# https://github.com/travis-ci/apt-source-whitelist/blob/master/ubuntu.json
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.7
packages:
- gcc-4.9
- g++-4.9
- clang-3.7
- lcov
os:
- linux
- osx
language: cpp
compiler:
- gcc
- clang
script:
- mkdir build && cd build
- |
if [[ ( $TRAVIS_OS_NAME = linux ) && ( $CXX = g++-4.9 ) ]]; then
cmake .. -DTESTING=1 -DSAMPLES=0 -DCOVERAGE=1 -DCMAKE_BUILD_TYPE=Debug
else
cmake .. -DTESTING=1 -DSAMPLES=0 -DCMAKE_BUILD_TYPE=Debug
fi
- make -j4
- CTEST_OUTPUT_ON_FAILURE=1 make test
notifications:
email: false
sudo: required
after_success: |
if [[ ( $TRAVIS_OS_NAME = linux ) && ( $CXX = g++-4.9 ) ]]; then
cd $TRAVIS_BUILD_DIR
if [[ $TRAVIS_PULL_REQUEST = false ]]; then
chmod +x generateDocument.sh
./generateDocument.sh
touch docs/.nojekyll
fi
lcov --directory . --capture --output-file coverage.info # capture coverage info
lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter out system
lcov --remove coverage.info '*tests/*' --output-file coverage.info # filter out test
lcov --list coverage.info #debug info
# Uploading report to CodeCov
bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"
fi
cd $TRAVIS_BUILD_DIR/build
OS_NAME=$TRAVIS_OS_NAME
if [[ "$TRAVIS_OS_NAME" = "osx" ]]; then
OS_NAME=macos
fi
if [ $TRAVIS_TAG ]; then
mkdir release && cd release
cmake ../.. -DTESTING=0 -DCMAKE_BUILD_TYPE=Release
make -j4
if [[ "$CXX" == "g++-4.9" ]]; then
CC="gcc"
fi
if [[ "$CXX" = "clang++-3.7" ]]; then
CC="clang"
fi
cp -r ../../src/include ./include
mkdir lib
mv libcuhkszlib.a lib/libcuhkszlib.a
tar -czvf $OS_NAME-$CC.tar.gz lib include
if [[ (( $TRAVIS_OS_NAME = linux ) && ( $CXX = g++-4.9 )) || (( $TRAVIS_OS_NAME = osx ) && ( $CXX = clang++ ))]]; then
rm -rf samples/*.cmake
rm -rf samples/Makefile
rm -rf samples/CMakeFiles
tar -czvf $OS_NAME-samples.tar.gz samples/*
fi
fi
deploy:
- provider: pages
skip_cleanup: true
github_token: $GITHUB_TOKEN # Set in travis-ci.org dashboard
on:
branch:
master
condition: " (( $TRAVIS_OS_NAME = linux ) && ( $CXX = g++-4.9 ) && ($GITHUB_TOKEN)) "
local_dir: $TRAVIS_BUILD_DIR/docs
- provider: releases
skip_cleanup: true
api_key: $RELEASE_TOKEN
file_glob: true
file: "*.tar.gz"
on:
all_branches: true
condition: " ($TRAVIS_TAG) "
tag: true