#!/bin/bash
set -e
set -x
DOWNLOAD_DIR=python_downloads
NODE_VERSION="14"
PY_MMS=("3.9" "3.10" "3.11" "3.12" "3.13")
if [[ -n "${SKIP_DEP_RES}" ]]; then
./ci/env/install-bazel.sh
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
if [ "$(uname -m)" = "arm64" ]; then
curl -o- https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh | bash
else
curl -sSL -o- https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-x86_64.sh | bash
fi
conda init bash
source ~/.bash_profile
source "$HOME"/.nvm/nvm.sh
nvm install $NODE_VERSION
nvm use $NODE_VERSION
fi
pushd python/ray/dashboard/client
source "$HOME"/.nvm/nvm.sh
npm ci
npm run build
popd
mkdir -p .whl
for ((i=0; i<${#PY_MMS[@]}; ++i)); do
PY_MM=${PY_MMS[i]}
CONDA_ENV_NAME="p$PY_MM"
git clean -f -f -x -d -e .whl -e $DOWNLOAD_DIR -e python/ray/dashboard/client -e dashboard/client
[ ! -f "$HOME/.bash_profile" ] && conda init bash
source ~/.bash_profile
conda create -y -n "$CONDA_ENV_NAME"
conda activate "$CONDA_ENV_NAME"
conda remove -y python || true
conda install -y python="$PY_MM"
PIP_CMD=pip
$PIP_CMD install --upgrade pip
if [ -z "${TRAVIS_COMMIT}" ]; then
TRAVIS_COMMIT=${BUILDKITE_COMMIT}
fi
pushd python
$PIP_CMD install --upgrade setuptools==69.5.1
$PIP_CMD install -q cython==3.0.12
$PIP_CMD install -q wheel
if [ -n "$TRAVIS_COMMIT" ]; then
echo "TRAVIS_COMMIT variable detected. ray.__commit__ will be set to $TRAVIS_COMMIT"
else
echo "TRAVIS_COMMIT variable is not set, getting the current commit from git."
TRAVIS_COMMIT=$(git rev-parse HEAD)
fi
sed -i .bak "s/{{RAY_COMMIT_SHA}}/$TRAVIS_COMMIT/g" ray/_version.py && rm ray/_version.py.bak
$PIP_CMD wheel -q -w dist . --no-deps
RAY_INSTALL_CPP=1 $PIP_CMD wheel -q -w dist . --no-deps
mv dist/*.whl ../.whl/
popd
conda deactivate
conda env remove -y -n "$CONDA_ENV_NAME"
done