diff --git a/ci/build_cpp.sh b/ci/build_cpp.sh index d7af96b636..a5ee279770 100755 --- a/ci/build_cpp.sh +++ b/ci/build_cpp.sh @@ -19,6 +19,7 @@ RAPIDS_PACKAGE_VERSION=$(rapids-generate-version) export RAPIDS_PACKAGE_VERSION # populates `RATTLER_CHANNELS` array and `RATTLER_ARGS` array +source ./ci/use_conda_packages_from_prs.sh source rapids-rattler-channel-string # --no-build-id allows for caching with `sccache` diff --git a/ci/build_docs.sh b/ci/build_docs.sh index 2404d96dc1..efd8e472c5 100755 --- a/ci/build_docs.sh +++ b/ci/build_docs.sh @@ -4,6 +4,7 @@ set -euo pipefail rapids-logger "Downloading artifacts from previous jobs" +source ./ci/use_conda_packages_from_prs.sh CPP_CHANNEL=$(rapids-download-from-github "$(rapids-artifact-name conda_cpp libcuml cuml --cuda "$RAPIDS_CUDA_VERSION")") PYTHON_CHANNEL=$(rapids-download-from-github "$(rapids-artifact-name conda_python cuml cuml --stable --cuda "$RAPIDS_CUDA_VERSION")") @@ -21,6 +22,12 @@ rapids-dependency-file-generator \ --output conda \ --file-key docs \ --matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch);py=${RAPIDS_PY_VERSION}" \ + --prepend-channel "${LIBRAFT_CHANNEL}" \ + --prepend-channel "${RAFT_CHANNEL}" \ + --prepend-channel "${LIBCUVS_CHANNEL}" \ + --prepend-channel "${CUVS_CHANNEL}" \ + --prepend-channel "${LIBNVFOREST_CHANNEL}" \ + --prepend-channel "${NVFOREST_CHANNEL}" \ --prepend-channel "${CPP_CHANNEL}" \ --prepend-channel "${PYTHON_CHANNEL}" \ | tee env.yaml diff --git a/ci/build_python.sh b/ci/build_python.sh index 62c7947189..a6d36801b3 100755 --- a/ci/build_python.sh +++ b/ci/build_python.sh @@ -21,6 +21,7 @@ RAPIDS_PACKAGE_VERSION=$(head -1 ./VERSION) export RAPIDS_PACKAGE_VERSION # populates `RATTLER_CHANNELS` array and `RATTLER_ARGS` array +source ./ci/use_conda_packages_from_prs.sh source rapids-rattler-channel-string rapids-logger "Prepending channel ${CPP_CHANNEL} to RATTLER_CHANNELS" diff --git a/ci/build_wheel_cuml.sh b/ci/build_wheel_cuml.sh index 0178d3d421..6187255562 100755 --- a/ci/build_wheel_cuml.sh +++ b/ci/build_wheel_cuml.sh @@ -11,6 +11,8 @@ package_dir="python/cuml" RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen "${RAPIDS_CUDA_VERSION}")" +source ./ci/use_wheels_from_prs.sh + # Download the libcuml wheel built in the previous step and make it # available for pip to find. # diff --git a/ci/build_wheel_libcuml.sh b/ci/build_wheel_libcuml.sh index 78dcd38969..7085d5bab9 100755 --- a/ci/build_wheel_libcuml.sh +++ b/ci/build_wheel_libcuml.sh @@ -18,6 +18,8 @@ rapids-dependency-file-generator \ --matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch);py=${RAPIDS_PY_VERSION};cuda_suffixed=true" \ | tee /tmp/requirements-build.txt +source ./ci/use_wheels_from_prs.sh + rapids-logger "Installing build requirements" rapids-pip-retry install \ -v \ diff --git a/ci/test_cpp.sh b/ci/test_cpp.sh index e31178f75b..9a280ba32f 100755 --- a/ci/test_cpp.sh +++ b/ci/test_cpp.sh @@ -13,13 +13,21 @@ rapids-logger "Configuring conda strict channel priority" conda config --set channel_priority strict rapids-logger "Downloading artifacts from previous jobs" +source ./ci/use_conda_packages_from_prs.sh CPP_CHANNEL=$(rapids-download-from-github "$(rapids-artifact-name conda_cpp libcuml cuml --cuda "$RAPIDS_CUDA_VERSION")") rapids-logger "Generate C++ testing dependencies" +source ./ci/use_conda_packages_from_prs.sh rapids-dependency-file-generator \ --output conda \ --file-key test_cpp \ --matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch)" \ + --prepend-channel "${LIBRAFT_CHANNEL}" \ + --prepend-channel "${RAFT_CHANNEL}" \ + --prepend-channel "${LIBCUVS_CHANNEL}" \ + --prepend-channel "${CUVS_CHANNEL}" \ + --prepend-channel "${LIBNVFOREST_CHANNEL}" \ + --prepend-channel "${NVFOREST_CHANNEL}" \ --prepend-channel "${CPP_CHANNEL}" | tee env.yaml rapids-mamba-retry env create --yes -f env.yaml -n test diff --git a/ci/test_notebooks.sh b/ci/test_notebooks.sh index 825f6ec473..69fd8b5c9a 100755 --- a/ci/test_notebooks.sh +++ b/ci/test_notebooks.sh @@ -9,15 +9,23 @@ rapids-logger "Configuring conda strict channel priority" conda config --set channel_priority strict rapids-logger "Downloading artifacts from previous jobs" +source ./ci/use_conda_packages_from_prs.sh CPP_CHANNEL=$(rapids-download-from-github "$(rapids-artifact-name conda_cpp libcuml cuml --cuda "$RAPIDS_CUDA_VERSION")") PYTHON_CHANNEL=$(rapids-download-from-github "$(rapids-artifact-name conda_python cuml cuml --stable --cuda "$RAPIDS_CUDA_VERSION")") rapids-logger "Generate Notebook testing dependencies" +source ./ci/use_conda_packages_from_prs.sh rapids-dependency-file-generator \ --output conda \ --file-key test_notebooks \ --matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch);py=${RAPIDS_PY_VERSION}" \ + --prepend-channel "${LIBRAFT_CHANNEL}" \ + --prepend-channel "${RAFT_CHANNEL}" \ + --prepend-channel "${LIBCUVS_CHANNEL}" \ --prepend-channel "${CPP_CHANNEL}" \ + --prepend-channel "${CUVS_CHANNEL}" \ + --prepend-channel "${LIBNVFOREST_CHANNEL}" \ + --prepend-channel "${NVFOREST_CHANNEL}" \ --prepend-channel "${PYTHON_CHANNEL}" | tee env.yaml rapids-mamba-retry env create --yes -f env.yaml -n test diff --git a/ci/test_python_common.sh b/ci/test_python_common.sh index fa754c73b3..c7993d191f 100644 --- a/ci/test_python_common.sh +++ b/ci/test_python_common.sh @@ -10,15 +10,23 @@ rapids-logger "Configuring conda strict channel priority" conda config --set channel_priority strict rapids-logger "Downloading artifacts from previous jobs" +source ./ci/use_conda_packages_from_prs.sh CPP_CHANNEL=$(rapids-download-from-github "$(rapids-artifact-name conda_cpp libcuml cuml --cuda "$RAPIDS_CUDA_VERSION")") PYTHON_CHANNEL=$(rapids-download-from-github "$(rapids-artifact-name conda_python cuml cuml --stable --cuda "$RAPIDS_CUDA_VERSION")") rapids-logger "Generate Python testing dependencies" +source ./ci/use_conda_packages_from_prs.sh rapids-dependency-file-generator \ --output conda \ --file-key "${DEPENDENCY_FILE_KEY:-test_python}" \ --matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch);py=${RAPIDS_PY_VERSION};dependencies=${RAPIDS_DEPENDENCIES}" \ + --prepend-channel "${LIBRAFT_CHANNEL}" \ + --prepend-channel "${RAFT_CHANNEL}" \ + --prepend-channel "${LIBCUVS_CHANNEL}" \ --prepend-channel "${CPP_CHANNEL}" \ + --prepend-channel "${CUVS_CHANNEL}" \ + --prepend-channel "${LIBNVFOREST_CHANNEL}" \ + --prepend-channel "${NVFOREST_CHANNEL}" \ --prepend-channel "${PYTHON_CHANNEL}" | tee env.yaml rapids-mamba-retry env create --yes -f env.yaml -n test diff --git a/ci/test_wheel.sh b/ci/test_wheel.sh index f0afcd1159..9d014f2a65 100755 --- a/ci/test_wheel.sh +++ b/ci/test_wheel.sh @@ -6,6 +6,7 @@ set -euo pipefail source rapids-init-pip +source ./ci/use_wheels_from_prs.sh LIBCUML_WHEELHOUSE=$(rapids-download-from-github "$(rapids-artifact-name wheel_cpp libcuml cuml --cuda "$RAPIDS_CUDA_VERSION")") CUML_WHEELHOUSE=$(rapids-download-from-github "$(rapids-artifact-name wheel_python cuml cuml --stable --cuda "$RAPIDS_CUDA_VERSION")") diff --git a/ci/test_wheel_dask.sh b/ci/test_wheel_dask.sh index c91b1d5ee5..5eb47113e0 100755 --- a/ci/test_wheel_dask.sh +++ b/ci/test_wheel_dask.sh @@ -6,6 +6,7 @@ set -euo pipefail source rapids-init-pip +source ./ci/use_wheels_from_prs.sh LIBCUML_WHEELHOUSE=$(rapids-download-from-github "$(rapids-artifact-name wheel_cpp libcuml cuml --cuda "$RAPIDS_CUDA_VERSION")") CUML_WHEELHOUSE=$(rapids-download-from-github "$(rapids-artifact-name wheel_python cuml cuml --stable --cuda "$RAPIDS_CUDA_VERSION")") RAPIDS_TESTS_DIR=${RAPIDS_TESTS_DIR:-"${PWD}/test-results"} diff --git a/ci/test_wheel_integrations.sh b/ci/test_wheel_integrations.sh index 1fcd20b0a8..7aa0d4f145 100755 --- a/ci/test_wheel_integrations.sh +++ b/ci/test_wheel_integrations.sh @@ -6,6 +6,7 @@ set -euo pipefail source rapids-init-pip +source ./ci/use_wheels_from_prs.sh LIBCUML_WHEELHOUSE=$(rapids-download-from-github "$(rapids-artifact-name wheel_cpp libcuml cuml --cuda "$RAPIDS_CUDA_VERSION")") CUML_WHEELHOUSE=$(rapids-download-from-github "$(rapids-artifact-name wheel_python cuml cuml --stable --cuda "$RAPIDS_CUDA_VERSION")") RAPIDS_TESTS_DIR=${RAPIDS_TESTS_DIR:-"${PWD}/test-results"} diff --git a/ci/use_conda_packages_from_prs.sh b/ci/use_conda_packages_from_prs.sh new file mode 100755 index 0000000000..4cbcab3807 --- /dev/null +++ b/ci/use_conda_packages_from_prs.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION. +# SPDX-License-Identifier: Apache-2.0 + +# download CI artifacts +LIBRAFT_CHANNEL=$(rapids-get-pr-artifact raft 3052 cpp conda) +RAFT_CHANNEL=$(rapids-get-pr-artifact raft 3052 python conda) +LIBCUVS_CHANNEL=$(rapids-get-pr-artifact cuvs 2227 cpp conda) +CUVS_CHANNEL=$(rapids-get-pr-artifact cuvs 2227 python conda) +LIBNVFOREST_CHANNEL=$(rapids-get-pr-artifact nvforest 156 cpp conda) +NVFOREST_CHANNEL=$(rapids-get-pr-artifact nvforest 156 python conda) + +# For `rattler` builds: +# +# Add these channels to the array checked by 'rapids-rattler-channel-string'. +# This ensures that when conda packages are built with strict channel priority enabled, +# the locally-downloaded packages will be preferred to remote packages (e.g. nightlies). +# +RAPIDS_PREPENDED_CONDA_CHANNELS=( + "${LIBRAFT_CHANNEL}" + "${RAFT_CHANNEL}" + "${LIBCUVS_CHANNEL}" + "${CUVS_CHANNEL}" + "${LIBNVFOREST_CHANNEL}" + "${NVFOREST_CHANNEL}" +) +export RAPIDS_PREPENDED_CONDA_CHANNELS + +# For tests and `conda-build` builds: +# +# Add these channels to the system-wide conda configuration. +# This results in PREPENDING them to conda's channel list, so +# these packages should be found first if strict channel priority is enabled. +# +for _channel in "${RAPIDS_PREPENDED_CONDA_CHANNELS[@]}" +do + conda config --system --add channels "${_channel}" +done diff --git a/ci/use_wheels_from_prs.sh b/ci/use_wheels_from_prs.sh new file mode 100755 index 0000000000..8979aa3f53 --- /dev/null +++ b/ci/use_wheels_from_prs.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION. +# SPDX-License-Identifier: Apache-2.0 + +# initialize PIP_CONSTRAINT +source rapids-init-pip + +RAPIDS_PY_CUDA_SUFFIX=$(rapids-wheel-ctk-name-gen "${RAPIDS_CUDA_VERSION}") + +# download wheels, store the directories holding them in variables +LIBRAFT_WHEELHOUSE=$(rapids-get-pr-artifact raft 3052 cpp wheel) +PYLIBRAFT_WHEELHOUSE=$(rapids-get-pr-artifact raft 3052 python wheel --pkg_name pylibraft) +RAFT_DASK_WHEELHOUSE=$(rapids-get-pr-artifact raft 3052 python wheel --pkg_name raft_dask) +LIBCUVS_WHEELHOUSE=$(rapids-get-pr-artifact cuvs 2227 cpp wheel) +CUVS_WHEELHOUSE=$(rapids-get-pr-artifact cuvs 2227 python wheel) +LIBNVFOREST_WHEELHOUSE=$(rapids-get-pr-artifact nvforest 156 cpp wheel) +NVFOREST_WHEELHOUSE=$(rapids-get-pr-artifact nvforest 156 python wheel) + +# write a pip constraints file saying e.g. "whenever you encounter a requirement for 'librmm-cu12', use this wheel" +cat > "${PIP_CONSTRAINT}" <