Commit 19d93282 authored by Andrey Talman's avatar Andrey Talman Committed by Facebook GitHub Bot
Browse files

Adding tagged builds to torchaudio (#2471)

Summary:
Adding tagged builds for torchaudio
see: https://github.com/pytorch/vision/pull/6140

Pull Request resolved: https://github.com/pytorch/audio/pull/2471

Reviewed By: hwangjeff

Differential Revision: D37080828

Pulled By: atalman

fbshipit-source-id: 13d754f522510514f0148ba465ce12a320058722
parent df2262b5
...@@ -6,7 +6,13 @@ on: ...@@ -6,7 +6,13 @@ on:
push: push:
branches: branches:
- nightly - nightly
tags:
# NOTE: Binary build pipelines should only get triggered on release candidate builds
# Release candidate tags look like: v1.11.0-rc1
- v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+
workflow_dispatch: workflow_dispatch:
env:
CHANNEL: "nightly"
jobs: jobs:
build_wheels: build_wheels:
name: "Build TorchAudio M1 wheels" name: "Build TorchAudio M1 wheels"
...@@ -17,6 +23,13 @@ jobs: ...@@ -17,6 +23,13 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Set CHANNEL (only for tagged pushes)
if: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/') }}
run: |
# reference ends with an RC suffix
if [[ ${GITHUB_REF_NAME} = *-rc[0-9]* ]]; then
echo "CHANNEL=test" >> "$GITHUB_ENV"
fi
- name: Build TorchAudio M1 wheel - name: Build TorchAudio M1 wheel
shell: arch -arch arm64 bash {0} shell: arch -arch arm64 bash {0}
env: env:
...@@ -27,10 +40,15 @@ jobs: ...@@ -27,10 +40,15 @@ jobs:
. ~/miniconda3/etc/profile.d/conda.sh . ~/miniconda3/etc/profile.d/conda.sh
set -ex set -ex
. packaging/pkg_helpers.bash . packaging/pkg_helpers.bash
setup_build_version # if we are uploading to test channell, our version consist only of the base: 0.x.x - no date string or suffix added
if [[ $CHANNEL == "test" ]]; then
setup_base_build_version
else
setup_build_version
fi
WHL_NAME=torchaudio-${BUILD_VERSION}-cp${PY_VERS/.}-cp${PY_VERS/.}-macosx_11_0_arm64.whl WHL_NAME=torchaudio-${BUILD_VERSION}-cp${PY_VERS/.}-cp${PY_VERS/.}-macosx_11_0_arm64.whl
conda create -yp ${ENV_NAME} python=${PY_VERS} numpy cmake ninja wheel pkg-config conda create -yp ${ENV_NAME} python=${PY_VERS} numpy cmake ninja wheel pkg-config
conda run -p ${ENV_NAME} python3 -mpip install torch --pre --extra-index-url=https://download.pytorch.org/whl/nightly conda run -p ${ENV_NAME} python3 -mpip install torch --pre --extra-index-url=https://download.pytorch.org/whl/${CHANNEL}
conda run -p ${ENV_NAME} python3 -mpip install delocate conda run -p ${ENV_NAME} python3 -mpip install delocate
conda run -p ${ENV_NAME} python3 setup.py bdist_wheel conda run -p ${ENV_NAME} python3 setup.py bdist_wheel
export PYTORCH_VERSION="$(conda run -p ${ENV_NAME} python3 -mpip show torch | grep ^Version: | sed 's/Version: *//')" export PYTORCH_VERSION="$(conda run -p ${ENV_NAME} python3 -mpip show torch | grep ^Version: | sed 's/Version: *//')"
...@@ -45,25 +63,24 @@ jobs: ...@@ -45,25 +63,24 @@ jobs:
. ~/miniconda3/etc/profile.d/conda.sh . ~/miniconda3/etc/profile.d/conda.sh
set -ex set -ex
conda create -yp ${ENV_NAME} python=${PY_VERS} numpy conda create -yp ${ENV_NAME} python=${PY_VERS} numpy
conda run -p ${ENV_NAME} python3 -mpip install torch --pre --extra-index-url=https://download.pytorch.org/whl/nightly conda run -p ${ENV_NAME} python3 -mpip install torch --pre --extra-index-url=https://download.pytorch.org/whl/${CHANNEL}
conda run -p ${ENV_NAME} python3 -mpip install dist/*.whl conda run -p ${ENV_NAME} python3 -mpip install dist/*.whl
# Test torch is importable, by changing cwd and running import commands # Test torch is importable, by changing cwd and running import commands
conda run --cwd /tmp -p ${ENV_NAME} python3 -c "import torchaudio;print('torchaudio version is ', torchaudio.__version__)" conda run --cwd /tmp -p ${ENV_NAME} python3 -c "import torchaudio;print('torchaudio version is ', torchaudio.__version__)"
conda run --cwd /tmp -p ${ENV_NAME} python3 -c "import torch;import torchaudio;torchaudio.set_audio_backend('sox_io')" conda run --cwd /tmp -p ${ENV_NAME} python3 -c "import torch;import torchaudio;torchaudio.set_audio_backend('sox_io')"
conda env remove -p ${ENV_NAME} conda env remove -p ${ENV_NAME}
- name: Upload wheel to GitHub - name: Upload wheel to GitHub
if: ${{ github.event_name == 'push' && steps.extract_branch.outputs.branch == 'nightly' }} if: ${{ github.event_name == 'push' && (github.event.ref == 'ref/heads/nightly' || startsWith(github.event.ref, 'refs/tags/')) }}
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: torchaudio-py${{ matrix.py_vers }}-macos11-m1 name: torchaudio-py${{ matrix.py_vers }}-macos11-m1
path: dist/ path: dist/
- name: Upload wheel to S3 - name: Upload wheel to S3
if: ${{ github.event_name == 'push' && steps.extract_branch.outputs.branch == 'nightly' }} if: ${{ github.event_name == 'push' && (github.event.ref == 'ref/heads/nightly' || startsWith(github.event.ref, 'refs/tags/')) }}
shell: arch -arch arm64 bash {0} shell: arch -arch arm64 bash {0}
env: env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_PYTORCH_UPLOADER_ACCESS_KEY_ID }} AWS_ACCESS_KEY_ID: ${{ secrets.AWS_PYTORCH_UPLOADER_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_PYTORCH_UPLOADER_SECRET_ACCESS_KEY }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_PYTORCH_UPLOADER_SECRET_ACCESS_KEY }}
CHANNEL: nightly
run: | run: |
for pkg in dist/*; do for pkg in dist/*; do
aws s3 cp "$pkg" "s3://pytorch/whl/${CHANNEL}/cpu/" --acl public-read aws s3 cp "$pkg" "s3://pytorch/whl/${CHANNEL}/cpu/" --acl public-read
......
...@@ -101,14 +101,30 @@ setup_cuda() { ...@@ -101,14 +101,30 @@ setup_cuda() {
# Usage: setup_build_version # Usage: setup_build_version
setup_build_version() { setup_build_version() {
if [[ -z "$BUILD_VERSION" ]]; then if [[ -z "$BUILD_VERSION" ]]; then
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" if [[ -z "$1" ]]; then
# version.txt for some reason has `a` character after major.minor.rev setup_base_build_version
# command below yields 0.10.0 from version.txt containing 0.10.0a0 else
_VERSION_BASE=$( cut -f 1 -d a "$SCRIPT_DIR/../version.txt" ) BUILD_VERSION="$1"
BUILD_VERSION="$_VERSION_BASE.dev$(date "+%Y%m%d")$VERSION_SUFFIX" fi
BUILD_VERSION="$BUILD_VERSION.dev$(date "+%Y%m%d")$VERSION_SUFFIX"
else else
BUILD_VERSION="$BUILD_VERSION$VERSION_SUFFIX" BUILD_VERSION="$BUILD_VERSION$VERSION_SUFFIX"
fi fi
# Set build version based on tag if on tag
if [[ -n "${CIRCLE_TAG}" ]]; then
# Strip tag
BUILD_VERSION="$(echo "${CIRCLE_TAG}" | sed -e 's/^v//' -e 's/-.*$//')${VERSION_SUFFIX}"
fi
export BUILD_VERSION
}
setup_base_build_version() {
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# version.txt for some reason has `a` character after major.minor.rev
# command below yields 0.10.0 from version.txt containing 0.10.0a0
BUILD_VERSION=$( cut -f 1 -d a "$SCRIPT_DIR/../version.txt" )
export BUILD_VERSION export BUILD_VERSION
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment