17
17
description : S3 subdirectory, not including the GPU-family
18
18
required : true
19
19
type : string
20
+ s3_staging_subdir :
21
+ description : S3 staging subdirectory, not including the GPU-family
22
+ required : true
23
+ type : string
20
24
cloudfront_url :
21
25
description : CloudFront URL pointing to Python index
22
26
required : true
23
27
type : string
28
+ cloudfront_staging_url :
29
+ description : CloudFront base URL pointing to staging Python index
30
+ required : true
31
+ type : string
24
32
rocm_version :
25
33
description : ROCm version to pip install
26
34
type : string
47
55
description : S3 subdirectory, not including the GPU-family
48
56
type : string
49
57
default : " v2"
58
+ s3_staging_subdir :
59
+ description : S3 staging subdirectory, not including the GPU-family
60
+ type : string
61
+ default : " v2-staging"
50
62
cloudfront_url :
51
63
description : CloudFront base URL pointing to Python index
52
64
type : string
53
65
default : " https://d25kgig7rdsyks.cloudfront.net/v2"
66
+ cloudfront_staging_url :
67
+ description : CloudFront base URL pointing to staging Python index
68
+ type : string
69
+ default : " https://d25kgig7rdsyks.cloudfront.net/v2-staging"
54
70
rocm_version :
55
71
description : ROCm version to pip install
56
72
type : string
@@ -154,26 +170,24 @@ jobs:
154
170
# run: |
155
171
# python external-builds/pytorch/sanity_check_wheel.py ${{ env.PACKAGE_DIST_DIR }}
156
172
157
- - name : Upload wheels to S3
173
+ - name : Upload wheels to S3 staging
158
174
if : ${{ github.repository_owner == 'ROCm' }}
159
- # Using 'cmd' here since PACKAGE_DIST_DIR uses \ in paths instead of /
160
- shell : cmd
161
175
run : |
162
- aws s3 cp ${{ env.PACKAGE_DIST_DIR }}/ ^
163
- s3://${{ env.S3_BUCKET_PY }}/${{ inputs.s3_subdir }}/${{ inputs.amdgpu_family }}/ ^
176
+ aws s3 cp ${{ env.PACKAGE_DIST_DIR }}/ s3://${{ env.S3_BUCKET_PY }}/${{ inputs.s3_staging_subdir }}/${{ inputs.amdgpu_family }}/ \
164
177
--recursive --exclude "*" --include "*.whl"
165
178
166
- - name : (Re-)Generate Python package release index
179
+ - name : (Re-)Generate Python package release index for staging
167
180
if : ${{ github.repository_owner == 'ROCm' }}
168
181
run : |
169
182
pip install boto3 packaging
170
- python ./build_tools/third_party/s3_management/manage.py ${{ inputs.s3_subdir }}/${{ inputs.amdgpu_family }}
183
+ python ./build_tools/third_party/s3_management/manage.py ${{ inputs.s3_staging_subdir }}/${{ inputs.amdgpu_family }}
171
184
172
185
generate_target_to_run :
173
186
name : Generate target_to_run
174
187
runs-on : ubuntu-24.04
175
188
outputs :
176
189
test_runs_on : ${{ steps.configure.outputs.test-runs-on }}
190
+ bypass_tests_for_releases : ${{ steps.configure.outputs.bypass_tests_for_releases }}
177
191
steps :
178
192
- name : Checking out repository
179
193
uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
@@ -196,3 +210,75 @@ jobs:
196
210
cloudfront_url : ${{ inputs.cloudfront_url }}
197
211
python_version : ${{ inputs.python_version }}
198
212
torch_version : ${{ needs.build_pytorch_wheels.outputs.torch_version }}
213
+
214
+ upload_pytorch_wheels :
215
+ name : Release PyTorch Wheels to S3
216
+ needs : [build_pytorch_wheels, generate_target_to_run, test_pytorch_wheels]
217
+ if : always()
218
+ runs-on : ubuntu-24.04
219
+ env :
220
+ S3_BUCKET_PY : " therock-${{ inputs.release_type }}-python"
221
+ CP_VERSION : " ${{ needs.build_pytorch_wheels.outputs.cp_version }}"
222
+ TORCH_VERSION : " ${{ needs.build_pytorch_wheels.outputs.torch_version }}"
223
+ TORCHAUDIO_VERSION : " ${{ needs.build_pytorch_wheels.outputs.torchaudio_version }}"
224
+ TORCHVISION_VERSION : " ${{ needs.build_pytorch_wheels.outputs.torchvision_version }}"
225
+ TRITON_VERSION : " ${{ needs.build_pytorch_wheels.outputs.triton_version }}"
226
+
227
+ steps :
228
+ - name : Checkout
229
+ uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
230
+
231
+ - name : Configure AWS Credentials
232
+ if : always()
233
+ uses : aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4.3.1
234
+ with :
235
+ aws-region : us-east-2
236
+ role-to-assume : arn:aws:iam::692859939525:role/therock-${{ inputs.release_type }}-releases
237
+
238
+
239
+ - name : Determine upload flag
240
+ env :
241
+ BUILD_RESULT : ${{ needs.build_pytorch_wheels.result }}
242
+ TEST_RESULT : ${{ needs.test_pytorch_wheels.result }}
243
+ TEST_RUNS_ON : ${{ needs.generate_target_to_run.outputs.test_runs_on }}
244
+ BYPASS_TESTS_FOR_RELEASES : ${{ needs.generate_target_to_run.outputs.bypass_tests_for_releases }}
245
+ run : |
246
+ # 1) If the build failed → upload=false
247
+ if [[ "$BUILD_RESULT" != "success" ]]; then
248
+ echo "::warning::Build failed. Skipping upload."
249
+ echo "upload=false" >> "$GITHUB_ENV"
250
+
251
+ # 2) Else if there was a test runner AND tests failed or were skipped → upload=false
252
+ elif [[ -n "$TEST_RUNS_ON" && ( "$TEST_RESULT" == "failure" || "$TEST_RESULT" == "skipped" ) ]]; then
253
+ echo "::warning::Tests failed or were skipped (runner present). Skipping upload."
254
+ echo "upload=false" >> "$GITHUB_ENV"
255
+
256
+ # 3) Else if BYPASS_TESTS_FOR_RELEASES is not set and there was no test runner → upload=false
257
+ elif [[ -z "$BYPASS_TESTS_FOR_RELEASES" && -z "$TEST_RUNS_ON" ]]; then
258
+ echo "::warning::No test runner and BYPASS_TESTS_FOR_RELEASES not set. Skipping upload."
259
+ echo "upload=false" >> "$GITHUB_ENV"
260
+
261
+ # 4) Otherwise → upload=true
262
+ else
263
+ echo "upload=true" >> "$GITHUB_ENV"
264
+ fi
265
+
266
+ - name : Copy PyTorch wheels from staging to release S3
267
+ if : ${{ env.upload == 'true' }}
268
+ run : |
269
+ echo "Copying exact tested wheels to release S3 bucket..."
270
+ aws s3 cp \
271
+ s3://${S3_BUCKET_PY}/${{ inputs.s3_staging_subdir }}/${{ inputs.amdgpu_family }}/ \
272
+ s3://${S3_BUCKET_PY}/${{ inputs.s3_subdir }}/${{ inputs.amdgpu_family }}/ \
273
+ --recursive \
274
+ --exclude "*" \
275
+ --include "torch-${TORCH_VERSION}-${CP_VERSION}-linux_x86_64.whl" \
276
+ --include "torchaudio-${TORCHAUDIO_VERSION}-${CP_VERSION}-linux_x86_64.whl" \
277
+ --include "torchvision-${TORCHVISION_VERSION}-${CP_VERSION}-linux_x86_64.whl" \
278
+ --include "pytorch_triton_rocm-${TRITON_VERSION}-${CP_VERSION}-linux_x86_64.whl"
279
+
280
+ - name : (Re-)Generate Python package release index
281
+ if : ${{ env.upload == 'true' }}
282
+ run : |
283
+ pip install boto3 packaging
284
+ python ./build_tools/third_party/s3_management/manage.py ${{ inputs.s3_subdir }}/${{ inputs.amdgpu_family }}
0 commit comments