forked from eclipse-cyclonedds/cyclonedds-cxx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
229 lines (216 loc) · 8.83 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
language: cpp
# Coverity Scan can be configured through Travis addons, but this allows for
# more control over the build instructions and does not require the addition
# of a coverity_scan branch in the repository. travisci_build_coverity_scan.sh
# does more checks before it decides to download Coverity (around 500M), but
# these instructions assume Coverity Scan is not installed if the directory
# does not exist and expects the download to fail if the token is incorrect.
# Coverity Scan quota are not checked as the Coverity enabled build must only
# run from cron.
install_coverity: &install_coverity
if [ "${COVERITY_SCAN}" = "true" ]; then
COV_DIR="/tmp/coverity-scan-analysis";
COV_ARC="/tmp/cov-analysis-${COV_PLATFORM}.tgz";
test ! -d "${COV_DIR}" &&
mkdir -p "${COV_DIR}" &&
curl -s -S -F project="${TRAVIS_REPO_SLUG}"
-F token="${COVERITY_SCAN_TOKEN}"
-o "${COV_ARC}"
"https://scan.coverity.com/download/cxx/${COV_PLATFORM}" &&
tar -xzf "${COV_ARC}" -C "${COV_DIR}";
COV_ANALYSIS=$(find "${COV_DIR}" -type d -name "cov-analysis*");
eval "export PATH=\"${PATH}:${COV_ANALYSIS}/bin\"";
eval "export SCAN_BUILD=\"cov-build --dir cov-int\"";
cov-configure --comptype ${COV_COMPTYPE} --compiler ${CC} --template;
fi
submit_to_coverity_scan: &submit_to_coverity_scan
if [ "${COVERITY_SCAN}" = "true" ]; then
tar -czf analysis-results.tgz cov-int &&
curl -s -S -F project="${TRAVIS_REPO_SLUG}"
-F token="${COVERITY_SCAN_TOKEN}"
-F version=$(git rev-parse --short HEAD)
-F description="Travis CI build"
-F email="${COVERITY_SCAN_EMAIL:[email protected]}"
"https://scan.coverity.com/builds";
fi
# Coverity Scan does not support GCC 10 yet.
ubuntu1804_gcc7: &ubuntu1804_gcc7
os: linux
dist: bionic
compiler: gcc
addons:
apt:
update: true
before_install:
- eval "export CC=gcc CXX=g++"
- eval "export COV_COMPTYPE=gcc COV_PLATFORM=linux64"
- eval "export BUILD_TOOL_OPTIONS='-j 4'"
- eval "export GENERATOR='Unix Makefiles'"
install:
- *install_coverity
- pip install conan --upgrade --user
ubuntu1804_gcc10: &ubuntu1804_gcc10
os: linux
dist: bionic
compiler: gcc
addons:
apt:
update: true
sources:
- sourceline: 'ppa:ubuntu-toolchain-r/test'
packages: [ gcc-10 g++-10 ]
before_install:
- eval "export CC=gcc-10 CXX=g++-10"
- eval "export COV_COMPTYPE=gcc COV_PLATFORM=linux64"
- eval "export BUILD_TOOL_OPTIONS='-j 4'"
- eval "export GENERATOR='Unix Makefiles'"
install:
- pip install conan --upgrade --user
ubuntu1804_clang10: &ubuntu1804_clang10
os: linux
dist: bionic
compiler: clang
addons:
apt:
update: true
sources:
- sourceline: 'deb https://apt.llvm.org/bionic llvm-toolchain-bionic-10 main'
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
packages: [ clang-10 clang++-10 ]
before_install:
- eval "export CC=clang-10 CXX=clang++-10"
- eval "export COV_COMPTYPE=clang COV_PLATFORM=linux64"
- eval "export BUILD_TOOL_OPTIONS='-j 4'"
- eval "export GENERATOR='Unix Makefiles'"
install:
- pip install conan --upgrade --user
macos1015_xcode11_5: &macos1015_xcode11_5
os: osx
osx_image: xcode11.5
compiler: clang
addons:
homebrew:
packages: [ pyenv-virtualenv, bison ]
before_install:
- eval "export CC=clang CXX=clang++"
- eval "export COV_COMPTYPE=clang COV_PLATFORM=macOSX"
- eval "export BUILD_TOOL_OPTIONS='-j 4'"
- eval "export GENERATOR='Unix Makefiles'"
- eval "export PATH=\"${PATH}:$(python3 -m site --user-base)/bin\""
- eval "export PATH=\"/usr/local/opt/bison/bin:${PATH}\""
install:
- python3 -m pip install conan --upgrade --user
freebsd12_clang8: &freebsd12_clang8
os: freebsd
compiler: clang
addons:
pkg:
packages: [ py37-pip ]
before_install:
- eval "export BUILD_TOOL_OPTIONS='-j 4'"
- eval "export GENERATOR='Unix Makefiles'"
install:
- pip install conan --upgrade --user
windows1809_vs2017: &windows1809_vs2017
os: windows
# Microsoft Windows instances freeze at "install:" if secure environment
# variables are used. There is no option to export secrets only for
# specified platforms. The "filter_secrets: false" option is used to disable
# the filter for Microsoft Windows instances. This is not an issue if the
# secret is removed from the environment at the earliest opportunity, before
# risk of exposure, as secrets are always removed from the environment for
# pull requests and are still filtered when exported to the environment. The
# secret of course will not be available for Microsoft Windows builds, but
# for Coverity Scan, that is fine.
filter_secrets: false
before_install:
- eval "unset COVERITY_SCAN_TOKEN"
# Conan will automatically determine the best compiler for a given platform
# based on educated guesses. The first check is based on the CC and CXX
# environment variables, the second (on Windows) is to check if Microsoft
# Visual Studio is installed. On Travis CC and CXX are set to gcc on
# Microsoft Windows targets as well, this has the undesired effect that
# MSVC is not detected, unsetting CC and CXX solves that problem.
- eval "unset CC CXX"
- eval "export COV_COMPTYPE=msvc COV_PLATFORM=win64"
- eval "export BUILD_TOOL_OPTIONS='-nologo -verbosity:minimal -maxcpucount -p:CL_MPCount=2'"
- |
if [ "${ARCH}" = "x86_64" ]; then
eval "export GENERATOR='Visual Studio 15 2017 Win64'"
else
eval "export GENERATOR='Visual Studio 15 2017'"
fi
- JAVA_HOME=$(find "/c/Program Files/Android/jdk/" -name "*openjdk*" | sort | head -n 1)
- export JAVA_HOME
- export PATH="${PATH}:${JAVA_HOME}/bin"
install:
# Windows targets in Travis are still very much in beta and Python is not
# yet available and installation of Python through Chocolaty does not work
# well. The real fix is to wait until Python and pip are both available on
# the target. Until then download Conan from the official website and
# simply add the extracted folder to the path.
- choco install innoextract
- choco install maven --ignore-dependencies
- choco install winflexbison3
- wget -q https://dl.bintray.com/conan/installers/conan-win-64_1_10_0.exe
- innoextract conan-win-64_1_10_0.exe
- eval "export PATH=\"$(pwd)/app/conan:${PATH}\""
jobs:
include:
- <<: *ubuntu1804_gcc7
env: [ ARCH=x86_64, BUILD_TYPE=Debug, COVERITY_SCAN=true ]
if: type = cron
- <<: *ubuntu1804_gcc10
env: [ ARCH=x86_64, BUILD_TYPE=Debug ]
- <<: *ubuntu1804_gcc10
env: [ ARCH=x86_64, BUILD_TYPE=Release ]
- <<: *ubuntu1804_clang10
env: [ ARCH=x86_64, BUILD_TYPE=Debug, SANITIZER=address ]
- <<: *ubuntu1804_clang10
env: [ ARCH=x86_64, BUILD_TYPE=Release ]
- <<: *macos1015_xcode11_5
env: [ ARCH=x86_64, BUILD_TYPE=Debug, SANITIZER=address ]
- <<: *macos1015_xcode11_5
env: [ ARCH=x86_64, BUILD_TYPE=Release ]
- <<: *freebsd12_clang8
env: [ ARCH=x86_64, BUILD_TYPE=Debug ]
- <<: *windows1809_vs2017
env: [ ARCH=x86, BUILD_TYPE=Debug ]
- <<: *windows1809_vs2017
env: [ ARCH=x86_64, BUILD_TYPE=Debug ]
- <<: *windows1809_vs2017
env: [ ARCH=x86_64, BUILD_TYPE=Release ]
before_script:
- conan profile new default --detect
- conan remote add bincrafters https://api.bintray.com/conan/bincrafters/public-conan
build_cyclonedds: &build_cyclonedds
- eval "export CYCLONEDDS_BRANCH=master"
- eval "export CYCLONEDDS_REPOSITORY=https://github.com/eclipse-cyclonedds/cyclonedds.git"
- git clone --single-branch --branch ${CYCLONEDDS_BRANCH} ${CYCLONEDDS_REPOSITORY} cyclonedds
- mkdir cyclonedds/build
- cd cyclonedds/build
- conan install -b missing -s arch=${ARCH} -s build_type=${BUILD_TYPE} ..
- cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX=$(pwd)/install
-DUSE_SANITIZER=${SANITIZER}
-DWERROR=on
-G "${GENERATOR}" ..
- cmake --build . --config ${BUILD_TYPE} --target install -- ${BUILD_TOOL_OPTIONS}
- cd ../..
script:
- *build_cyclonedds
- mkdir build
- cd build
- conan install -b missing -s arch=${ARCH} -s build_type=${BUILD_TYPE} ../${CONANFILE:-conanfile.txt}
- ${SCAN_BUILD} cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX=$(pwd)/install
-DCMAKE_PREFIX_PATH=${TRAVIS_BUILD_DIR}/cyclonedds/build/install
-DUSE_SANITIZER=${SANITIZER}
-DBUILD_TESTING=on
-DWERROR=on
-G "${GENERATOR}" ..
- cmake --build . --config ${BUILD_TYPE} --target install -- ${BUILD_TOOL_OPTIONS}
- ctest -j 4 --output-on-failure -T test -C ${BUILD_TYPE}
after_success:
- *submit_to_coverity_scan