2017-08-21 23:48:20 -07:00
|
|
|
#!/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
|
|
|
|
|
2022-06-01 17:52:31 +00:00
|
|
|
ROOT_DIR=$(cd "$(dirname "$0")/$(dirname "$(test -L "$0" && readlink "$0" || echo "/")")"; pwd)
|
2017-08-21 23:48:20 -07:00
|
|
|
|
2020-04-29 21:19:02 -07:00
|
|
|
platform=""
|
|
|
|
case "${OSTYPE}" in
|
|
|
|
linux*) platform="linux";;
|
|
|
|
darwin*) platform="macosx";;
|
|
|
|
msys*) platform="windows";;
|
|
|
|
*) echo "Unrecognized platform."; exit 1;;
|
|
|
|
esac
|
2017-08-21 23:48:20 -07:00
|
|
|
|
2020-06-08 23:48:02 -07:00
|
|
|
BUILD_DIR="${TRAVIS_BUILD_DIR-}"
|
|
|
|
if [ -z "${BUILD_DIR}" ]; then
|
|
|
|
BUILD_DIR="${GITHUB_WORKSPACE}"
|
|
|
|
fi
|
2021-08-07 21:54:34 -07:00
|
|
|
if [ -n "${BUILDKITE-}" ]; then
|
|
|
|
BUILD_DIR="${ROOT_DIR}/../.."
|
|
|
|
fi
|
2020-06-08 23:48:02 -07:00
|
|
|
TEST_DIR="${BUILD_DIR}/python/ray/tests"
|
2020-04-01 10:03:23 -07:00
|
|
|
TEST_SCRIPTS=("$TEST_DIR/test_microbenchmarks.py" "$TEST_DIR/test_basic.py")
|
2020-10-23 16:52:14 -04:00
|
|
|
DASHBOARD_TEST_SCRIPT="${BUILD_DIR}/python/ray/tests/test_dashboard.py"
|
|
|
|
|
2017-08-21 23:48:20 -07:00
|
|
|
|
2020-04-01 10:03:23 -07:00
|
|
|
function retry {
|
|
|
|
local n=1
|
|
|
|
local max=3
|
|
|
|
|
|
|
|
while true; do
|
2020-07-24 15:24:19 -07:00
|
|
|
if "$@"; then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
if [ $n -lt $max ]; then
|
|
|
|
((n++))
|
|
|
|
echo "Command failed. Attempt $n/$max:"
|
|
|
|
else
|
|
|
|
echo "The command has failed after $n attempts."
|
|
|
|
exit 1
|
|
|
|
fi
|
2020-04-01 10:03:23 -07:00
|
|
|
done
|
|
|
|
}
|
2017-08-21 23:48:20 -07:00
|
|
|
|
2020-04-01 10:03:23 -07:00
|
|
|
if [[ "$platform" == "linux" ]]; then
|
2017-08-21 23:48:20 -07:00
|
|
|
# Install miniconda.
|
2021-06-21 12:02:22 -07:00
|
|
|
PY_WHEEL_VERSIONS=("36" "37" "38" "39")
|
|
|
|
PY_MMS=("3.6.13"
|
|
|
|
"3.7.10"
|
|
|
|
"3.8.10"
|
|
|
|
"3.9.5")
|
2020-04-01 10:03:23 -07:00
|
|
|
wget --quiet "https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh" -O miniconda3.sh
|
2020-04-29 21:19:02 -07:00
|
|
|
"${ROOT_DIR}"/../suppress_output bash miniconda3.sh -b -p "$HOME/miniconda3"
|
2020-04-01 10:03:23 -07:00
|
|
|
export PATH="$HOME/miniconda3/bin:$PATH"
|
|
|
|
|
|
|
|
for ((i=0; i<${#PY_MMS[@]}; ++i)); do
|
|
|
|
PY_MM="${PY_MMS[i]}"
|
|
|
|
PY_WHEEL_VERSION="${PY_WHEEL_VERSIONS[i]}"
|
|
|
|
|
|
|
|
conda install -y python="${PY_MM}"
|
|
|
|
|
|
|
|
PYTHON_EXE="$HOME/miniconda3/bin/python"
|
|
|
|
PIP_CMD="$HOME/miniconda3/bin/pip"
|
2019-09-21 18:03:10 -07:00
|
|
|
|
2020-04-01 10:03:23 -07:00
|
|
|
# Find the right wheel by grepping for the Python version.
|
2020-07-24 15:24:19 -07:00
|
|
|
PYTHON_WHEEL="$(printf "%s\n" "$ROOT_DIR"/../../.whl/*"$PY_WHEEL_VERSION"* | head -n 1)"
|
2017-08-21 23:48:20 -07:00
|
|
|
|
2020-04-01 10:03:23 -07:00
|
|
|
# Install the wheel.
|
|
|
|
"$PIP_CMD" install -q "$PYTHON_WHEEL"
|
2017-08-21 23:48:20 -07:00
|
|
|
|
2020-04-01 10:03:23 -07:00
|
|
|
# Check that ray.__commit__ was set properly.
|
|
|
|
"$PYTHON_EXE" -u -c "import ray; print(ray.__commit__)" | grep "$TRAVIS_COMMIT" || (echo "ray.__commit__ not set properly!" && exit 1)
|
2017-08-21 23:48:20 -07:00
|
|
|
|
2020-04-01 10:03:23 -07:00
|
|
|
# Install the dependencies to run the tests.
|
2022-07-19 12:21:19 +08:00
|
|
|
"$PIP_CMD" install -q aiohttp aiosignal frozenlist grpcio 'pytest==7.0.1' requests proxy.py
|
2020-02-26 17:54:23 -08:00
|
|
|
|
2020-04-01 10:03:23 -07:00
|
|
|
# Run a simple test script to make sure that the wheel works.
|
|
|
|
for SCRIPT in "${TEST_SCRIPTS[@]}"; do
|
|
|
|
retry "$PYTHON_EXE" "$SCRIPT"
|
|
|
|
done
|
2020-10-23 16:52:14 -04:00
|
|
|
retry "$PYTHON_EXE" "$DASHBOARD_TEST_SCRIPT"
|
2020-04-01 10:03:23 -07:00
|
|
|
done
|
2019-09-23 08:50:40 -07:00
|
|
|
|
2017-08-28 23:07:33 -07:00
|
|
|
# Check that the other wheels are present.
|
2020-07-24 15:24:19 -07:00
|
|
|
NUMBER_OF_WHEELS="$(find "$ROOT_DIR"/../../.whl/ -mindepth 1 -maxdepth 1 -name "*.whl" | wc -l)"
|
2021-06-10 10:20:30 -07:00
|
|
|
if [[ "$NUMBER_OF_WHEELS" != "4" ]]; then
|
2017-08-28 23:07:33 -07:00
|
|
|
echo "Wrong number of wheels found."
|
2019-09-21 18:03:10 -07:00
|
|
|
ls -l "$ROOT_DIR/../.whl/"
|
2018-11-29 11:05:24 -08:00
|
|
|
exit 2
|
2017-08-28 23:07:33 -07:00
|
|
|
fi
|
|
|
|
|
2017-08-21 23:48:20 -07:00
|
|
|
elif [[ "$platform" == "macosx" ]]; then
|
|
|
|
MACPYTHON_PY_PREFIX=/Library/Frameworks/Python.framework/Versions
|
2021-06-10 10:20:30 -07:00
|
|
|
PY_WHEEL_VERSIONS=("36" "37" "38" "39")
|
2020-07-23 19:26:06 -07:00
|
|
|
PY_MMS=("3.6"
|
2020-04-01 10:03:23 -07:00
|
|
|
"3.7"
|
2021-06-10 10:20:30 -07:00
|
|
|
"3.8"
|
|
|
|
"3.9")
|
2017-08-21 23:48:20 -07:00
|
|
|
|
|
|
|
for ((i=0; i<${#PY_MMS[@]}; ++i)); do
|
2020-04-01 10:03:23 -07:00
|
|
|
PY_MM="${PY_MMS[i]}"
|
|
|
|
|
|
|
|
PY_WHEEL_VERSION="${PY_WHEEL_VERSIONS[i]}"
|
2017-08-21 23:48:20 -07:00
|
|
|
|
2020-04-01 10:03:23 -07:00
|
|
|
PYTHON_EXE="$MACPYTHON_PY_PREFIX/$PY_MM/bin/python$PY_MM"
|
2019-09-21 18:03:10 -07:00
|
|
|
PIP_CMD="$(dirname "$PYTHON_EXE")/pip$PY_MM"
|
2017-08-21 23:48:20 -07:00
|
|
|
|
|
|
|
# Find the appropriate wheel by grepping for the Python version.
|
2020-07-24 15:24:19 -07:00
|
|
|
PYTHON_WHEEL="$(printf "%s\n" "$ROOT_DIR"/../../.whl/*"$PY_WHEEL_VERSION"* | head -n 1)"
|
2017-08-21 23:48:20 -07:00
|
|
|
|
|
|
|
# Install the wheel.
|
2021-08-18 08:32:35 -07:00
|
|
|
"$PIP_CMD" uninstall -y ray
|
2020-04-01 10:03:23 -07:00
|
|
|
"$PIP_CMD" install -q "$PYTHON_WHEEL"
|
2017-08-21 23:48:20 -07:00
|
|
|
|
2020-03-23 08:46:56 -07:00
|
|
|
# Install the dependencies to run the tests.
|
2022-07-19 12:21:19 +08:00
|
|
|
"$PIP_CMD" install -q aiohttp aiosignal frozenlist grpcio 'pytest==7.0.1' requests proxy.py
|
2020-03-23 08:46:56 -07:00
|
|
|
|
2017-08-21 23:48:20 -07:00
|
|
|
# Run a simple test script to make sure that the wheel works.
|
2020-04-01 10:03:23 -07:00
|
|
|
for SCRIPT in "${TEST_SCRIPTS[@]}"; do
|
2022-05-10 11:30:46 +08:00
|
|
|
PATH="$(dirname "$PYTHON_EXE"):$PATH" retry "$PYTHON_EXE" "$SCRIPT"
|
2020-04-01 10:03:23 -07:00
|
|
|
done
|
2017-08-21 23:48:20 -07:00
|
|
|
done
|
2020-04-29 21:19:02 -07:00
|
|
|
elif [ "${platform}" = windows ]; then
|
|
|
|
echo "WARNING: Wheel testing not yet implemented for Windows."
|
2017-08-21 23:48:20 -07:00
|
|
|
else
|
|
|
|
echo "Unrecognized environment."
|
2018-11-29 11:05:24 -08:00
|
|
|
exit 3
|
2017-08-21 23:48:20 -07:00
|
|
|
fi
|