-
Notifications
You must be signed in to change notification settings - Fork 52
/
.travis.yml
343 lines (278 loc) · 10.7 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
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
sudo: required
matrix:
include:
- os: linux
dist: bionic
language: cpp
compiler: gcc-7
group: deprecated-2017Q2
- os: osx
osx_image: xcode11.3
language: cpp
env:
global:
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7"
git:
depth: false
before_install:
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0C49F3730359A14518585931BC711F9BA15703C6;
fi
install:
- |
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
brew install grep;
brew install llvm@7
# brew no longer provides Qt 5.11, so we use an older formula for the same
curl -O https://raw.githubusercontent.com/Homebrew/homebrew-core/65a45a9e61f15046a256cdba6a008f38f79570c9/Formula/qt.rb
brew install ./qt.rb
brew link qt5 --force;
# compile sentry-native binaries and libraries only if we are building an installer
if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
curl -O -J -L https://github.com/getsentry/sentry-native/releases/download/0.1.3/sentry-native-0.1.3.zip
unzip sentry-native-0.1.3.zip &> /dev/null
cd sentry-native/gen_macosx
make -j4 config=release sentry_crashpad
export SENTRY_MACOSX_BIN="$PWD/bin/Release"
cd -
fi
fi
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
sudo apt-get install -y -qq lcov
sudo apt-get update -qq;
sudo apt-get install -y -qq --allow-unauthenticated qt5-qmake qtbase5-dev qtscript5-dev qtdeclarative5-dev libqt5webkit5-dev;
sudo apt-get install -y -qq --allow-unauthenticated --allow-downgrades libpulse-mainloop-glib0=1:8.0-0ubuntu3.10 libpulse0=1:8.0-0ubuntu3.10 libpulse-dev
sudo apt-get install -y -qq --allow-unauthenticated libqt5opengl5 libqt5multimedia5 libqt5multimedia5-plugins qtmultimedia5-dev;
sudo apt-get install -y -qq --allow-unauthenticated libsqlite3-dev libboost-all-dev libnetcdf-dev;
eval "${MATRIX_EVAL}";
fi
script:
- |
git submodule update --init --recursive
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
export LDFLAGS="-L/usr/local/opt/llvm@7/lib -Wl,-rpath,/usr/local/opt/llvm@7/lib"
export PATH="/usr/local/opt/llvm@7/bin/:$PATH"
export CPPFLAGS="-I/usr/local/opt/llvm@7/include -I/usr/local/opt/llvm@7/c++/v1/"
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
qmake CONFIG+=debug -o Makefile build.pro;
make -j4;
if [ $? != 0 ]; then
echo "An error occurred during build step"
exit 1
fi
./run_tests.sh;
else
# to export the path to sentry-native dynamic library
export PATH="$SENTRY_MACOSX_BIN:$PATH"
export LDFLAGS="$LDFLAGS -L/$SENTRY_MACOSX_BIN"
# export private DSN as base64 encoded string (helps with stringification)
export SENTRY_DSN_BASE64=`echo $SENTRY_DSN | base64`
# export encoded update repository URL
export UPDATE_REPO_URL_BASE64=`echo $UPDATE_REPO_URL | base64`
qmake CONFIG+=release CONFIG+=force_debug_info CONFIG+=separate_debug_info NOTESTS=yes
make -j4;
fi
fi
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
export CXX="g++-7";
export CC="gcc-7";
sudo unlink /usr/bin/gcc && sudo ln -s /usr/bin/gcc-7 /usr/bin/gcc;
sudo unlink /usr/bin/g++ && sudo ln -s /usr/bin/g++-7 /usr/bin/g++;
g++ -v;
gcc -v;
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
export QTEST_FUNCTION_TIMEOUT=1200000
echo $QTEST_FUNCTION_TIMEOUT
echo no | ./run.sh
if [ $? != 0 ]; then
echo "An error occurred during build step"
exit 1
fi
./run_tests.sh
if [ $? != 0 ]; then
echo "One or more tests failing"
exit 1
fi
lcov -b src/core/libmaven/ --capture --directory ../build/tmp/maven/ --output-file lcov.info --no-external
lcov --summary lcov.info
else
echo yes | ./run.sh
fi
fi
after_success:
- |
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
bash <(curl -s https://codecov.io/bash)
fi
- |
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
echo "This build is for a PR. Not proceeding with installer creation."
exit 0
fi
export ELMAVEN_TAG=`git describe --tags`
SUBSTRING=$(echo $ELMAVEN_TAG| cut -d'-' -f 1)
export ELMAVEN_VERSION=${SUBSTRING[@]:1}
if [ "$TRAVIS_TAG" != "" ]; then
export ELMAVEN_BRANCH=$TRAVIS_TAG
else
export ELMAVEN_BRANCH=$TRAVIS_BRANCH
fi
export PACKAGING_REPO=elmaven-packaging
git clone -q https://github.com/ElucidataInc/elmaven-packaging.git
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
cd $PACKAGING_REPO
# define variables
PARENT_DIR=$PWD
BREAKPAD_TOOLS=$PWD/breakpad_tools/
INSTALLER_TOOLS_DIR=$PWD/qt_ifw_tools/mac
ELMAVEN_BIN="$PARENT_DIR/../bin/"
BIN="$PARENT_DIR/bin/"
NODE_MAC="$PARENT_DIR/node_mac/"
ARCHIVE_FILE="maven.7z"
PACKAGE_DATA="$PARENT_DIR/packages/com.vendor.product/data/"
INSTALLER="El-MAVEN-$ELMAVEN_BRANCH"
# collect runtime plugins
echo "Collecting plugins ..."
cd $PARENT_DIR
if [ ! -d $BIN ]; then
mkdir $BIN
fi
cd $BIN
rm -rf *
rsync -av --progress --exclude={'windows','linux','node','node_bin','node.exe','MavenTests','methods'} $ELMAVEN_BIN . &>/dev/null
# create application bundles for both binaries
echo "Deploying bundles ..."
cp "$SENTRY_MACOSX_BIN/crashpad_handler" "El-MAVEN.app/Contents/MacOS/"
macdeployqt El-MAVEN.app
macdeployqt peakdetector.app
cp "$SENTRY_MACOSX_BIN/libsentry_crashpad.dylib" "El-MAVEN.app/Contents/Frameworks/"
install_name_tool -change @rpath/libsentry_crashpad.dylib @executable_path/../Frameworks/libsentry_crashpad.dylib "El-MAVEN.app/Contents/MacOS/El-MAVEN"
if [ $? != 0 ]; then
echo "Failed to create application bundles."
exit 1
fi
# upload debug symbols
echo "Uploading debug symbols for El-MAVEN ..."
cd $BIN
$BREAKPAD_TOOLS/mac/sentry-cli --auth-token $SENTRY_AUTH upload-dif --project el-maven-logging --org el-maven --include-sources --wait El-MAVEN.app.dSYM/Contents/Resources/DWARF/
rm -r *.dSYM
# copy node
echo "Copying node executable ..."
cp -r $NODE_MAC $BIN
# download our precompiled binaries of qt-ifw
echo "Downloading binaries for Qt Installer Framework ..."
cd $PARENT_DIR
wget https://www.dropbox.com/s/jwzuf4howm71s1d/archivegen?dl=1 -O archivegen &> /dev/null
chmod u+x ./archivegen
wget https://www.dropbox.com/s/yl47a7wjyzy91o9/binarycreator?dl=1 -O binarycreator &> /dev/null
chmod u+x ./binarycreator
wget https://www.dropbox.com/s/m5xjddbxon5cry9/installerbase?dl=1 -O installerbase &> /dev/null
chmod u+x ./installerbase
# generate archive
echo "Generating archive ..."
cd $PARENT_DIR
if [ -f $ARCHIVE_FILE ]; then
rm $ARCHIVE_FILE
fi
if [ -f $PACKAGE_DATA/$ARCHIVE_FILE ]; then
rm $PACKAGE_DATA/$ARCHIVE_FILE
fi
./archivegen $ARCHIVE_FILE $BIN
if [ $? != 0 ]; then
echo "Failed to generate archive. Make sure archivegen is in system path."
exit 1
fi
mkdir $PACKAGE_DATA
cp $ARCHIVE_FILE $PACKAGE_DATA
# update version
echo "Updating version string in config file ..."
cd $PARENT_DIR
python update_version.py $ELMAVEN_VERSION $UPDATE_REPO_URL
if [ $? != 0 ]; then
echo "Failed to update version in config file."
exit 1
fi
export IS_RELEASE_TAG=false
if [ "$TRAVIS_TAG" != "" ] && [[ "$TRAVIS_TAG" != *"alpha"* ]] && [[ "$TRAVIS_TAG" != *"beta"* ]]; then
# create update repository for this release
echo "Creating an update repository for $ELMAVEN_BRANCH ..."
IS_RELEASE_TAG=true
export ELMAVEN_UPDATES="repository"
cd $PARENT_DIR
mkdir "$PARENT_DIR/$ELMAVEN_UPDATES"
$INSTALLER_TOOLS_DIR/repogen -p packages -i com.vendor.product "$PARENT_DIR/$ELMAVEN_UPDATES"
if [ $? != 0 ]; then
echo "Failed to create update archive for release."
exit 1
fi
mv "$PARENT_DIR/$ELMAVEN_UPDATES" "$PARENT_DIR/../"
fi
# create installer
echo "Creating installer ..."
cd $PARENT_DIR
./binarycreator --offline-only --ignore-translations -r extras.qrc -c config/config.xml -p packages/ $INSTALLER
if [ $? != 0 ]; then
echo "Failed to create installer. Make sure binarycreator is in system path."
exit 1
fi
# create keychain and import certificate
echo "Creating new Keychain and installing developer certificate ..."
security create-keychain -p dummypass build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p dummypass build.keychain
echo $CERTIFICATE_OSX_P12 | base64 --decode > certificate.p12
security import certificate.p12 -k build.keychain -P $CERTIFICATE_OSX_PASSWORD -T /usr/bin/codesign
security find-identity -v
security set-key-partition-list -S apple-tool:,apple: -s -k dummypass build.keychain
# codesign installer
echo "Codesigning the installer ..."
cd $PARENT_DIR
codesign -s "Elucidata Corporation" $INSTALLER.app
if [ $? != 0 ]; then
echo "Failed to sign installer. Make sure the certificate exists."
exit 1
fi
# compressing
echo "Compressing installer into a zip file ..."
zip -r "$INSTALLER.zip" "$INSTALLER.app" &> /dev/null
cd $PARENT_DIR/../
cp "$PACKAGING_REPO/$INSTALLER.zip" .
# S3 provider requires the file(s) for deployment to be in a directory
mkdir $ELMAVEN_BRANCH
mv "$PACKAGING_REPO/$INSTALLER.zip" $ELMAVEN_BRANCH
fi
deploy:
- provider: releases
skip_cleanup: true
name: $TRAVIS_TAG
api_key: $GITHUB_RELEASE_TOKEN
file: $INSTALLER.zip
draft: true
overwrite: true
on:
tags: true
condition: $TRAVIS_OS_NAME = "osx"
- provider: s3
skip_cleanup: true
access_key_id: $AWS_ACCESS_KEY
secret_access_key: $AWS_SECRET_KEY
region: us-west-2
bucket: "elmaven-installers"
upload-dir: "Mac"
acl: public_read
local_dir: $ELMAVEN_BRANCH
on:
all_branches: true
condition: $TRAVIS_OS_NAME = "osx"
- provider: s3
skip_cleanup: true
access_key_id: $AWS_ACCESS_KEY
secret_access_key: $AWS_SECRET_KEY
region: us-west-2
bucket: "elmaven-installers"
upload-dir: "mac-updates"
acl: public_read
local_dir: $ELMAVEN_UPDATES
on:
tags: true
condition: $IS_RELEASE_TAG = true