@@ -5,10 +5,220 @@ language: cpp
5
5
os :
6
6
- linux
7
7
8
- matrix :
8
+ cache :
9
+ directories :
10
+ - $HOME/cache
11
+ - $HOME/.ccache
12
+ - $HOME/Library/Caches/Homebrew
13
+
14
+ stages :
15
+ - prepare linux
16
+ - test # Default stage with matrix
17
+ - osx
18
+ - deploy
19
+
20
+ addons :
21
+ apt :
22
+ sources :
23
+ - sourceline : ' ppa:nschloe/eigen-backports'
24
+ - sourceline : ' deb http://www.icub.org/ubuntu trusty contrib/science'
25
+ packages :
26
+ - cmake3
27
+ - ninja-build
28
+ # YARP / iCub / wb-toolbox
29
+ - icub-common
30
+ - libqt5opengl5-dev
31
+ - libeigen3-dev
32
+
33
+ compiler :
34
+ - gcc
35
+ - clang
36
+
37
+ env :
38
+ global : TRAVIS_CMAKE_GENERATOR="Ninja"
39
+ matrix :
40
+ - TRAVIS_BUILD_TYPE="Release"
41
+ - TRAVIS_BUILD_TYPE="Debug"
42
+
43
+ # ==============
44
+ # STAGE: prepare
45
+ # ==============
46
+
47
+ stage_prepare :
48
+ script : &prepare_script
49
+ # Clean the dependencies cache from previous builds (ccache is instead kept)
50
+ - rm -rf $DEPS_CACHE
51
+ - mkdir -p $DEPS_CACHE
52
+
53
+ # Install dependencies
54
+ # --------------------
55
+
56
+ # Limit concurrency for some project in order to avoid let the CI fail
57
+ - if [ "$TRAVIS_OS_NAME" == "linux" ] ; then CMAKE_BUILD_OPTIONS="-- -j4" ; fi
58
+ - if [ "$TRAVIS_OS_NAME" == "osx" ] ; then CMAKE_BUILD_OPTIONS="" ; fi
59
+
60
+ - mkdir $HOME/git
61
+ - export CXXFLAGS="-Wno-unused-command-line-argument"
62
+
63
+ # Install YCM
64
+ - cd $HOME/git
65
+ - git clone --depth 1 https://github.com/robotology/ycm.git
66
+ - cd ycm
67
+ - mkdir build && cd build
68
+ - >-
69
+ cmake .. \
70
+ -G"$TRAVIS_CMAKE_GENERATOR" \
71
+ -DCMAKE_INSTALL_PREFIX=$DEPS_CACHE
72
+ - cmake --build . --target install
73
+
74
+ # Install Yarp
75
+ - cd $HOME/git
76
+ - git clone --depth 1 https://github.com/robotology/yarp.git
77
+ - cd yarp
78
+ - mkdir build && cd build
79
+ - >-
80
+ cmake .. \
81
+ -G"$TRAVIS_CMAKE_GENERATOR" \
82
+ -DCMAKE_BUILD_TYPE=$TRAVIS_BUILD_TYPE \
83
+ -DCMAKE_INSTALL_PREFIX=$DEPS_CACHE \
84
+ -DCREATE_LIB_MATH=ON
85
+ - cmake --build . --config $TRAVIS_BUILD_TYPE --target install
86
+
87
+ # Install icub-main
88
+ - cd $HOME/git
89
+ - git clone --depth 1 https://github.com/robotology/icub-main.git
90
+ - cd icub-main
91
+ - mkdir build && cd build
92
+ - >-
93
+ cmake .. \
94
+ -G"$TRAVIS_CMAKE_GENERATOR" \
95
+ -DCMAKE_BUILD_TYPE=$TRAVIS_BUILD_TYPE \
96
+ -DCMAKE_INSTALL_PREFIX=$DEPS_CACHE
97
+ - cmake --build . --config $TRAVIS_BUILD_TYPE --target install $CMAKE_BUILD_OPTIONS
98
+
99
+ # Install iDynTree
100
+ - cd $HOME/git
101
+ - git clone --depth 1 https://github.com/robotology/idyntree.git
102
+ - cd idyntree
103
+ - mkdir build && cd build
104
+ - >-
105
+ cmake .. \
106
+ -G"$TRAVIS_CMAKE_GENERATOR" \
107
+ -DCMAKE_BUILD_TYPE=$TRAVIS_BUILD_TYPE \
108
+ -DCMAKE_INSTALL_PREFIX=$DEPS_CACHE
109
+ - cmake --build . --config $TRAVIS_BUILD_TYPE --target install $CMAKE_BUILD_OPTIONS
110
+
111
+ # ===================
112
+ # STAGE: test (linux)
113
+ # ===================
114
+
115
+ before_install : &before_install
116
+ # Prepare ccache
117
+ - mkdir -p $HOME/.local/bin
118
+ - ln -s $(which ccache) $HOME/.local/bin/$CC
119
+ - ln -s $(which ccache) $HOME/.local/bin/$CXX
120
+ - export PATH=/$HOME/.local/bin:$PATH
121
+ - echo "max_size = 1.0G" > $HOME/.ccache/ccache.conf
122
+ # Setup the dependencies cache
123
+ - export DEPS_CACHE=$HOME/cache/$TRAVIS_OS_NAME/$TRAVIS_BUILD_TYPE
124
+ - export PATH=$PATH:$DEPS_CACHE/bin
125
+ - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$DEPS_CACHE/lib
126
+ - export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH:$DEPS_CACHE
127
+
128
+ script : &script
129
+ - cd $TRAVIS_BUILD_DIR
130
+ - mkdir build && cd build
131
+ - cmake -G"$TRAVIS_CMAKE_GENERATOR" -DCMAKE_BUILD_TYPE=$TRAVIS_BUILD_TYPE ..
132
+ - cmake --build . --config $TRAVIS_BUILD_TYPE
133
+
134
+ before_cache : &before_cache
135
+ - before_cache : rm -rf $DEPS_CACHE
136
+
137
+ # ==========
138
+ # STAGE: osx
139
+ # ==========
140
+
141
+ stage_osx :
142
+ before_install : &osx_before_install
143
+ # Setup the dependencies cache
144
+ - export DEPS_CACHE=$HOME/cache/$TRAVIS_OS_NAME/$TRAVIS_BUILD_TYPE
145
+ - export PATH=$PATH:$DEPS_CACHE/bin
146
+ - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$DEPS_CACHE/lib
147
+ - export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH:$DEPS_CACHE
148
+ install : &osx_install
149
+ # Setup ccache
150
+ - brew install ccache
151
+ - export PATH="/usr/local/opt/ccache/libexec:$PATH"
152
+ # Install dependencies
153
+ - brew install eigen ace tinyxml gsl
154
+
155
+ # =============
156
+ # STAGE: deploy
157
+ # =============
158
+
159
+ stage_deploy :
160
+ install : &deploy_install
161
+ - pip3 install --user Pygments mkdocs mkdocs-material
162
+ - export PATH=$HOME/.local/bin:$PATH
163
+ script : &deploy_script
164
+ - ./$TRAVIS_BUILD_DIR/.ci/generateDocumentation.sh
165
+
166
+ # after_success: &after_success_deploy
167
+ # - ./$PROJECT_DIR_ABS/.ci/generateDocumentation.sh || travis_terminate 1
168
+
169
+ # ======================
170
+ # BUILD JOBS FROM STAGES
171
+ # ======================
172
+
173
+ jobs :
9
174
include :
10
- # Enable a job for building the documentation
11
- - os : linux
175
+ - &prepare_template
176
+ stage : prepare linux
177
+ before_install : *before_install
178
+ install : skip
179
+ script : *prepare_script
180
+ before_cache : skip
181
+ compiler : clang
182
+ env :
183
+ TRAVIS_BUILD_TYPE="Release"
184
+ - << : *prepare_template
185
+ compiler : gcc
186
+ - << : *prepare_template
187
+ compiler : clang
188
+ env :
189
+ TRAVIS_BUILD_TYPE="Debug"
190
+ - << : *prepare_template
191
+ compiler : gcc
192
+ env :
193
+ TRAVIS_BUILD_TYPE="Debug"
194
+ - &osx_template
195
+ stage : osx
196
+ os : osx
197
+ compiler : clang
198
+ osx_image : xcode9.3
199
+ before_install : *osx_before_install
200
+ install : *osx_install
201
+ before_script : *prepare_script
202
+ script : *script
203
+ before_cache : skip
204
+ env :
205
+ TRAVIS_CMAKE_GENERATOR="Xcode"
206
+ TRAVIS_BUILD_TYPE="Debug"
207
+ - << : *osx_template
208
+ env :
209
+ TRAVIS_CMAKE_GENERATOR="Unix Makefiles"
210
+ TRAVIS_BUILD_TYPE="Debug"
211
+ - stage : deploy
212
+ compiler :
213
+ cache :
214
+ if : ((branch = master) AND (type != pull_request))
215
+ before_install : skip
216
+ install : *deploy_install
217
+ before_script : skip
218
+ script : *deploy_script
219
+ before_cache : skip
220
+ # after_success: &deploy_after_success
221
+ after_success : skip
12
222
env :
13
223
TRAVIS_BUILD_DOCS=true
14
224
GIT_COMMITTER_USERNAME=LOC2Bot
@@ -25,26 +235,6 @@ matrix:
25
235
- graphviz
26
236
- python3-pip
27
237
28
- before_install :
29
- # Install documentation dependencies
30
- - >-
31
- if [[ "$TRAVIS_BRANCH" = "master" && -n "$TRAVIS_BUILD_DOCS" && "$TRAVIS_PULL_REQUEST" = "false" ]] ; then
32
- pip3 install --user Pygments mkdocs mkdocs-material || travis_terminate 1
33
- export PATH=$HOME/.local/bin:$PATH
34
- fi
35
-
36
- # before_script:
37
- script :
38
- # Right now Travis only builds the documentation
39
- - true
40
-
41
- after_success :
42
- # Generate the docs only if master, the TRAVIS_BUILD_DOCS is true and we can use secure variables
43
- - >-
44
- if [[ "$TRAVIS_BRANCH" = "master" && -n "$TRAVIS_BUILD_DOCS" && "$TRAVIS_PULL_REQUEST" = "false" ]] ; then
45
- ./$PROJECT_DIR_ABS/.ci/generateDocumentation.sh || travis_terminate 1
46
- fi
47
-
48
238
# notifications:
49
239
# email:
50
240
0 commit comments