forked from zeromq/zproject
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzproject_travis.gsl
653 lines (593 loc) · 22.6 KB
/
zproject_travis.gsl
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
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
# Generate continuous integration test files
#
# This is a code generator built using the iMatix GSL code generation
# language. See https://github.com/imatix/gsl for details.
#
# Copyright (c) the Contributors as noted in the AUTHORS file.
# This file is part of zproject.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
register_target ("travis", "Travis CI scripts")
.macro target_travis
.if !file.exists (".travis.yml")
. echo "Generating skeleton .travis.yml script"
. output ".travis.yml"
# Travis CI script
# This is a skeleton created by zproject.
# You can add hand-written code here.
language:
- c
cache:
- ccache
os:
- linux
# Note: some packages or dependencies may require extended permissions
# which take longer to set up and boot. If your project does not build
# in the default container with sudo==false, consider requiring a docker
# image and/or a newer Ubuntu Trusty baseline VM, by uncommenting below.
# See the current docs on http://travis-ci.org for up-to-date options.
sudo: false
#sudo: required
#dist:
#- trusty
#services:
#- docker
# Set CI_TIME=true to enable build-step profiling in Travis
# Set CI_TRACE=true to enable shell script tracing in Travis
# Set CI_CONFIG_QUIET=true to enable "configure --quiet" (only report stderr)
env:
global:
- CI_TIME=false
- CI_TRACE=false
- CI_CONFIG_QUIET=true
# tokens to deploy releases on OBS and create/delete temporary branch on Github.
# 1) Create a token on https://github.com/settings/tokens/new with "public_repo"
# capability and encrypt it with travis encrypt --org -r <org>/<repo> GH_TOKEN="<token>"
# 2) Create 2 OBS tokens with osc token --create network:messaging:zeromq:release-<stable|draft> <project>
# encrypt them with travis encrypt --org -r <org>/<repo> OBS_<STABLE|DRAFT>_TOKEN="<token>"
# 3) Uncomment the three "secure" lines and paste the three generated hashed
# strings, which include each token's name, as parameters
#- secure:
#- secure:
#- secure:
matrix:
- BUILD_TYPE=default
- BUILD_TYPE=default-Werror
- BUILD_TYPE=cmake
# - BUILD_TYPE=android
# - BUILD_TYPE=check-py
pkg_deps_prereqs: &pkg_deps_prereqs
. for use
. if defined (use.debian_name)
. if !(use.debian_name = '')
- $(use.debian_name)
. else
. echo "WARNING: debian_name=='' for $(use.project) - not added to .travis.yml"
. endif
. elsif defined (use.libname)
- $(string.replace (use.libname, "_|-"):lower)-dev
. else
- $(string.replace (use.project, "_|-"))-dev
. endif
. endfor
pkg_deps_doctools: &pkg_deps_doctools
- asciidoc
- xmlto
pkg_deps_devtools: &pkg_deps_devtools
- git
pkg_src_zeromq_ubuntu12: &pkg_src_zeromq_ubuntu12
- sourceline: 'deb http://download.opensuse.org/repositories/network:/messaging:/zeromq:/git-draft/xUbuntu_12.04/ ./'
key_url: 'http://download.opensuse.org/repositories/network:/messaging:/zeromq:/git-draft/xUbuntu_12.04/Release.key'
pkg_src_zeromq_ubuntu14: &pkg_src_zeromq_ubuntu14
- sourceline: 'deb http://download.opensuse.org/repositories/network:/messaging:/zeromq:/git-draft/xUbuntu_14.04/ ./'
key_url: 'http://download.opensuse.org/repositories/network:/messaging:/zeromq:/git-draft/xUbuntu_14.04/Release.key'
# Note: refer to ubuntu14 if you use dist==Trusty
# Also note that as of early 2017, either dist==trusty or services==docker
# is needed for C++11 support; docker envs are usually faster to start up
addons:
apt:
sources: *pkg_src_zeromq_ubuntu14
packages: &pkg_deps_common
- *pkg_deps_devtools
- *pkg_deps_prereqs
matrix:
include:
- env: BUILD_TYPE=default-with-docs
os: linux
addons:
apt:
sources: *pkg_src_zeromq_ubuntu14
packages:
- *pkg_deps_common
- *pkg_deps_doctools
- env: BUILD_TYPE=valgrind
os: linux
dist: trusty
addons:
apt:
sources: *pkg_src_zeromq_ubuntu14
packages:
- valgrind
- *pkg_deps_common
- env: BUILD_TYPE=default ADDRESS_SANITIZER=enabled
os: linux
dist: trusty
addons:
apt:
sources: *pkg_src_zeromq_ubuntu14
packages:
- *pkg_deps_common
before_install:
- if [ "$TRAVIS_OS_NAME" == "osx" -a "$BUILD_TYPE" == "android" ] ; then brew install binutils ; fi
- if [ "$TRAVIS_OS_NAME" == "osx" -a "$BUILD_TYPE" == "valgrind" ] ; then brew install valgrind ; fi
# Hand off to generated script for each BUILD_TYPE
script: ./ci_build.sh
before_deploy: . ./ci_deploy.sh && ./ci_deploy_obs.sh
deploy:
provider: releases
api_key:
# To encrypt your access token run: `travis encrypt -r user/repo`
secure: <encrypted github access token>
file_glob: true
file: ${$(PROJECT.NAME:c)_DEPLOYMENT}
skip_cleanup: true
on:
branch: master
tags: true
condition: $TRAVIS_OS_NAME =~ (linux) && $BUILD_TYPE =~ (default)
. close
.else
. echo "NOT regenerating an existing .travis.yml file; you might want to move yours out of the way and re-generate the project again to get updated settings"
.endif
.
.output "ci_build.sh"
#!/usr/bin/env bash
$(project.GENERATED_WARNING_HEADER)
set -e
# Set this to enable verbose profiling
[ -n "${CI_TIME-}" ] || CI_TIME=""
case "$CI_TIME" in
[Yy][Ee][Ss]|[Oo][Nn]|[Tt][Rr][Uu][Ee])
CI_TIME="time -p " ;;
[Nn][Oo]|[Oo][Ff][Ff]|[Ff][Aa][Ll][Ss][Ee])
CI_TIME="" ;;
esac
# Set this to enable verbose tracing
[ -n "${CI_TRACE-}" ] || CI_TRACE="no"
case "$CI_TRACE" in
[Nn][Oo]|[Oo][Ff][Ff]|[Ff][Aa][Ll][Ss][Ee])
set +x ;;
[Yy][Ee][Ss]|[Oo][Nn]|[Tt][Rr][Uu][Ee])
set -x ;;
esac
case "$BUILD_TYPE" in
default|default-Werror|default-with-docs|valgrind)
LANG=C
LC_ALL=C
export LANG LC_ALL
if [ -d "./tmp" ]; then
rm -rf ./tmp
fi
mkdir -p tmp
BUILD_PREFIX=$PWD/tmp
PATH="`echo "$PATH" | sed -e 's,^/usr/lib/ccache/?:,,' -e 's,:/usr/lib/ccache/?:,,' -e 's,:/usr/lib/ccache/?$,,' -e 's,^/usr/lib/ccache/?$,,'2`"
CCACHE_PATH="$PATH"
CCACHE_DIR="${HOME}/.ccache"
export CCACHE_PATH CCACHE_DIR PATH
HAVE_CCACHE=no
if which ccache && ls -la /usr/lib/ccache ; then
HAVE_CCACHE=yes
fi
mkdir -p "${CCACHE_DIR}" || HAVE_CCACHE=no
if [ "$HAVE_CCACHE" = yes ] && [ -d "$CCACHE_DIR" ]; then
echo "CCache stats before build:"
ccache -s || true
fi
CONFIG_OPTS=()
COMMON_CFLAGS=""
EXTRA_CFLAGS=""
EXTRA_CPPFLAGS=""
EXTRA_CXXFLAGS=""
is_gnucc() {
if [ -n "$1" ] && "$1" --version 2>&1 | grep 'Free Software Foundation' > /dev/null ; then true ; else false ; fi
}
COMPILER_FAMILY=""
if [ -n "$CC" -a -n "$CXX" ]; then
if is_gnucc "$CC" && is_gnucc "$CXX" ; then
COMPILER_FAMILY="GCC"
export CC CXX
fi
else
if is_gnucc "gcc" && is_gnucc "g++" ; then
# Autoconf would pick this by default
COMPILER_FAMILY="GCC"
[ -n "$CC" ] || CC=gcc
[ -n "$CXX" ] || CXX=g++
export CC CXX
elif is_gnucc "cc" && is_gnucc "c++" ; then
COMPILER_FAMILY="GCC"
[ -n "$CC" ] || CC=cc
[ -n "$CXX" ] || CXX=c++
export CC CXX
fi
fi
if [ -n "$CPP" ] ; then
[ -x "$CPP" ] && export CPP
else
if is_gnucc "cpp" ; then
CPP=cpp && export CPP
fi
fi
CONFIG_OPT_WERROR="--enable-Werror=no"
if [ "$BUILD_TYPE" == "default-Werror" ] ; then
case "${COMPILER_FAMILY}" in
GCC)
echo "NOTE: Enabling ${COMPILER_FAMILY} compiler pedantic error-checking flags for BUILD_TYPE='$BUILD_TYPE'" >&2
CONFIG_OPT_WERROR="--enable-Werror=yes"
CONFIG_OPTS+=("--enable-Werror=yes")
;;
*)
echo "WARNING: Current compiler is not GCC, might not enable pedantic error-checking flags for BUILD_TYPE='$BUILD_TYPE'" >&2
CONFIG_OPT_WERROR="--enable-Werror=auto"
;;
esac
fi
CONFIG_OPTS+=("CFLAGS=-I${BUILD_PREFIX}/include")
CONFIG_OPTS+=("CPPFLAGS=-I${BUILD_PREFIX}/include")
CONFIG_OPTS+=("CXXFLAGS=-I${BUILD_PREFIX}/include")
CONFIG_OPTS+=("LDFLAGS=-L${BUILD_PREFIX}/lib")
CONFIG_OPTS+=("PKG_CONFIG_PATH=${BUILD_PREFIX}/lib/pkgconfig")
CONFIG_OPTS+=("--prefix=${BUILD_PREFIX}")
if [ -z "${CI_CONFIG_QUIET-}" ] || [ "${CI_CONFIG_QUIET-}" = yes ] || [ "${CI_CONFIG_QUIET-}" = true ]; then
CONFIG_OPTS+=("--quiet")
fi
if [ "$HAVE_CCACHE" = yes ] && [ "${COMPILER_FAMILY}" = GCC ]; then
PATH="/usr/lib/ccache:$PATH"
export PATH
if [ -n "$CC" ] && [ -x "/usr/lib/ccache/`basename "$CC"`" ]; then
case "$CC" in
*ccache*) ;;
*/*) DIR_CC="`dirname "$CC"`" && [ -n "$DIR_CC" ] && DIR_CC="`cd "$DIR_CC" && pwd `" && [ -n "$DIR_CC" ] && [ -d "$DIR_CC" ] || DIR_CC=""
[ -z "$CCACHE_PATH" ] && CCACHE_PATH="$DIR_CC" || \\
if echo "$CCACHE_PATH" | egrep '(^'"$DIR_CC"':.*|^'"$DIR_CC"'$|:'"$DIR_CC"':|:'"$DIR_CC"'$)' ; then
CCACHE_PATH="$DIR_CC:$CCACHE_PATH"
fi
;;
esac
CC="/usr/lib/ccache/`basename "$CC"`"
else
: # CC="ccache $CC"
fi
if [ -n "$CXX" ] && [ -x "/usr/lib/ccache/`basename "$CXX"`" ]; then
case "$CXX" in
*ccache*) ;;
*/*) DIR_CXX="`dirname "$CXX"`" && [ -n "$DIR_CXX" ] && DIR_CXX="`cd "$DIR_CXX" && pwd `" && [ -n "$DIR_CXX" ] && [ -d "$DIR_CXX" ] || DIR_CXX=""
[ -z "$CCACHE_PATH" ] && CCACHE_PATH="$DIR_CXX" || \\
if echo "$CCACHE_PATH" | egrep '(^'"$DIR_CXX"':.*|^'"$DIR_CXX"'$|:'"$DIR_CXX"':|:'"$DIR_CXX"'$)' ; then
CCACHE_PATH="$DIR_CXX:$CCACHE_PATH"
fi
;;
esac
CXX="/usr/lib/ccache/`basename "$CXX"`"
else
: # CXX="ccache $CXX"
fi
if [ -n "$CPP" ] && [ -x "/usr/lib/ccache/`basename "$CPP"`" ]; then
case "$CPP" in
*ccache*) ;;
*/*) DIR_CPP="`dirname "$CPP"`" && [ -n "$DIR_CPP" ] && DIR_CPP="`cd "$DIR_CPP" && pwd `" && [ -n "$DIR_CPP" ] && [ -d "$DIR_CPP" ] || DIR_CPP=""
[ -z "$CCACHE_PATH" ] && CCACHE_PATH="$DIR_CPP" || \\
if echo "$CCACHE_PATH" | egrep '(^'"$DIR_CPP"':.*|^'"$DIR_CPP"'$|:'"$DIR_CPP"':|:'"$DIR_CPP"'$)' ; then
CCACHE_PATH="$DIR_CPP:$CCACHE_PATH"
fi
;;
esac
CPP="/usr/lib/ccache/`basename "$CPP"`"
else
: # CPP="ccache $CPP"
fi
CONFIG_OPTS+=("CC=${CC}")
CONFIG_OPTS+=("CXX=${CXX}")
CONFIG_OPTS+=("CPP=${CPP}")
fi
CONFIG_OPTS_COMMON=$CONFIG_OPTS
CONFIG_OPTS+=("--with-docs=no")
# Clone and build dependencies, if not yet installed to Travis env as DEBs
# or MacOS packages; other OSes are not currently supported by Travis cloud
[ -z "$CI_TIME" ] || echo "`date`: Starting build of dependencies (if any)..."
. for use
# Start of recipe for dependency: $(use.project)
if \
. if defined (use.debian_name)
. if !(use.debian_name = '')
\! (command -v dpkg-query >/dev/null 2>&1 && dpkg-query --list $(use.debian_name) >/dev/null 2>&1) || \\
. endif
. elsif defined (use.libname)
\! (command -v dpkg-query >/dev/null 2>&1 && dpkg-query --list $(use.libname)-dev >/dev/null 2>&1) || \\
. else
\! (command -v dpkg-query >/dev/null 2>&1 && dpkg-query --list $(use.project)-dev >/dev/null 2>&1) || \\
. endif
(command -v brew >/dev/null 2>&1 && brew ls --versions $(use.project) >/dev/null 2>&1) \\
; then
echo ""
. if ! defined (use.repository) & ! defined (use.tarball)
echo "WARNING: Can not build prerequisite '$(use.project)'" >&2
echo "because neither tarball nor repository sources are known for it," >&2
echo "and it was not isntalled as a package; this may cause the test to fail!" >&2
. else
BASE_PWD=${PWD}
. if defined (use.tarball)
echo "`date`: INFO: Building prerequisite '$(use.project)' from tarball..." >&2
$CI_TIME wget $(use.tarball)
tar -xzf \$(basename "$(use.tarball)")
cd \$(basename "$(use.tarball)" .tar.gz)
. elsif defined (use.repository)
echo "`date`: INFO: Building prerequisite '$(use.project)' from Git repository..." >&2
. if defined (use.release)
$CI_TIME git clone --quiet --depth 1 -b $(use.release:) $(use.repository) $(use.project)
. else
$CI_TIME git clone --quiet --depth 1 $(use.repository) $(use.project)
. endif
cd $(use.project)
. endif
. if defined (use.builddir)
cd ./$(use.builddir)
. endif
CCACHE_BASEDIR=${PWD}
export CCACHE_BASEDIR
. if defined (use.repository) & ! defined (use.tarball)
git --no-pager log --oneline -n1
. endif
if [ -e autogen.sh ]; then
$CI_TIME ./autogen.sh 2> /dev/null
fi
if [ -e buildconf ]; then
$CI_TIME ./buildconf 2> /dev/null
fi
if [ ! -e autogen.sh ] && [ ! -e buildconf ] && [ ! -e ./configure ] && [ -s ./configure.ac ]; then
$CI_TIME libtoolize --copy --force && \\
$CI_TIME aclocal -I . && \\
$CI_TIME autoheader && \\
$CI_TIME automake --add-missing --copy && \\
$CI_TIME autoconf || \\
$CI_TIME autoreconf -fiv
fi
. if count(use.add_config_opts) > 0
( # Custom additional options for $(use.project)
. for use.add_config_opts as add_cfgopt
CONFIG_OPTS+=("$(add_cfgopt)")
. endfor
$CI_TIME ./configure "${CONFIG_OPTS[@]}"
)
. else
$CI_TIME ./configure "${CONFIG_OPTS[@]}"
. endif
$CI_TIME make -j4
$CI_TIME make install
cd "${BASE_PWD}"
. if use.optional
CONFIG_OPTS+=("--with-$(use.libname)=yes")
. endif
. endif
. if use.optional
else
CONFIG_OPTS+=("--with-$(use.libname)=yes")
. endif
fi
. endfor
# Build and check this project; note that zprojects always have an autogen.sh
echo ""
echo "`date`: INFO: Starting build of currently tested project with DRAFT APIs..."
CCACHE_BASEDIR=${PWD}
export CCACHE_BASEDIR
if [ "$BUILD_TYPE" = "default-with-docs" ]; then
CONFIG_OPTS=$CONFIG_OPTS_COMMON
CONFIG_OPTS+=("--with-docs=yes")
fi
if [ -n "$ADDRESS_SANITIZER" ] && [ "$ADDRESS_SANITIZER" == "enabled" ]; then
CONFIG_OPTS+=("--enable-address-sanitizer=yes")
fi
# Only use --enable-Werror on projects that are expected to have it
# (and it is not our duty to check prerequisite projects anyway)
CONFIG_OPTS+=("${CONFIG_OPT_WERROR}")
. if count(add_config_opts) > 0
# Custom additional options for this project
. for add_config_opts as add_cfgopt
CONFIG_OPTS+=("$(add_cfgopt)")
. endfor
. endif
$CI_TIME ./autogen.sh 2> /dev/null
$CI_TIME ./configure --enable-drafts=yes "${CONFIG_OPTS[@]}"
if [ "$BUILD_TYPE" == "valgrind" ] ; then
# Build and check this project
$CI_TIME make VERBOSE=1 memcheck && exit
echo "Re-running failed ($?) memcheck with greater verbosity" >&2
$CI_TIME make VERBOSE=1 memcheck-verbose
exit $?
fi
$CI_TIME make VERBOSE=1 all
echo "=== Are GitIgnores good after 'make all' with drafts? (should have no output below)"
git status -s || true
echo "==="
. if travis_distcheck ?= 0
make check
. else
(
export DISTCHECK_CONFIGURE_FLAGS="--enable-drafts=yes ${CONFIG_OPTS[@]}"
$CI_TIME make VERBOSE=1 DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS" distcheck
echo "=== Are GitIgnores good after 'make distcheck' with drafts? (should have no output below)"
git status -s || true
echo "==="
)
. endif
# Build and check this project without DRAFT APIs
echo ""
echo "`date`: INFO: Starting build of currently tested project without DRAFT APIs..."
make distclean
git clean -f
git reset --hard HEAD
(
$CI_TIME ./autogen.sh 2> /dev/null
$CI_TIME ./configure --enable-drafts=no "${CONFIG_OPTS[@]}"
$CI_TIME make VERBOSE=1 all || exit $?
. if travis_distcheck ?= 0
make check
. else
(
export DISTCHECK_CONFIGURE_FLAGS="--enable-drafts=no ${CONFIG_OPTS[@]}" && \\
$CI_TIME make VERBOSE=1 DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS" distcheck || exit $?
)
. endif
) || exit 1
[ -z "$CI_TIME" ] || echo "`date`: Builds completed without fatal errors!"
echo "=== Are GitIgnores good after 'make distcheck' without drafts? (should have no output below)"
git status -s || true
echo "==="
if [ "$HAVE_CCACHE" = yes ]; then
echo "CCache stats after build:"
ccache -s
fi
;;
bindings)
pushd "./bindings/${BINDING}" && ./ci_build.sh
;;
*)
pushd "./builds/${BUILD_TYPE}" && REPO_DIR="\$(dirs -l +1)" ./ci_build.sh
;;
esac
.close
.chmod_x ("ci_build.sh")
.directory.create ("builds/check_zproject")
.output "builds/check_zproject/ci_build.sh"
#!/usr/bin/env bash
set -ex
# NOTE: This script is not standalone, it is included from project root
# ci_build.sh script, which sets some envvars (like REPO_DIR below).
[ -n "${REPO_DIR-}" ] || exit 1
# Verify all required dependencies with repos can be checked out
cd "$REPO_DIR/.."
.for project.use where !optional & defined (use.repository)
. if defined (use.release)
git clone --quiet --depth 1 -b $(use.release:) $(use.repository) $(use.project)
. else
git clone --quiet --depth 1 $(use.repository) $(use.project)
. endif
.endfor
cd -
if ! ((command -v dpkg-query >/dev/null 2>&1 && dpkg-query --list zproject >/dev/null 2>&1) || \\
(command -v brew >/dev/null 2>&1 && brew ls --versions zproject >/dev/null 2>&1)); then
cd "$REPO_DIR/.."
git clone --quiet --depth 1 https://github.com/zeromq/zproject zproject
cd zproject
PATH="`pwd`:$PATH"
fi
if ! ((command -v dpkg-query >/dev/null 2>&1 && dpkg-query --list generator-scripting-language >/dev/null 2>&1) || \\
(command -v brew >/dev/null 2>&1 && brew ls --versions gsl >/dev/null 2>&1)); then
cd "$REPO_DIR/.."
git clone https://github.com/imatix/gsl.git gsl
cd gsl/src
make
PATH="`pwd`:$PATH"
fi
export PATH
# Verify that zproject template is up-to-date with files it can overwrite
# As we will overwrite this script file make sure bash loads the
# next lines into memory before executing
# http://stackoverflow.com/questions/21096478/overwrite-executing-bash-script-files
{
cd "$REPO_DIR"
gsl project.xml
# keep an eye on git version used by CI
git --version
if [[ \$(git --no-pager diff -w) ]]; then
git --no-pager diff -w
echo "There are diffs between current code and code generated by zproject!"
exit 1
fi
if [[ \$(git status -s) ]]; then
git status -s
echo "zproject generated new files!"
exit 1
fi
exit 0
}
.close
.chmod_x ("builds/check_zproject/ci_build.sh")
.if count (model)
.directory.create ("builds/check_zproto")
.output "builds/check_zproto/ci_build.sh"
#!/usr/bin/env bash
set -ex
# NOTE: This script is not standalone, it is included from project root
# ci_build.sh script, which sets some envvars (like REPO_DIR below).
[ -n "${REPO_DIR-}" ] || exit 1
.for model
docker run -e GSL_BUILD_DIR=/code/src -v "$REPO_DIR":/code zeromqorg/zproto -zproject:1 -q $(name).xml
.endfor
# keep an eye on git version used by CI
git --version
if [[ \$(git --no-pager diff -w api/*) ]]; then
git --no-pager diff -w api/*
echo "There are diffs between current code and code generated by zproto!"
exit 1
fi
if [[ \$(git status -s api) ]]; then
git status -s api
echo "zproto generated new files!"
exit 1
fi
.close
.chmod_x ("builds/check_zproto/ci_build.sh")
.endif
.
.output "ci_deploy.sh"
#!/usr/bin/env bash
$(project.GENERATED_WARNING_HEADER)
set -x
set -e
if [ "$BUILD_TYPE" == "default" ]; then
# Tell travis to deploy all files in dist
mkdir dist
export $(PROJECT.NAME:c)_DEPLOYMENT=dist/*
# Move archives to dist
mv *.tar.gz dist
mv *.zip dist
# Generate hash sums
cd dist
md5sum *.zip *.tar.gz > MD5SUMS
sha1sum *.zip *.tar.gz > SHA1SUMS
cd -
elif [ "$BUILD_TYPE" == "bindings" ] && [ "$BINDING" == "jni" ]; then
( cd bindings/jni && TERM=dumb PKG_CONFIG_PATH=/tmp/lib/pkgconfig ./gradlew clean bintrayUpload )
cp bindings/jni/android/$(project.name:c)-android.jar $(project.name:c)-android-$(->version.major).$(->version.minor).$(->version.patch).jar
export $(PROJECT.NAME:c)_DEPLOYMENT=$(project.name:c)-android-$(->version.major).$(->version.minor).$(->version.patch).jar
else
export $(PROJECT.NAME:c)_DEPLOYMENT=""
fi
.close
.chmod_x ("ci_deploy.sh")
.
.output "ci_deploy_obs.sh"
#!/usr/bin/env bash
$(project.GENERATED_WARNING_HEADER)
# do NOT set -x or it will log the secret tokens!
set -e
if [ "$BUILD_TYPE" == "default" -a -n "${GH_TOKEN}" -a -n "${OBS_STABLE_TOKEN}" -a -n "${OBS_DRAFT_TOKEN}" ]; then
# Trigger source run on new tag on OBS. See travis.yml for token instructions.
# We have to create a temporary branch from the tag and delete it, as it is
# not possible to edit files on OBS with secure tokens, and it is not
# possible to dynamically fetch the latest git tag either.
. apiurl = string.search_replace (project.repository, "https://github.com/", "https://api.github.com/repos/")
TAG_SHA=\$(curl -s -H "Authorization: token ${GH_TOKEN}" -X GET $(apiurl)/git/refs/tags/${TRAVIS_TAG} | grep -o -P '(?<=sha":\\s).*(?=,)')
curl -H "Authorization: token ${GH_TOKEN}" -X POST --data "{\\"ref\\":\\"refs/heads/tmp_obs_release_branch\\",\\"sha\\":${TAG_SHA}}" $(apiurl)/git/refs
curl -H "Authorization: Token ${OBS_STABLE_TOKEN}" -X POST https://api.opensuse.org/trigger/runservice
curl -H "Authorization: Token ${OBS_DRAFT_TOKEN}" -X POST https://api.opensuse.org/trigger/runservice
# give some time for the git clone to happen before deleting the temp branch
sleep 60
curl -H "Authorization: token ${GH_TOKEN}" -X DELETE $(apiurl)/git/refs/heads/tmp_obs_release_branch
fi
.close
.chmod_x ("ci_deploy_obs.sh")
.endmacro