Skip to content

Commit 2591b14

Browse files
committed
ci: sync release-upload.yml with main and add download-wheels script
Sync release-upload.yml to match main by adding run-id and component inputs and a 'Download and Upload Wheels' step that downloads wheels via ci/tools/download-wheels, validates them via validate-release-wheels, and uploads them to the GitHub Release. Also add the ci/tools/download-wheels helper script (from main) and wire up release.yml to pass run-id and component to the upload-archive job. Fixes NVIDIA#1120: the download-wheels script now exists on the backport branch, so the release-upload workflow no longer fails with 'No such file or directory'.
1 parent b8f04c7 commit 2591b14

3 files changed

Lines changed: 102 additions & 0 deletions

File tree

‎.github/workflows/release-upload.yml‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ on:
1010
git-tag:
1111
type: string
1212
required: true
13+
run-id:
14+
description: "The GHA run ID that generated validated artifacts"
15+
type: string
16+
required: true
17+
component:
18+
description: "Component to download wheels for"
19+
type: string
20+
required: true
1321

1422
concurrency:
1523
# Concurrency group that uses the workflow name and PR number if available
@@ -63,3 +71,19 @@ jobs:
6371
--clobber "${{ inputs.git-tag }}"
6472
--repo "${{ github.repository }}"
6573
release/*
74+
75+
- name: Download and Upload Wheels
76+
env:
77+
GH_TOKEN: ${{ github.token }}
78+
run: |
79+
# Use the shared script to download wheels
80+
./ci/tools/download-wheels "${{ inputs.run-id }}" "${{ inputs.component }}" "${{ github.repository }}" "release/wheels"
81+
82+
# Validate that release wheels match the expected version from tag.
83+
./ci/tools/validate-release-wheels "${{ inputs.git-tag }}" "${{ inputs.component }}" "release/wheels"
84+
85+
# Upload wheels to the release
86+
if [[ -d "release/wheels" && $(ls -A release/wheels 2>/dev/null | wc -l) -gt 0 ]]; then
87+
echo "Uploading wheels to release ${{ inputs.git-tag }}"
88+
gh release upload --clobber "${{ inputs.git-tag }}" --repo "${{ github.repository }}" release/wheels/*
89+
fi

‎.github/workflows/release.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,13 @@ jobs:
128128
contents: write
129129
needs:
130130
- check-tag
131+
- determine-run-id
131132
secrets: inherit
132133
uses: ./.github/workflows/release-upload.yml
133134
with:
134135
git-tag: ${{ inputs.git-tag }}
136+
run-id: ${{ needs.determine-run-id.outputs.run-id }}
137+
component: ${{ inputs.component }}
135138

136139
publish-wheels:
137140
name: Publish wheels

‎ci/tools/download-wheels‎

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/usr/bin/env bash
2+
3+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
4+
#
5+
# SPDX-License-Identifier: Apache-2.0
6+
7+
# A utility script to download component wheels from GitHub Actions artifacts.
8+
# This script reuses the same logic that was in release.yml to maintain consistency.
9+
10+
set -euo pipefail
11+
12+
# Check required arguments
13+
if [[ $# -lt 3 ]]; then
14+
echo "Usage: $0 <run-id> <component> <repository> [output-dir]" >&2
15+
echo " run-id: The GitHub Actions run ID containing the artifacts" >&2
16+
echo " component: The component name pattern to download (e.g., cuda-core, cuda-bindings)" >&2
17+
echo " repository: The GitHub repository (e.g., NVIDIA/cuda-python)" >&2
18+
echo " output-dir: Optional output directory (default: ./dist)" >&2
19+
exit 1
20+
fi
21+
22+
RUN_ID="$1"
23+
COMPONENT="$2"
24+
REPOSITORY="$3"
25+
OUTPUT_DIR="${4:-./dist}"
26+
27+
# Ensure we have a GitHub token
28+
if [[ -z "${GH_TOKEN:-}" ]]; then
29+
echo "Error: GH_TOKEN environment variable is required"
30+
exit 1
31+
fi
32+
33+
echo "Downloading wheels for component: $COMPONENT from run: $RUN_ID"
34+
35+
# Download component wheels using the same logic as release.yml
36+
if [[ "$COMPONENT" == "all" ]]; then
37+
# Download all component patterns
38+
gh run download "$RUN_ID" -p "cuda-*" -R "$REPOSITORY"
39+
else
40+
gh run download "$RUN_ID" -p "${COMPONENT}*" -R "$REPOSITORY"
41+
fi
42+
43+
# Create output directory
44+
mkdir -p "$OUTPUT_DIR"
45+
46+
# Process downloaded artifacts
47+
for p in cuda-*
48+
do
49+
if [[ ! -d "$p" ]]; then
50+
continue
51+
fi
52+
53+
# exclude cython test artifacts
54+
if [[ "${p}" == *-tests ]]; then
55+
echo "Skipping test artifact: $p"
56+
continue
57+
fi
58+
59+
# If we're not downloading "all", only process matching component
60+
if [[ "$COMPONENT" != "all" && "$p" != ${COMPONENT}* ]]; then
61+
continue
62+
fi
63+
64+
echo "Processing artifact: $p"
65+
# Move wheel files to output directory
66+
if [[ -d "$p" ]]; then
67+
find "$p" -name "*.whl" -exec mv {} "$OUTPUT_DIR/" \;
68+
fi
69+
done
70+
71+
# Clean up artifact directories
72+
rm -rf cuda-*
73+
74+
echo "Downloaded wheels to: $OUTPUT_DIR"
75+
ls -la "$OUTPUT_DIR"

0 commit comments

Comments
 (0)