-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path.travis.yml
264 lines (252 loc) · 7.92 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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
# https://docs.travis-ci.com/user/customizing-the-build/
#
# Environment Variables to set up in Travis settings:
#
# For integration with Coverity Scan (https://scan.coverity.com)
# - COVERITY_SCAN_TOKEN: The Project Token in Project Settings.
# - COVERITY_SCAN_NOTIFICATION_EMAIL: Email address to receive notifications.
#
# For integration with SonarCloud (https://sonarcloud.io)
# - SONAR_ORGANIZATION: The SonarCloud organization ID. View it in My Account ->
# Organizations. (For personal SonarCloud organizations of
# accounts linked to GitHub accounts, it would be of the
# form "<username>-github".)
# - SONAR_PROJECTKEY: The SonarCloud project name. View it in your organization
# at Administration -> Projects Management.
# - SONAR_TOKEN: Create this SonarCloud access token in My Account -> Security.
#
# For integration with Scantist SCA (https://scantist.io)
# - SCANTISTTOKEN: The access token created in Organization Settings.
#
# Note: Encrypted environment variables aren't available to pull request builds.
language: cpp
branches:
only:
- master
- /^travis-.*/
git:
submodules: false
depth: false
jobs:
include:
- os: linux
dist: jammy
addons:
apt:
sources:
- sourceline: "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8"
key_url: "https://bazel.build/bazel-release.pub.gpg"
packages:
- g++-12
- gdb
- bazel
- make
coverity_scan:
project:
name: $TRAVIS_REPO_SLUG
version: $TRAVIS_COMMIT
build_command_prepend: $GNU_MAKE -k clean
build_command: $GNU_MAKE -k
# https://ruby-doc.org/core/Regexp.html (enclosed in \A and \Z)
branch_pattern: (master|travis-coverity-.*)
- os: osx
osx_image: xcode14.2
env: HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=true BAZEL=true
addons:
homebrew:
update: true
packages:
- make
- automake
- libtool
- gettext
sonarcloud:
organization: $SONAR_ORGANIZATION
- os: windows
- os: freebsd
env: BAZEL=true
addons:
pkg:
- automake
- gettext
- gmake
- libtool
- wget
- os: linux
dist: focal
arch: ppc64le
env: BAZEL=true
addons:
apt:
packages:
- g++-10
- gdb
- make
cache:
directories:
- boost
- googletest
- hunspell
- cryptopp
- openssl
- $HOME/.sonar/cache
- $HOME/Library/Caches/Homebrew
- $HOME/AppData/Local/Temp/chocolatey
- /C/tools/msys64
- /var/cache/pkg
timeout: 1000
before_cache:
- |-
case $TRAVIS_OS_NAME in
windows)
$msys2 pacman --sync --clean --noconfirm
echo --tcp-nodelay >> $APPDATA/.curlrc
;;
osx)
# https://stackoverflow.com/a/53331571/1433768
brew cleanup
;;
freebsd)
su -m root -c 'pkg clean --yes'
;;
esac
before_install:
- |-
case $TRAVIS_OS_NAME in
freebsd)
export AR=ar
export RANLIB=ranlib
mkdir -p ~/bin
su -m root -c 'ln -s /usr/bin/clang ~/bin/gcc'
su -m root -c 'ln -s /usr/bin/clang++ ~/bin/g++'
export GNU_MAKE=gmake
;;
osx)
export GNU_MAKE=gmake
;;
linux)
export GNU_MAKE=make
if [[ $TRAVIS_CPU_ARCH == amd64 ]]
then
gccVer=12
else
gccVer=10
fi
export AR=gcc-ar-$gccVer
export RANLIB=gcc-ranlib-$gccVer
sudo rm -f /usr/bin/gcc-ar /usr/bin/gcc-ar-$gccVer
sudo ln -s /usr/bin/ar /usr/bin/gcc-ar
sudo ln -s /usr/bin/ar /usr/bin/gcc-ar-$gccVer
# Workaround for https://github.com/travis-ci/travis-ci/issues/3668
mkdir -p latest-gcc-symlinks
ln -s /usr/bin/g++-$gccVer latest-gcc-symlinks/g++
ln -s /usr/bin/gcc-$gccVer latest-gcc-symlinks/gcc
export PATH=$PWD/latest-gcc-symlinks:$PATH
;;
windows)
# http://woshub.com/updating-trusted-root-certificates-in-windows-10
certutil -generateSSTFromWU roots.sst
powershell -Command '
Get-ChildItem -Path roots.sst |
Import-Certificate -CertStoreLocation Cert:\LocalMachine\Root'
rm -f roots.sst
# https://docs.travis-ci.com/user/reference/windows/#how-do-i-use-msys2
[[ ! -f C:/tools/msys64/msys2_shell.cmd ]] && rm -rf C:/tools/msys64
choco uninstall -y mingw
choco upgrade --no-progress -y bazel --version 7.4.1
choco upgrade --no-progress -y msys2
export msys2='cmd //C RefreshEnv.cmd '
export msys2+='& set MSYS=winsymlinks:nativestrict '
export msys2+='& C:\\tools\\msys64\\msys2_shell.cmd -defterm -no-start'
export shell="$msys2 -mingw64 -full-path -here -c "\"\$@"\" --"
export msys2+=" -msys2 -c "\"\$@"\" --"
$msys2 pacman --sync --noconfirm --needed \
make \
mingw-w64-x86_64-autotools \
mingw-w64-x86_64-toolchain \
perl \
unzip
taskkill //IM gpg-agent.exe //F
export CPPFLAGS=-D__USE_MINGW_ANSI_STDIO=1
export PATH=/C/tools/msys64/mingw64/bin:$PATH
export GNU_MAKE=/C/tools/msys64/usr/bin/make
export MAKE=$GNU_MAKE
export AR=gcc-ar
export RANLIB=gcc-ranlib
;;
esac
- export BAZEL=${BAZEL:-bazel}
- export GIT=git
- g++ --version
- $shell $GNU_MAKE --version
- $GIT --version
install:
- export BOOST_DIR=$PWD/boost
- export GTEST_DIR=$PWD/googletest
- export HUNSPELL_DIR=$PWD/hunspell
- export CRYPTOPP_DIR=$PWD/cryptopp
- export OPENSSL_DIR=$PWD/openssl
- export NPROC=`nproc || sysctl -n hw.ncpu`
- $GIT config --global --add submodule.fetchJobs $NPROC
- export MAKEFLAGS="-s -j $NPROC"
- $shell ./prepare_deps
before_script:
- ulimit -c unlimited -S
script:
- |-
if [[ $TRAVIS_OS_NAME == osx &&
( $TRAVIS_PULL_REQUEST == false ||
"$TRAVIS_PULL_REQUEST_SLUG" == "$TRAVIS_REPO_SLUG" ) ]]
then
$GNU_MAKE -k clean
build-wrapper-macosx-x86 --out-dir bw-output $GNU_MAKE -kj $NPROC
source_dirs=(set_*)
IFS=,
sonar-scanner -Dsonar.projectKey=$SONAR_PROJECTKEY \
-Dsonar.sources="${source_dirs[*]}" \
-Dsonar.cfamily.build-wrapper-output=bw-output \
-Dsonar.cfamily.cache.enabled=true \
-Dsonar.cfamily.cache.path=$HOME/.sonar/cache \
-Dsonar.cfamily.threads=$NPROC \
-Dsonar.host.url='https://sonarcloud.io'
else
$shell $GNU_MAKE -kj $NPROC
fi
- export HUNSPELL_AFFIX_PATH=$HUNSPELL_DIR/en_US.aff
- export HUNSPELL_DICT_PATH=$HUNSPELL_DIR/en_US.dic
- |-
case $TRAVIS_OS_NAME in
linux)
export SSL_CERT_DIR=/etc/ssl/certs
;;
osx)
security export \
-k /System/Library/Keychains/SystemRootCertificates.keychain \
-t certs \
-p \
> certs.pem
export SSL_CERT_FILE=`pwd`/certs.pem
;;
freebsd)
export SSL_CERT_DIR=/etc/ssl/certs
;;
esac
- $shell ./test --gtest_color=yes
after_success:
- |-
if [[ $TRAVIS_OS_NAME == linux && ! -z "$SCANTISTTOKEN"
&& $TRAVIS_CPU_ARCH == amd64 ]]
then
bash <(curl -s https://scripts.scantist.com/ci-travis.sh)
fi
after_failure:
# https://jsteemann.github.io/blog/2014/10/30/getting-core-dumps-of-failed-travisci-builds/
- coreFile=$(find . -maxdepth 1 -name "*core*" | head -n 1)
- |-
if [[ -f "$coreFile" ]]
then
gdb -c "$coreFile" test \
-ex "thread apply all bt" \
-ex "set pagination 0" \
-batch
fi