sanity_check_windows.sh 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/usr/bin/env bash
  2. # This script automatically download ray and run the sanity check for Windows
  3. # in various Python version. This script requires conda command to exist.
  4. export RAY_HASH="$RAY_HASH"
  5. export RAY_VERSION="$RAY_VERSION"
  6. if [[ -z "$RAY_HASH" ]]; then
  7. echo "RAY_HASH env var should be provided"
  8. exit 1
  9. fi
  10. if [[ -z "$RAY_VERSION" ]]; then
  11. echo "RAY_VERSION env var should be provided"
  12. exit 1
  13. fi
  14. if [[ ! -x "$(command -v conda)" ]]; then
  15. echo "conda doesn't exist. Please download conda for this machine"
  16. exit 1
  17. else
  18. echo "conda exists"
  19. fi
  20. echo "Start downloading Ray version ${RAY_VERSION} of commit ${RAY_HASH}"
  21. pip install --upgrade pip
  22. # This is required to use conda activate
  23. source "$(conda info --base)/etc/profile.d/conda.sh"
  24. PYTHON_VERSIONS=( "3.9" "3.10" "3.11" "3.12" )
  25. for PYTHON_VERSION in "${PYTHON_VERSIONS[@]}"; do
  26. ENV_NAME="${RAY_VERSION}-${PYTHON_VERSION}-env"
  27. conda create -y -n "${ENV_NAME}" python="${PYTHON_VERSION}"
  28. conda activate "${ENV_NAME}"
  29. printf "\n\n\n"
  30. echo "========================================================="
  31. echo "Python version."
  32. python --version
  33. echo "This should be equal to ${PYTHON_VERSION}"
  34. echo "========================================================="
  35. printf "\n\n\n"
  36. pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple "ray[cpp]==${RAY_VERSION}"
  37. FAILED="false"
  38. printf "\n\n\n"
  39. echo "========================================================="
  40. if python sanity_check.py --ray_version="$RAY_VERSION" --ray_commit="$RAY_HASH"; then
  41. echo "PYTHON ${PYTHON_VERSION} succeed sanity check."
  42. else
  43. FAILED="true"
  44. fi
  45. echo "========================================================="
  46. printf "\n\n\n"
  47. conda deactivate
  48. conda remove -y --name "${ENV_NAME}" --all
  49. if [[ "$FAILED" == "true" ]]; then
  50. echo "PYTHON ${PYTHON_VERSION} failed sanity check."
  51. exit 1
  52. fi
  53. done