ray/doc/dev/bin/pip_download_test.sh
mehrdadn 56d2cf6479
Shellcheck rewrites (#9597)
* Fix SC2001: See if you can use ${variable//search/replace} instead.

* Fix SC2010: Don't use ls | grep. Use a glob or a for loop with a condition to allow non-alphanumeric filenames.

* Fix SC2012: Use find instead of ls to better handle non-alphanumeric filenames.

* Fix SC2015: Note that A && B || C is not if-then-else. C may run when A is true.

* Fix SC2028: echo may not expand escape sequences. Use printf.

* Fix SC2034: variable appears unused. Verify use (or export if used externally).

* Fix SC2035: Use ./*glob* or -- *glob* so names with dashes won't become options.

* Fix SC2071: > is for string comparisons. Use -gt instead.

* Fix SC2154: variable is referenced but not assigned

* Fix SC2164: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

* Fix SC2188: This redirection doesn't have a command. Move to its command (or use 'true' as no-op).

* Fix SC2236: Use -n instead of ! -z.

* Fix SC2242: Can only exit with status 0-255. Other data should be written to stdout/stderr.

* Fix SC2086: Double quote to prevent globbing and word splitting.

Co-authored-by: Mehrdad <noreply@github.com>
2020-07-24 17:24:19 -05:00

66 lines
1.8 KiB
Bash
Executable file

#!/usr/bin/env bash
# This script automatically download ray and run the sanity check (sanity_check.py)
# in various Python version. This script requires conda command to exist.
if [[ -z "$RAY_HASH" ]]; then
echo "RAY_HASH env var should be provided"
exit 1
fi
if [[ -z "$RAY_VERSION" ]]; then
echo "RAY_VERSION env var should be provided"
exit 1
fi
if ! [ -x "$(command -v conda)" ]; then
echo "conda doesn't exist. Please download conda for this machine"
exit 1
else
echo "conda exists"
fi
echo "Start downloading Ray version ${RAY_VERSION} of commit ${RAY_HASH}"
pip install --upgrade pip
# This is required to use conda activate
source "$(conda info --base)/etc/profile.d/conda.sh"
for PYTHON_VERSION in "3.5" "3.6" "3.7" "3.8"
do
env_name="${RAY_VERSION}-${PYTHON_VERSION}-env"
conda create -y -n "${env_name}" python=${PYTHON_VERSION}
conda activate "${env_name}"
printf "\n\n\n"
echo "========================================================="
echo "Python version."
python --version
echo "This should be equal to ${PYTHON_VERSION}"
echo "========================================================="
printf "\n\n\n"
pip install redis==3.3.2
pip install msgpack==0.6.2
pip install ray
pip uninstall -y ray
pip install --index-url https://test.pypi.org/simple/ ray
failed=false
printf "\n\n\n"
echo "========================================================="
if python sanity_check.py; then
echo "PYTHON ${PYTHON_VERSION} succeed sanity check."
else
failed=true
fi
echo "========================================================="
printf "\n\n\n"
conda deactivate
conda remove -y --name "${env_name}" --all
if [ "$failed" = true ]; then
echo "PYTHON ${PYTHON_VERSION} failed sanity check."
exit 1
fi
done