forked from zeromq/zproject
-
Notifications
You must be signed in to change notification settings - Fork 0
/
zproject_travis.gsl
166 lines (146 loc) · 4.09 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
# 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
language: c
os:
- linux
sudo: false
services:
- docker
env:
- BUILD_TYPE=default
#- BUILD_TYPE=android
#- BUILD_TYPE=check-py
#- BUILD_TYPE=cmake
addons:
apt:
packages:
- valgrind
- git
before_install:
- if [ $TRAVIS_OS_NAME == "osx" ] ; then brew update; brew install binutils valgrind ; fi
# Hand off to generated script for each BUILD_TYPE
script: ./ci_build.sh
.endif
.
.output "ci_build.sh"
#!/usr/bin/env bash
$(project.GENERATED_WARNING_HEADER)
set -x
set -e
if [ "$BUILD_TYPE" == "default" ]; then
mkdir tmp
BUILD_PREFIX=$PWD/tmp
CONFIG_OPTS=()
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}")
CONFIG_OPTS+=("--with-docs=no")
CONFIG_OPTS+=("--quiet")
# Clone and build dependencies
. for use where defined (use.tarball)
wget $(use.tarball)
tar -xzf \$(basename "$(use.tarball)")
cd \$(basename "$(use.tarball)" .tar.gz)
./configure "${CONFIG_OPTS[@]}"
make -j4
make install
cd ..
. endfor
. for use where 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
cd $(use.project)
git --no-pager log --oneline -n1
if [ -e autogen.sh ]; then
./autogen.sh 2> /dev/null
fi
if [ -e buildconf ]; then
./buildconf 2> /dev/null
fi
./configure "${CONFIG_OPTS[@]}"
make -j4
make install
cd ..
. endfor
# Build and check this project
./autogen.sh 2> /dev/null
./configure "${CONFIG_OPTS[@]}"
make -j4
make check
make memcheck
make install
# Build and check this project without DRAFT APIs
make clean
git reset --hard HEAD
./autogen.sh 2> /dev/null
./configure --enable-drafts=no "${CONFIG_OPTS[@]}"
make -j4
make check
make install
else
pushd "./builds/${BUILD_TYPE}" && REPO_DIR="\$(dirs -l +1)" ./ci_build.sh
fi
.close
.chmod_x ("ci_build.sh")
.directory.create ("builds/check_zproject")
.output "builds/check_zproject/ci_build.sh"
#!/usr/bin/env bash
set -ex
docker run -v "$REPO_DIR":/gsl zeromqorg/zproject 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
.close
.chmod_x ("builds/check_zproject/ci_build.sh")
.directory.create ("builds/check_zproto")
.output "builds/check_zproto/ci_build.sh"
#!/usr/bin/env bash
set -ex
.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")
.endmacro