117
117
required : false
118
118
default : false
119
119
type : boolean
120
+ is-release-wheel :
121
+ description : Set to true if the build is for release wheel
122
+ required : false
123
+ default : false
124
+ type : boolean
125
+ is-release-tarball :
126
+ description : Set to true if the build is for release tarball
127
+ required : false
128
+ default : false
129
+ type : boolean
120
130
secrets :
121
131
PYPI_API_TOKEN :
122
132
description : An optional token to upload to pypi
@@ -265,22 +275,41 @@ jobs:
265
275
export PYTORCH_VERSION="$(${CONDA_RUN} pip show torch | grep ^Version: | sed 's/Version: *//' | sed 's/+.\+//')"
266
276
${CONDA_RUN} python setup.py clean
267
277
echo "Successfully ran `python setup.py clean`"
268
- if [[ "$BUILD_VERSION" != *"+"${CU_VERSION} ]]; then
269
- BUILD_VERSION="${BUILD_VERSION}+${CU_VERSION}"
278
+ if [[ ${{ inputs.is-release-wheel }} == true || ${{ inputs.is-release-tarball }} == true ]]; then
279
+ # release version for upload to pypi
280
+ # BUILD_VERSION example: 2.4.0+cu121, we don't want the +cu121 part, so remove +cu121
281
+ BUILD_VERSION=${BUILD_VERSION%+*}
282
+ if [[ ${{ inputs.is-release-tarball }} == true ]]; then
283
+ mkdir -p release/tarball
284
+ TRT_VERSION=$(cat dev_dep_versions.yml | grep __tensorrt_version__ | sed 's/__tensorrt_version__: //g' | sed 's/"//g')
285
+ bazel build //:libtorchtrt --compilation_mode opt --config=linux
286
+ cp bazel-bin/libtorchtrt.tar.gz \
287
+ release/tarball/libtorchtrt-${BUILD_VERSION}-tensorrt${TRT_VERSION}-cuda${CU_VERSION:2}-libtorch${PYTORCH_VERSION}-x86_64-linux.tar.gz
288
+ else
289
+ if [[ ${{ inputs.is-release-wheel }} == true ]]; then
290
+ param="--release"
291
+ fi
292
+ fi
293
+ else
294
+ # release version for upload to pytorch index
295
+ if [[ "$BUILD_VERSION" != *"+"${CU_VERSION} ]]; then
296
+ BUILD_VERSION="${BUILD_VERSION}+${CU_VERSION}"
297
+ fi
270
298
fi
299
+
271
300
echo "BUILD_VERSION=$BUILD_VERSION"
272
301
echo "USE_TRT_RTX=$USE_TRT_RTX"
273
302
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
274
303
if [[ ${{ inputs.use-rtx }} == true ]]; then
275
304
echo "Building tensorrt-rtx wheel"
276
- ${CONDA_RUN} python setup.py bdist_wheel --use-rtx
305
+ ${CONDA_RUN} python setup.py bdist_wheel ${param} --use-rtx
277
306
else
278
307
if [[ ${{ inputs.is-jetpack }} == true ]]; then
279
308
echo "Building tensorrt wheel for jetpack"
280
- ${CONDA_RUN} python setup.py bdist_wheel --jetpack
309
+ ${CONDA_RUN} python setup.py bdist_wheel ${param} --jetpack
281
310
else
282
311
echo "Building standard tensorrt wheel"
283
- ${CONDA_RUN} python setup.py bdist_wheel
312
+ ${CONDA_RUN} python setup.py bdist_wheel ${param}
284
313
fi
285
314
fi
286
315
- name : Repair Manylinux_2_28 Wheel
@@ -289,7 +318,7 @@ jobs:
289
318
PACKAGE_NAME : ${{ inputs.package-name }}
290
319
SMOKE_TEST_SCRIPT : ${{ inputs.smoke-test-script }}
291
320
# TODO: lan to verify whether manylinux repair is needed for jetpack
292
- # if: ${{ inputs.is-jetpack == true }}
321
+ if : ${{ inputs.is-release-tarball == false }}
293
322
run : |
294
323
set -euxo pipefail
295
324
source "${BUILD_ENV_FILE}"
@@ -312,6 +341,7 @@ jobs:
312
341
env :
313
342
PACKAGE_NAME : ${{ inputs.package-name }}
314
343
SMOKE_TEST_SCRIPT : ${{ inputs.smoke-test-script }}
344
+ if : ${{ inputs.is-release-tarball == false }}
315
345
run : |
316
346
set -euxo pipefail
317
347
source "${BUILD_ENV_FILE}"
@@ -348,18 +378,27 @@ jobs:
348
378
# NB: Only upload to GitHub after passing smoke tests
349
379
350
380
- name : Upload wheel to GitHub
381
+ if : ${{ inputs.is-release-wheel == false }}
351
382
continue-on-error : true
352
383
uses : actions/upload-artifact@v4
353
384
with :
354
385
name : ${{ env.ARTIFACT_NAME }}
355
386
path : ${{ inputs.repository }}/dist/
387
+ - name : Upload tarball to GitHub
388
+ if : ${{ inputs.is-release-tarball == true }}
389
+ continue-on-error : true
390
+ uses : actions/upload-artifact@v4
391
+ with :
392
+ name : ${{ env.ARTIFACT_NAME }}
393
+ path : ${{ inputs.repository }}/release/tarball/
356
394
357
395
upload :
358
396
needs : build
359
397
name : upload-wheel-${{ matrix.python_version }}-${{ matrix.desired_cuda }}-${{ matrix.gpu_arch_type }}-${{ inputs.is-jetpack }}
360
398
uses : pytorch/test-infra/.github/workflows/_binary_upload.yml@main
361
399
# if it is not jetpack nor rtx, then upload to pytorch index
362
- if : ${{ inputs.is-jetpack == false && inputs.use-rtx == false }}
400
+ # if it is the release wheel or tarball, then skip upload to pytorch index
401
+ if : ${{ inputs.is-jetpack == false && inputs.use-rtx == false && inputs.is-release-wheel == false && inputs.is-release-tarball == false }}
363
402
with :
364
403
repository : ${{ inputs.repository }}
365
404
ref : ${{ inputs.ref }}
@@ -373,5 +412,5 @@ jobs:
373
412
PYPI_API_TOKEN : ${{ secrets.PYPI_API_TOKEN }}
374
413
375
414
concurrency :
376
- group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{inputs.use-rtx}}-${{inputs.architecture}}-${{inputs.is-jetpack}}-${{ inputs.repository }}-${{ github.event_name == 'workflow_dispatch' }}
415
+ group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{inputs.is-release-wheel}}-${{inputs.is-release-tarball}}-${{inputs. use-rtx}}-${{inputs.architecture}}-${{inputs.is-jetpack}}-${{ inputs.repository }}-${{ github.event_name == 'workflow_dispatch' }}
377
416
cancel-in-progress : true
0 commit comments