Skip to content

Prepare binary and release binary to pypi #42

Prepare binary and release binary to pypi

Prepare binary and release binary to pypi #42

name: Prepare binary and release binary to pypi
on:
workflow_dispatch:
inputs:
dryrun:
required: true
type: choice
default: enabled
options:
- enabled
- disabled
package:
description: "Domain to prepare and release"
required: true
type: choice
default: torchvision
options:
- torchao
- torchvision
- torchaudio
- torchcodec
- executorch
permissions:
id-token: write
contents: read
jobs:
trigger:
runs-on: ubuntu-latest
timeout-minutes: 60
environment: pytorchbot-env
container:
image: pytorch/almalinux-builder:cpu
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Configure aws credentials (pytorch account)
uses: aws-actions/configure-aws-credentials@50ac8dd1e1b10d09dac7b8727528b91bed831ac0 # v3.0.2
with:
role-to-assume: arn:aws:iam::749337293305:role/gha_workflow_stage_wheels
aws-region: us-east-1
- name: Stage torchao binaries for release
shell: bash
env:
PACKAGE: ${{ inputs.package || 'torchvision' }}
DRY_RUN: ${{ inputs.dryrun || 'enabled' }}
run: |
set -ex
cd release/pypi
# Default Version to promote
STABLE_CUDA_VERSION=$(cd ../../tools/scripts && python3 get_stable_cuda_version.py --channel release)
CUDA_ARCH="cu${STABLE_CUDA_VERSION//./}"
LINUX_VERSION_SUFFIX="%2B${CUDA_ARCH}"
CPU_VERSION_SUFFIX="%2Bcpu"
MACOS_ARM64="macosx_.*_arm64"
# Install requirements
pip install awscli==1.32.18 auditwheel==6.4.2
pwd
upload_pypi_to_staging() {
local package_name
package_name=$1
local promote_version
promote_version=$2
echo "=-=-=-= Promoting ${package_name}'s v${promote_version} to pypi staging' =-=-=-="
(
set -x
PACKAGE_VERSION="${promote_version}" PACKAGE_NAME="${package_name}" DRY_RUN="${DRY_RUN}" bash ./upload_pypi_to_staging.sh
)
echo
}
# Init release versions variables
source ../release_versions.sh
# shellcheck disable=SC2086
version="${PACKAGE^^}_VERSION"
if [[ ${PACKAGE} == 'torchaudio' || ${PACKAGE} == 'torchvision' ]]; then
# shellcheck disable=SC2086
PLATFORM="manylinux_2_28_x86_64" VERSION_SUFFIX="${LINUX_VERSION_SUFFIX}" ARCH="${CUDA_ARCH}" upload_pypi_to_staging ${PACKAGE} "${!version}"
# shellcheck disable=SC2086
PLATFORM="manylinux_2_28_aarch64" VERSION_SUFFIX="${LINUX_VERSION_SUFFIX}" ARCH="${CUDA_ARCH}" upload_pypi_to_staging ${PACKAGE} "${!version}"
# shellcheck disable=SC2086
PLATFORM="win_amd64" VERSION_SUFFIX="${CPU_VERSION_SUFFIX}" upload_pypi_to_staging ${PACKAGE} "${!version}"
# shellcheck disable=SC2086
PLATFORM="${MACOS_ARM64}" VERSION_SUFFIX="" upload_pypi_to_staging ${PACKAGE} "${!version}"
fi
if [[ ${PACKAGE} == 'torchao' ]]; then
# shellcheck disable=SC2086
PLATFORM="none-any" VERSION_SUFFIX="${CPU_VERSION_SUFFIX}" upload_pypi_to_staging ${PACKAGE} "${!version}"
# shellcheck disable=SC2086
PLATFORM="manylinux_2_28_x86_64" VERSION_SUFFIX="${LINUX_VERSION_SUFFIX}" ARCH="${CUDA_ARCH}" upload_pypi_to_staging ${PACKAGE} "${!version}"
fi
if [[ ${PACKAGE} == 'executorch' ]]; then
# shellcheck disable=SC2086
PLATFORM="manylinux_2_28_x86_64" VERSION_SUFFIX="${CPU_VERSION_SUFFIX}" upload_pypi_to_staging executorch "${!version}"
# shellcheck disable=SC2086
PLATFORM="${MACOS_ARM64}" VERSION_SUFFIX="" upload_pypi_to_staging executorch "${!version}"
# shellcheck disable=SC2086
PLATFORM="manylinux_2_28_aarch64" VERSION_SUFFIX="${CPU_VERSION_SUFFIX}" upload_pypi_to_staging executorch "${!version}"
# shellcheck disable=SC2086
PLATFORM="win_amd64" VERSION_SUFFIX="${CPU_VERSION_SUFFIX}" upload_pypi_to_staging executorch "${!version}"
fi
if [[ ${PACKAGE} == 'torchcodec' ]]; then
# shellcheck disable=SC2086
PLATFORM="manylinux_2_28_x86_64" VERSION_SUFFIX="${LINUX_VERSION_SUFFIX}" ARCH="${CUDA_ARCH}" upload_pypi_to_staging ${PACKAGE} "${!version}"
# shellcheck disable=SC2086
PLATFORM="manylinux_2_28_x86_64" VERSION_SUFFIX="${CPU_VERSION_SUFFIX}" upload_pypi_to_staging ${PACKAGE} "${!version}"
# shellcheck disable=SC2086
PLATFORM="manylinux_2_28_aarch64" VERSION_SUFFIX="${LINUX_VERSION_SUFFIX}" ARCH="${CUDA_ARCH}" upload_pypi_to_staging ${PACKAGE} "${!version}"
# shellcheck disable=SC2086
PLATFORM="${MACOS_ARM64}" VERSION_SUFFIX="" upload_pypi_to_staging ${PACKAGE} "${!version}"
# shellcheck disable=SC2086
PLATFORM="win_amd64" VERSION_SUFFIX="${CPU_VERSION_SUFFIX}" upload_pypi_to_staging ${PACKAGE} "${!version}"
fi