From 5407038e9eb20a92f15cf3658b2ad665723272e8 Mon Sep 17 00:00:00 2001 From: andrewwhitecdw Date: Thu, 13 Aug 2026 17:45:14 -0500 Subject: [PATCH] fix: clear bindings dir before adding prior wheel Signed-off-by: andrewwhitecdw --- .github/workflows/build-wheel.yml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-wheel.yml b/.github/workflows/build-wheel.yml index 390d6f88ae2..bf853bb6a7b 100644 --- a/.github/workflows/build-wheel.yml +++ b/.github/workflows/build-wheel.yml @@ -587,12 +587,14 @@ jobs: OLD_BRANCH=$(yq '.backport_branch' ci/versions.yml) OLD_BASENAME="cuda-bindings-python${PYTHON_VERSION_FORMATTED}-cuda*-${{ inputs.host-platform }}*" LATEST_PRIOR_RUN_ID=$(./ci/tools/lookup-run-id --branch "${OLD_BRANCH}" NVIDIA/cuda-python "CI") - PREV_BINDINGS_DIR="cuda_bindings/dist-prev" + PREV_BINDINGS_DIR="${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}" gh run download $LATEST_PRIOR_RUN_ID -p ${OLD_BASENAME} -R NVIDIA/cuda-python rm -rf ${OLD_BASENAME}-tests # exclude cython test artifacts ls -al $OLD_BASENAME mkdir -p "${PREV_BINDINGS_DIR}" + # Clear any current-CUDA wheel so only the prior wheel is staged. + rm -f "${PREV_BINDINGS_DIR}"/*.whl mv $OLD_BASENAME/*.whl "${PREV_BINDINGS_DIR}" rmdir $OLD_BASENAME @@ -600,7 +602,7 @@ jobs: if: ${{ inputs.build-core }} run: | pathfinder_wheels=(cuda_pathfinder/cuda_pathfinder-*.whl) - bindings_wheels=(cuda_bindings/dist-prev/cuda_bindings-"${BUILD_PREV_CUDA_MAJOR}".*.whl) + bindings_wheels=("${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}"/cuda_bindings-"${BUILD_PREV_CUDA_MAJOR}".*.whl) test "${#pathfinder_wheels[@]}" -eq 1 test "${#bindings_wheels[@]}" -eq 1 test -f "${pathfinder_wheels[0]}" @@ -618,6 +620,20 @@ jobs: printf 'cuda-bindings @ %s\n' "${bindings_uri}" } | tee wheel-constraints/cuda-core-prev.txt + - name: Verify prior cuda.bindings staging + if: ${{ inputs.build-core }} + run: | + # Ensure the staging directory contains exactly one wheel so pip cannot + # accidentally resolve a different cuda.bindings version. + shopt -s nullglob + whl_files=("${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}"/*.whl) + shopt -u nullglob + if [[ "${#whl_files[@]}" -ne 1 ]]; then + echo "Expected exactly one wheel in ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}, found ${#whl_files[@]}:" + ls -la "${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}" + exit 1 + fi + - name: Build cuda.core wheel if: ${{ inputs.build-core }} uses: pypa/cibuildwheel@4726cd35bb13f7bde50cf2761f2499ac7b3aa32c # v4.1.1