8
8
9
9
ROOT_DIR=$( cd " $( dirname " $0 " ) /$( dirname " $( test -L " $0 " && readlink " $0 " || echo " /" ) " ) " ; pwd)
10
10
11
- platform=" "
12
- case " ${OSTYPE} " in
13
- linux* ) platform=" linux" ;;
14
- darwin* ) platform=" macosx" ;;
15
- msys* ) platform=" windows" ;;
16
- * ) echo " Unrecognized platform." ; exit 1;;
17
- esac
11
+ if [[ ! " ${OSTYPE} " =~ ^darwin ]]; then
12
+ echo " ERROR: This wheel test script is only for MacOS platforms." > /dev/stderr
13
+ exit 1
14
+ fi
18
15
19
16
BUILD_DIR=" ${TRAVIS_BUILD_DIR-} "
20
- if [ -z " ${BUILD_DIR} " ]; then
17
+ if [[ -z " ${BUILD_DIR} " ] ]; then
21
18
BUILD_DIR=" ${GITHUB_WORKSPACE} "
22
19
fi
23
- if [ -n " ${BUILDKITE-} " ]; then
20
+ if [[ -n " ${BUILDKITE-} " ] ]; then
24
21
BUILD_DIR=" ${ROOT_DIR} /../.."
25
22
fi
26
23
TEST_DIR=" ${BUILD_DIR} /python/ray/tests"
@@ -45,66 +42,59 @@ function retry {
45
42
done
46
43
}
47
44
48
- if [[ " $platform " == " macosx" ]]; then
49
- MACPYTHON_PY_PREFIX=/Library/Frameworks/Python.framework/Versions
45
+ MACPYTHON_PY_PREFIX=/Library/Frameworks/Python.framework/Versions
50
46
51
- PY_WHEEL_VERSIONS=(" 39" " 310" )
52
- PY_MMS=(" 3.9" " 3.10" )
47
+ PY_WHEEL_VERSIONS=(" 39" " 310" )
48
+ PY_MMS=(" 3.9" " 3.10" )
53
49
54
- for (( i= 0 ; i< ${# PY_MMS[@]} ; ++ i)) ; do
55
- PY_MM=" ${PY_MMS[i]} "
50
+ for (( i= 0 ; i< ${# PY_MMS[@]} ; ++ i)) ; do
51
+ PY_MM=" ${PY_MMS[i]} "
56
52
57
- PY_WHEEL_VERSION=" ${PY_WHEEL_VERSIONS[i]} "
53
+ PY_WHEEL_VERSION=" ${PY_WHEEL_VERSIONS[i]} "
58
54
59
- # Todo: The main difference between arm64 and x86_64 is
60
- # the Mac OS version. We should move everything to a
61
- # single path when it's acceptable to move up our lower
62
- # Python + MacOS compatibility bound.
63
- if [ " $( uname -m) " = " arm64" ]; then
64
- CONDA_ENV_NAME=" test-wheels-p$PY_MM "
55
+ # Todo: The main difference between arm64 and x86_64 is
56
+ # the Mac OS version. We should move everything to a
57
+ # single path when it's acceptable to move up our lower
58
+ # Python + MacOS compatibility bound.
59
+ if [[ " $( uname -m) " == " arm64" ] ]; then
60
+ CONDA_ENV_NAME=" test-wheels-p$PY_MM "
65
61
66
- [ -f " $HOME /.bash_profile" ] && conda init bash
62
+ [[ -f " $HOME /.bash_profile" ] ] && conda init bash
67
63
68
- source ~ /.bash_profile
64
+ source ~ /.bash_profile
69
65
70
- conda create -y -n " $CONDA_ENV_NAME "
71
- conda activate " $CONDA_ENV_NAME "
72
- conda remove -y python || true
73
- conda install -y python=" ${PY_MM} "
66
+ conda create -y -n " $CONDA_ENV_NAME "
67
+ conda activate " $CONDA_ENV_NAME "
68
+ conda remove -y python || true
69
+ conda install -y python=" ${PY_MM} "
74
70
75
- PYTHON_EXE=" /opt/homebrew/opt/miniconda/envs/${CONDA_ENV_NAME} /bin/python"
76
- PIP_CMD=" /opt/homebrew/opt/miniconda/envs/${CONDA_ENV_NAME} /bin/pip"
77
- else
78
- PYTHON_EXE=" $MACPYTHON_PY_PREFIX /$PY_MM /bin/python$PY_MM "
79
- PIP_CMD=" $( dirname " $PYTHON_EXE " ) /pip$PY_MM "
80
- fi
71
+ PYTHON_EXE=" /opt/homebrew/opt/miniconda/envs/${CONDA_ENV_NAME} /bin/python"
72
+ PIP_CMD=" /opt/homebrew/opt/miniconda/envs/${CONDA_ENV_NAME} /bin/pip"
73
+ else
74
+ PYTHON_EXE=" $MACPYTHON_PY_PREFIX /$PY_MM /bin/python$PY_MM "
75
+ PIP_CMD=" $( dirname " $PYTHON_EXE " ) /pip$PY_MM "
76
+ fi
81
77
82
- # Find the appropriate wheel by grepping for the Python version.
83
- PYTHON_WHEEL=" $( printf " %s\n" " $ROOT_DIR " /../../.whl/* " cp$PY_WHEEL_VERSION -cp$PY_WHEEL_VERSION " * | head -n 1) "
78
+ # Find the appropriate wheel by grepping for the Python version.
79
+ PYTHON_WHEEL=" $( printf " %s\n" " $ROOT_DIR " /../../.whl/* " cp$PY_WHEEL_VERSION -cp$PY_WHEEL_VERSION " * | head -n 1) "
84
80
85
- # Print some env info
86
- " $PYTHON_EXE " --version
87
- " $PYTHON_EXE " -c " from distutils import util; print(util.get_platform())" || true
81
+ # Print some env info
82
+ " $PYTHON_EXE " --version
83
+ " $PYTHON_EXE " -c " from distutils import util; print(util.get_platform())" || true
88
84
89
- # Update pip
90
- " $PIP_CMD " install -U pip
85
+ # Update pip
86
+ " $PIP_CMD " install -U pip
91
87
92
- # Install the wheel.
93
- " $PIP_CMD " uninstall -y ray
94
- " $PIP_CMD " install -q " $PYTHON_WHEEL "
88
+ # Install the wheel.
89
+ " $PIP_CMD " uninstall -y ray
90
+ " $PIP_CMD " install -q " $PYTHON_WHEEL "
95
91
96
- # Install the dependencies to run the tests.
97
- " $PIP_CMD " install -q aiohttp numpy ' pytest==7.0.1' requests proxy.py
92
+ # Install the dependencies to run the tests.
93
+ " $PIP_CMD " install -q aiohttp numpy ' pytest==7.0.1' requests proxy.py
98
94
99
- # Run a simple test script to make sure that the wheel works.
100
- # We set the python path to prefer the directory of the wheel content: https://github.com/ray-project/ray/pull/30090
101
- for SCRIPT in " ${TEST_SCRIPTS[@]} " ; do
102
- PY_IGNORE_IMPORTMISMATCH=1 PATH=" $( dirname " $PYTHON_EXE " ) :$PATH " retry " $PYTHON_EXE " " $SCRIPT "
103
- done
95
+ # Run a simple test script to make sure that the wheel works.
96
+ # We set the python path to prefer the directory of the wheel content: https://github.com/ray-project/ray/pull/30090
97
+ for SCRIPT in " ${TEST_SCRIPTS[@]} " ; do
98
+ PY_IGNORE_IMPORTMISMATCH=1 PATH=" $( dirname " $PYTHON_EXE " ) :$PATH " retry " $PYTHON_EXE " " $SCRIPT "
104
99
done
105
- elif [ " ${platform} " = windows ]; then
106
- echo " WARNING: Wheel testing not yet implemented for Windows."
107
- else
108
- echo " Unrecognized environment."
109
- exit 3
110
- fi
100
+ done
0 commit comments