forked from ray-project/ray
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-wheels.sh
executable file
·96 lines (74 loc) · 2.69 KB
/
test-wheels.sh
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
#!/usr/bin/env bash
# Cause the script to exit if a single command fails.
set -e
# Show explicitly which commands are currently running.
set -x
ROOT_DIR=$(cd "$(dirname "${BASH_SOURCE:-$0}")"; pwd)
platform="unknown"
unamestr="$(uname)"
if [[ "$unamestr" == "Linux" ]]; then
echo "Platform is linux."
platform="linux"
elif [[ "$unamestr" == "Darwin" ]]; then
echo "Platform is macosx."
platform="macosx"
else
echo "Unrecognized platform."
exit 1
fi
TEST_SCRIPT=$ROOT_DIR/../test/microbenchmarks.py
if [[ "$platform" == "linux" ]]; then
# First test Python 2.7.
# Install miniconda.
wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -O miniconda2.sh
bash miniconda2.sh -b -p $HOME/miniconda2
# Find the right wheel by grepping for the Python version.
PYTHON_WHEEL=$(find $ROOT_DIR/../.whl -type f -maxdepth 1 -print | grep -m1 '27')
# Install the wheel.
$HOME/miniconda2/bin/pip install $PYTHON_WHEEL
# Run a simple test script to make sure that the wheel works.
$HOME/miniconda2/bin/python $TEST_SCRIPT
# Now test Python 3.6.
# Install miniconda.
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda3.sh
bash miniconda3.sh -b -p $HOME/miniconda3
# Find the right wheel by grepping for the Python version.
PYTHON_WHEEL=$(find $ROOT_DIR/../.whl -type f -maxdepth 1 -print | grep -m1 '36')
# Install the wheel.
$HOME/miniconda3/bin/pip install $PYTHON_WHEEL
# Run a simple test script to make sure that the wheel works.
$HOME/miniconda3/bin/python $TEST_SCRIPT
# Check that the other wheels are present.
NUMBER_OF_WHEELS=$(ls -1q $ROOT_DIR/../.whl/*.whl | wc -l)
if [[ "$NUMBER_OF_WHEELS" != "4" ]]; then
echo "Wrong number of wheels found."
ls -l $ROOT_DIR/../.whl/
exit 1
fi
elif [[ "$platform" == "macosx" ]]; then
MACPYTHON_PY_PREFIX=/Library/Frameworks/Python.framework/Versions
PY_MMS=("2.7"
"3.4"
"3.5"
"3.6")
# This array is just used to find the right wheel.
PY_WHEEL_VERSIONS=("27"
"34"
"35"
"36")
for ((i=0; i<${#PY_MMS[@]}; ++i)); do
PY_MM=${PY_MMS[i]}
PY_WHEEL_VERSION=${PY_WHEEL_VERSIONS[i]}
PYTHON_EXE=$MACPYTHON_PY_PREFIX/$PY_MM/bin/python$PY_MM
PIP_CMD="$(dirname $PYTHON_EXE)/pip$PY_MM"
# Find the appropriate wheel by grepping for the Python version.
PYTHON_WHEEL=$(find $ROOT_DIR/../.whl -type f -maxdepth 1 -print | grep -m1 "$PY_WHEEL_VERSION")
# Install the wheel.
$PIP_CMD install $PYTHON_WHEEL
# Run a simple test script to make sure that the wheel works.
$PYTHON_EXE $TEST_SCRIPT
done
else
echo "Unrecognized environment."
exit 1
fi