Skip to content

Commit 31cbae2

Browse files
rafielantiga
authored andcommitted
Numerous automation changes (#264)
* Amazon Linux support * Fix 1 * Fix 2 * Fix 3 * Fix 4 * Fix 5 * Fix 6 * Fix 7 * Added CircleCI macOS build + automation fixes * Fix 8
1 parent c7207da commit 31cbae2

File tree

6 files changed

+107
-64
lines changed

6 files changed

+107
-64
lines changed

.circleci/config.yml

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ jobs:
6868
steps:
6969
- ci_steps:
7070
platform: debian
71-
# build-macos:
72-
# macos:
73-
# xcode: 10.2.1
74-
# steps:
75-
# - ci_steps:
76-
# platform: macosx
71+
build-macos:
72+
macos:
73+
xcode: 10.2.1
74+
steps:
75+
- ci_steps:
76+
platform: macosx
7777
build-multiarch-docker:
7878
machine:
7979
enabled: true
@@ -159,10 +159,13 @@ workflows:
159159
filters:
160160
tags:
161161
only: /.*/
162-
# - build-macos:
163-
# filters:
164-
# tags:
165-
# only: /.*/
162+
- build-macos:
163+
filters:
164+
branches:
165+
# only: /.*/
166+
ignore: /.*/
167+
tags:
168+
only: /^v[0-9].*/
166169
#- build-multiarch-docker:
167170
# filters:
168171
# tags:
@@ -198,3 +201,14 @@ workflows:
198201
filters:
199202
branches:
200203
only: master
204+
205+
nightly:
206+
triggers:
207+
- schedule:
208+
cron: "20 17 * * *"
209+
filters:
210+
branches:
211+
only:
212+
- master
213+
jobs:
214+
- build-macos

get_deps.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ if [[ $WITH_TF != 0 ]]; then
120120

121121
LIBTF_ARCHIVE=libtensorflow-${TF_BUILD}-${TF_OS}-${TF_ARCH}-${TF_VERSION}.tar.gz
122122

123-
[[ ! -f $LIBTF_ARCHIVE || $FORCE == 1 ]] && wget --quiet $LIBTF_URL_BASE/$LIBTF_ARCHIVE
123+
[[ ! -f $LIBTF_ARCHIVE || $FORCE == 1 ]] && wget -q $LIBTF_URL_BASE/$LIBTF_ARCHIVE
124124

125125
rm -rf $LIBTENSORFLOW.x
126126
mkdir $LIBTENSORFLOW.x
@@ -169,7 +169,7 @@ if [[ $WITH_TFLITE != 0 ]]; then
169169

170170
LIBTFLITE_ARCHIVE=libtensorflowlite-${TFLITE_OS}-${TFLITE_ARCH}-${TFLITE_VERSION}.tar.gz
171171

172-
[[ ! -f $LIBTFLITE_ARCHIVE || $FORCE == 1 ]] && wget $LIBTF_URL_BASE/$LIBTFLITE_ARCHIVE
172+
[[ ! -f $LIBTFLITE_ARCHIVE || $FORCE == 1 ]] && wget -q $LIBTF_URL_BASE/$LIBTFLITE_ARCHIVE
173173

174174
rm -rf $LIBTFLITE.x
175175
mkdir $LIBTFLITE.x

opt/readies/bin/platform

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ parser = argparse.ArgumentParser(description='Report platform characteristics.')
1212
parser.add_argument('--os', action="store_true", help='Operating system')
1313
parser.add_argument('--version', action="store_true", help='OS/Distribution version')
1414
parser.add_argument('--dist', action="store_true", help='Linux distribution (if applicable)')
15+
parser.add_argument('--osnick', action="store_true", help='OS/distribution/version is a single word')
1516
parser.add_argument('--arch', action="store_true", help='CPU Architecture')
1617
parser.add_argument('--kernel', action="store_true", help='Kernel version (if applicable)')
1718
parser.add_argument('--glibc', action="store_true", help='GLIBC version (if applicable)')
@@ -26,6 +27,8 @@ except:
2627
ret = ""
2728
if args.os:
2829
ret += " " + platform.os
30+
if args.osnick:
31+
ret += " " + platform.osnick
2932
if args.dist:
3033
ret += " " + platform.dist
3134
if args.version:
@@ -41,5 +44,9 @@ if ret == "":
4144
dist = platform.dist
4245
if dist != "":
4346
os = dist + " " + os
44-
ret = os + " " + platform.os_ver + " " + platform.arch
47+
if platform.osnick != "":
48+
nick = " (" + platform.osnick + ")"
49+
else:
50+
nick = ""
51+
ret = os + " " + platform.os_ver + nick + " " + platform.arch
4552
print(ret.strip())

opt/readies/paella/platform.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ def version(self):
2424
return self.defs["VERSION_ID"]
2525

2626
def osnick(self):
27-
return self.defs["VERSION_CODENAME"]
27+
try:
28+
return self.defs["VERSION_CODENAME"]
29+
except:
30+
return ""
2831

2932
#------------------------------------------------------------------------------------------
3033

@@ -42,6 +45,9 @@ def __init__(self, strict=False):
4245
os_release = Platform.OSRelease()
4346
distname = os_release.distname()
4447
self.os_ver = self.full_os_ver = os_release.version()
48+
self.osnick = os_release.osnick()
49+
if self.osnick == "":
50+
self.osnick = distname + str(self.os_ver)
4551
except:
4652
if strict:
4753
assert(False), "Cannot determine distribution"
@@ -55,6 +61,9 @@ def __init__(self, strict=False):
5561
distname = 'redhat'
5662
elif distname.startswith('suse'):
5763
distname = 'suse'
64+
elif distname.startswith('amzn'):
65+
distname = 'amzn'
66+
self.osnick = 'amzn' + str(os_release.version())
5867
else:
5968
if strict:
6069
assert(False), "Cannot determine distribution"
@@ -66,6 +75,7 @@ def __init__(self, strict=False):
6675
self.full_os_ver = mac_ver[0] # e.g. 10.14, but also 10.5.8
6776
self.os_ver = '.'.join(self.full_os_ver.split('.')[:2]) # major.minor
6877
# self.arch = mac_ver[2] # e.g. x64_64
78+
self.osnick = self.os + str(self.full_os_ver.split('.')[1])
6979
elif self.os == 'windows':
7080
self.dist = self.os
7181
self.os_ver = platform.release()
@@ -94,7 +104,7 @@ def is_debian_compat(self):
94104
return self.dist == 'debian' or self.dist == 'ubuntu'
95105

96106
def is_redhat_compat(self):
97-
return self.dist == 'redhat' or self.dist == 'centos'
107+
return self.dist == 'redhat' or self.dist == 'centos' or self.dist == 'amzn'
98108

99109
def is_container(self):
100110
with open('/proc/1/cgroups', 'r') as conf:
@@ -144,6 +154,8 @@ def invoke(self):
144154
self.suse()
145155
elif dist == 'arch':
146156
self.arch()
157+
elif dist == 'amzn':
158+
self.amzn()
147159
else:
148160
assert(False), "Cannot determine installer"
149161
elif os == 'macosx':
@@ -201,3 +213,6 @@ def bsd_compat(self):
201213

202214
def freebsd(self):
203215
pass
216+
217+
def amzn(self):
218+
pass

opt/readies/paella/setup.py

Lines changed: 48 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,13 @@ def __init__(self, nop=False):
6161
self.dist = self.platform.dist
6262
self.ver = self.platform.os_ver
6363

64-
if self.has_command("python3"):
65-
self.python = "python3"
66-
elif self.has_command("python"):
67-
self.python = "python"
68-
elif self.has_command("python2"):
69-
self.python = "python2"
64+
self.python = sys.executable
7065

7166
if self.os == 'macosx':
7267
# this is required because osx pip installed are done with --user
73-
os.environ["PATH"] = os.environ["PATH"] + ':' + '$HOME/Library/Python/2.7/bin'
68+
os.environ["PATH"] = os.environ["PATH"] + ':' + os.environ["HOME"] + '/Library/Python/2.7/bin'
69+
# this prevents brew updating before each install
70+
os.environ["HOMEBREW_NO_AUTO_UPDATE"] = "1"
7471

7572
if self.platform.is_debian_compat():
7673
# prevents apt-get from interactively prompting
@@ -118,11 +115,11 @@ def brew_install(self, packs, group=False, _try=False):
118115

119116
def install(self, packs, group=False, _try=False):
120117
if self.os == 'linux':
121-
if self.dist == 'fedora':
118+
if self.dist == 'fedora': # also include centos 8
122119
self.dnf_install(packs, group=group, _try=_try)
123-
elif self.dist == 'ubuntu' or self.dist == 'debian':
120+
elif self.platform.is_debian_compat():
124121
self.apt_install(packs, group=group, _try=_try)
125-
elif self.dist == 'centos' or self.dist == 'redhat':
122+
elif self.platform.is_redhat_compat():
126123
self.yum_install(packs, group=group, _try=_try)
127124
elif self.dist == 'suse':
128125
self.zypper_install(packs, group=group, _try=_try)
@@ -135,48 +132,48 @@ def install(self, packs, group=False, _try=False):
135132
else:
136133
Assert(False), "Cannot determine installer"
137134

138-
def group_install(self, packs):
139-
self.install(packs, group=True)
135+
def group_install(self, packs, _try=False):
136+
self.install(packs, group=True, _try=_try)
140137

141138
#------------------------------------------------------------------------------------------
142139

143-
def yum_add_repo(self, repourl, repo=""):
140+
def yum_add_repo(self, repourl, repo="", _try=False):
144141
if not self.has_command("yum-config-manager"):
145142
self.install("yum-utils")
146-
self.run("yum-config-manager -y --add-repo {}".format(repourl))
143+
self.run("yum-config-manager -y --add-repo {}".format(repourl), _try=_try)
147144

148-
def apt_add_repo(self, repourl, repo=""):
145+
def apt_add_repo(self, repourl, repo="", _try=False):
149146
if not self.has_command("yum-config-manager"):
150147
self.install("software-properties-common")
151-
self.run("add-apt-repository -y {}".format(repourl))
152-
self.run("apt-get -qq update")
148+
self.run("add-apt-repository -y {}".format(repourl), _try=_try)
149+
self.run("apt-get -qq update", _try=_try)
153150

154-
def dnf_add_repo(self, repourl, repo=""):
151+
def dnf_add_repo(self, repourl, repo="", _try=False):
155152
if self.run("dnf config-manager 2>/dev/null", _try=True):
156-
self.install("dnf-plugins-core")
157-
self.run("dnf config-manager -y --add-repo {}".format(repourl))
153+
self.install("dnf-plugins-core", _try=_try)
154+
self.run("dnf config-manager -y --add-repo {}".format(repourl), _try=_try)
158155

159-
def zypper_add_repo(self, repourl, repo=""):
156+
def zypper_add_repo(self, repourl, repo="", _try=False):
160157
pass
161158

162-
def pacman_add_repo(self, repourl, repo=""):
159+
def pacman_add_repo(self, repourl, repo="", _try=False):
163160
pass
164161

165-
def brew_add_repo(self, repourl, repo=""):
162+
def brew_add_repo(self, repourl, repo="", _try=False):
166163
pass
167164

168-
def add_repo(self, repourl, repo=""):
165+
def add_repo(self, repourl, repo="", _try=False):
169166
if self.os == 'linux':
170167
if self.dist == 'fedora':
171-
self.dnf_add_repo(repourl, repo=repo)
168+
self.dnf_add_repo(repourl, repo=repo, _try=_try)
172169
elif self.dist == 'ubuntu' or self.dist == 'debian':
173-
self.apt_add_repo(repourl, repo=repo)
170+
self.apt_add_repo(repourl, repo=repo, _try=_try)
174171
elif self.dist == 'centos' or self.dist == 'redhat':
175-
self.yum_add_repo(repourl, repo=repo)
172+
self.yum_add_repo(repourl, repo=repo, _try=_try)
176173
elif self.dist == 'suse':
177-
self.zypper_add_repo(repourl, repo=repo)
174+
self.zypper_add_repo(repourl, repo=repo, _try=_try)
178175
elif self.dist == 'arch':
179-
self.pacman_add_repo(repourl, repo=repo)
176+
self.pacman_add_repo(repourl, repo=repo, _try=_try)
180177
else:
181178
Assert(False), "Cannot determine installer"
182179
elif self.os == 'macosx':
@@ -190,26 +187,35 @@ def pip_install(self, cmd, _try=False):
190187
pip_user = ''
191188
if self.os == 'macosx':
192189
pip_user = '--user '
193-
self.run("pip install --disable-pip-version-check " + pip_user + cmd, output_on_error=True, _try=_try)
190+
self.run(self.python + " -m pip install --disable-pip-version-check " + pip_user + cmd, output_on_error=True, _try=_try)
194191

195192
def pip3_install(self, cmd, _try=False):
196193
pip_user = ''
197194
if self.os == 'macosx':
198195
pip_user = '--user '
199-
self.run("pip3 install --disable-pip-version-check " + pip_user + cmd, output_on_error=True, _try=_try)
196+
self.run(self.python + " -m pip install --disable-pip-version-check " + pip_user + cmd, output_on_error=True, _try=_try)
200197

201-
def setup_pip(self):
198+
def setup_pip(self, _try=False):
202199
get_pip = "set -e; wget -q https://bootstrap.pypa.io/get-pip.py -O /tmp/get-pip.py"
203-
if not self.has_command("pip3"):
204-
self.install("python3-distutils", _try=True)
200+
if self.run(self.python + " -m pip --version", _try=True, output_on_error=False) != 0:
201+
if sys.version_info.major == 3:
202+
self.install("python3-distutils")
205203
self.install_downloaders()
206-
self.run(get_pip + "; " + self.python + " /tmp/get-pip.py", output_on_error=True)
204+
pip_user = ' --user' if self.os == 'macosx' else ''
205+
self.run(get_pip + "; " + self.python + " /tmp/get-pip.py" + pip_user + " 'pip==19.3.1'", output_on_error=True, _try=_try)
207206

208-
def install_downloaders(self):
207+
def install_downloaders(self, _try=False):
209208
if self.os == 'linux':
210-
self.install("ca-certificates")
211-
self.install("curl wget")
212-
213-
def install_git_lfs_on_linux(self):
214-
self.run("curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash")
215-
self.install("git-lfs")
209+
self.install("ca-certificates", _try=_try)
210+
self.install("curl wget", _try=_try)
211+
212+
def install_git_lfs_on_linux(self, _try=False):
213+
self.run("set -e; wget -q https://github.com/git-lfs/git-lfs/releases/download/v2.9.2/git-lfs-linux-amd64-v2.9.2.tar.gz -O /tmp/git-lfs.tar.gz")
214+
self.run("cd /tmp; tar xzf git-lfs.tar.gz; ./install.sh")
215+
216+
# cmd = "curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.{}.sh | bash"
217+
# if self.platform.is_redhat_compat():
218+
# self.run(cmd.format('rpm'), _try=_try)
219+
# elif self.platform.is_debian_compat():
220+
# self.run(cmd.format('deb'), _try=_try)
221+
# self.install("git-lfs", _try=_try)

opt/system-setup.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,14 @@ def redhat_compat(self):
3434
self.group_install("'Development Tools'")
3535
self.install("redhat-lsb-core")
3636

37-
self.install("epel-release")
38-
self.install("python36 python36-pip")
39-
self.install("python36-psutil")
37+
if not self.dist == "amzn":
38+
self.install("epel-release")
39+
self.install("python36 python36-pip")
40+
self.install("python36-psutil")
41+
else:
42+
self.run("amazon-linux-extras install epel", output_on_error=True)
43+
self.install("python3 python3-devel")
44+
self.pip_install("psutil")
4045

4146
self.install_git_lfs_on_linux()
4247

@@ -53,10 +58,6 @@ def macosx(self):
5358
self.install("git-lfs")
5459
self.install("redis")
5560

56-
def install_git_lfs_on_linux(self):
57-
self.run("curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash")
58-
self.install("git-lfs")
59-
6061
def common_last(self):
6162
if not self.has_command("RLTest"):
6263
self.pip3_install("git+https://github.com/RedisLabsModules/RLTest.git@master")

0 commit comments

Comments
 (0)