-
Notifications
You must be signed in to change notification settings - Fork 19
/
functions.star
249 lines (226 loc) · 9.21 KB
/
functions.star
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
# Use, modification, and distribution are
# subject to the Boost Software License, Version 1.0. (See accompanying
# file LICENSE.txt)
#
# Copyright Rene Rivera 2020.
# For Drone CI we use the Starlark scripting language to reduce duplication.
# As the yaml syntax for Drone CI is rather limited.
# Generate pipeline for Linux platform compilers.
def linux_cxx(name, cxx, cxxflags="", packages="", sources="", llvm_os="", llvm_ver="", arch="amd64", image="cppalliance/ubuntu16.04:1", buildtype="boost", buildscript="", environment={}, globalenv={}, triggers={ "branch": [ "master", "develop", "drone*", "bugfix/*", "feature/*", "fix/*", "pr/*" ] }, node={}, privileged=False):
environment_global = {
"TRAVIS_BUILD_DIR": "/drone/src",
"TRAVIS_OS_NAME": "linux",
"CXX": cxx,
"CXXFLAGS": cxxflags,
"PACKAGES": packages,
"SOURCES": sources,
"LLVM_OS": llvm_os,
"LLVM_VER": llvm_ver,
"DRONE_JOB_BUILDTYPE": buildtype
}
environment_global.update(globalenv)
environment_current=environment_global
environment_current.update(environment)
if buildscript:
buildscript_to_run = buildscript
else:
buildscript_to_run = buildtype
return {
"name": "Linux %s" % name,
"kind": "pipeline",
"type": "docker",
"trigger": triggers,
"platform": {
"os": "linux",
"arch": arch
},
"clone": {
"retries": 5
},
"node": node,
"steps": [
{
"name": "Everything",
"image": image,
"pull": "if-not-exists",
"privileged" : privileged,
"environment": environment_current,
"commands": [
"echo '==================================> SETUP'",
"uname -a",
# Moved to Docker:
# "apt-get -o Acquire::Retries=3 update && DEBIAN_FRONTEND=noninteractive apt-get -y install tzdata && apt-get -o Acquire::Retries=3 install -y sudo software-properties-common wget curl apt-transport-https git make cmake apt-file sudo unzip libssl-dev build-essential autotools-dev autoconf libc++-helpers automake g++",
# "for i in {1..3}; do apt-add-repository ppa:git-core/ppa && break || sleep 10; done",
# "apt-get -o Acquire::Retries=3 update && apt-get -o Acquire::Retries=3 -y install git",
#
"BOOST_CI_ORG=boostorg BOOST_CI_BRANCH=master && curl -s -S --retry 10 -L -o $BOOST_CI_BRANCH.tar.gz https://github.com/$BOOST_CI_ORG/boost-ci/archive/$BOOST_CI_BRANCH.tar.gz && tar -xvf $BOOST_CI_BRANCH.tar.gz && mv boost-ci-$BOOST_CI_BRANCH .drone/boost-ci && rm $BOOST_CI_BRANCH.tar.gz",
"echo '==================================> PACKAGES'",
# "./.drone/linux-cxx-install.sh",
"./.drone/boost-ci/ci/drone/linux-cxx-install.sh",
"echo '==================================> INSTALL AND COMPILE'",
"./.drone/%s.sh" % buildscript_to_run,
]
}
]
}
def windows_cxx(name, cxx="g++", cxxflags="", packages="", sources="", llvm_os="", llvm_ver="", arch="amd64", image="cppalliance/dronevs2019", buildtype="boost", buildscript="", environment={}, globalenv={}, triggers={ "branch": [ "master", "develop", "drone*", "bugfix/*", "feature/*", "fix/*", "pr/*" ] }, node={}, privileged=False):
environment_global = {
"TRAVIS_OS_NAME": "windows",
"CXX": cxx,
"CXXFLAGS": cxxflags,
"PACKAGES": packages,
"LLVM_OS": llvm_os,
"LLVM_VER": llvm_ver,
"DRONE_JOB_BUILDTYPE": buildtype
}
environment_global.update(globalenv)
environment_current=environment_global
environment_current.update(environment)
if buildscript:
buildscript_to_run = buildscript
else:
buildscript_to_run = buildtype
return {
"name": "Windows %s" % name,
"kind": "pipeline",
"type": "docker",
"trigger": triggers,
"platform": {
"os": "windows",
"arch": arch
},
"node": node,
"steps": [
{
"name": "Everything",
"image": image,
"pull": "if-not-exists",
"privileged": privileged,
"environment": environment_current,
"commands": [
"echo '==================================> SETUP'",
"echo $env:DRONE_STAGE_MACHINE",
"try { pwsh.exe -Command Invoke-WebRequest https://github.com/boostorg/boost-ci/archive/master.tar.gz -Outfile master.tar.gz -MaximumRetryCount 10 -RetryIntervalSec 15 } catch { Invoke-WebRequest https://github.com/boostorg/boost-ci/archive/master.tar.gz -Outfile master.tar.gz ; echo 'Using powershell' }",
"tar -xvf master.tar.gz",
"mv boost-ci-master .drone/boost-ci",
"Remove-Item master.tar.gz",
"echo '==================================> PACKAGES'",
".drone/boost-ci/ci/drone/windows-cxx-install.bat",
"echo '==================================> INSTALL AND COMPILE'",
"cmd /c .drone\\\%s.bat `& exit" % buildscript_to_run,
]
}
]
}
def osx_cxx(name, cxx, cxxflags="", packages="", sources="", llvm_os="", llvm_ver="", arch="amd64", image="", osx_version="", xcode_version="", buildtype="boost", buildscript="", environment={}, globalenv={}, triggers={ "branch": [ "master", "develop", "drone*", "bugfix/*", "feature/*", "fix/*", "pr/*" ] }, privileged=False):
environment_global = {
# "TRAVIS_BUILD_DIR": "/drone/src",
"TRAVIS_OS_NAME": "osx",
"CXX": cxx,
"CXXFLAGS": cxxflags,
"PACKAGES": packages,
"LLVM_OS": llvm_os,
"LLVM_VER": llvm_ver,
"DRONE_JOB_BUILDTYPE": buildtype
}
environment_global.update(globalenv)
environment_current=environment_global
environment_current.update(environment)
if buildscript:
buildscript_to_run = buildscript
else:
buildscript_to_run = buildtype
if xcode_version:
environment_current.update({"DEVELOPER_DIR": "/Applications/Xcode-" + xcode_version + ".app/Contents/Developer"})
if not osx_version:
if xcode_version[0:2] in [ "13"]:
osx_version="monterey"
elif xcode_version[0:4] in [ "12.5"]:
osx_version="monterey"
elif xcode_version[0:2] in [ "12","11","10"]:
osx_version="catalina"
elif xcode_version[0:1] in [ "9","8","7","6"]:
osx_version="highsierra"
else:
osx_version="catalina"
return {
"name": "OSX %s" % name,
"kind": "pipeline",
"type": "exec",
"trigger": triggers,
"platform": {
"os": "darwin",
"arch": arch
},
"node": {
"os": osx_version
},
"steps": [
{
"name": "Everything",
# "image": image,
# "pull": "if-not-exists",
"privileged" : privileged,
"environment": environment_current,
"commands": [
"echo '==================================> SETUP'",
"uname -a",
"BOOST_CI_ORG=boostorg BOOST_CI_BRANCH=master && curl -s -S --retry 10 -L -o $BOOST_CI_BRANCH.tar.gz https://github.com/$BOOST_CI_ORG/boost-ci/archive/$BOOST_CI_BRANCH.tar.gz && tar -xvf $BOOST_CI_BRANCH.tar.gz && mv boost-ci-$BOOST_CI_BRANCH .drone/boost-ci && rm $BOOST_CI_BRANCH.tar.gz",
"echo '==================================> PACKAGES'",
"./.drone/boost-ci/ci/drone/osx-cxx-install.sh",
"echo '==================================> INSTALL AND COMPILE'",
"./.drone/%s.sh" % buildscript_to_run,
]
}
]
}
def freebsd_cxx(name, cxx, cxxflags="", packages="", sources="", llvm_os="", llvm_ver="", arch="amd64", image="", freebsd_version="13.1", buildtype="boost", buildscript="", environment={}, globalenv={}, triggers={ "branch": [ "master", "develop", "drone*", "bugfix/*", "feature/*", "fix/*", "pr/*" ] }, privileged=False):
environment_global = {
# "TRAVIS_BUILD_DIR": "/drone/src",
"TRAVIS_OS_NAME": "freebsd",
"CXX": cxx,
"CXXFLAGS": cxxflags,
"PACKAGES": packages,
"LLVM_OS": llvm_os,
"LLVM_VER": llvm_ver,
"DRONE_JOB_BUILDTYPE": buildtype
}
environment_global.update(globalenv)
environment_current=environment_global
environment_current.update(environment)
if buildscript:
buildscript_to_run = buildscript
else:
buildscript_to_run = buildtype
return {
"name": "FreeBSD %s" % name,
"kind": "pipeline",
"type": "exec",
"trigger": triggers,
"platform": {
"os": "freebsd",
"arch": arch
},
"node": {
"os": "freebsd" + freebsd_version
},
"steps": [
{
"name": "Everything",
# "image": image,
# "pull": "if-not-exists",
"privileged" : privileged,
"environment": environment_current,
"commands": [
"echo '==================================> SETUP'",
"uname -a",
"export PATH=/usr/local/bin:$PATH",
"BOOST_CI_ORG=boostorg BOOST_CI_BRANCH=master && curl -s -S --retry 10 -L -o $BOOST_CI_BRANCH.tar.gz https://github.com/$BOOST_CI_ORG/boost-ci/archive/$BOOST_CI_BRANCH.tar.gz && tar -xvf $BOOST_CI_BRANCH.tar.gz && mv boost-ci-$BOOST_CI_BRANCH .drone/boost-ci && rm $BOOST_CI_BRANCH.tar.gz",
"echo '==================================> PACKAGES'",
"./.drone/boost-ci/ci/drone/freebsd-cxx-install.sh",
"echo '==================================> INSTALL AND COMPILE'",
"./.drone/%s.sh" % buildscript_to_run,
]
}
]
}