Unverified Commit efc67ea9 authored by Andrey Talman's avatar Andrey Talman Committed by GitHub
Browse files

Adding tagged builds for M1 (#6140)

* Adding tagged builds

* Testing

* Testing

* Testing

* Testing

* Adding conda builds
parent 9ce79e8b
...@@ -7,7 +7,13 @@ on: ...@@ -7,7 +7,13 @@ on:
branches: branches:
- nightly - nightly
- main - main
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 TorchVision M1 wheels" name: "Build TorchVision M1 wheels"
...@@ -18,6 +24,13 @@ jobs: ...@@ -18,6 +24,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 TorchVision M1 wheel - name: Build TorchVision M1 wheel
shell: arch -arch arm64 bash {0} shell: arch -arch arm64 bash {0}
env: env:
...@@ -29,10 +42,16 @@ jobs: ...@@ -29,10 +42,16 @@ jobs:
export PATH=~/miniconda3/bin:$PATH export PATH=~/miniconda3/bin:$PATH
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=torchvision-${BUILD_VERSION}-cp${PY_VERS/.}-cp${PY_VERS/.}-macosx_11_0_arm64.whl WHL_NAME=torchvision-${BUILD_VERSION}-cp${PY_VERS/.}-cp${PY_VERS/.}-macosx_11_0_arm64.whl
conda create -yp ${ENV_NAME} python=${PY_VERS} numpy libpng jpeg wheel pkg-config conda create -yp ${ENV_NAME} python=${PY_VERS} numpy libpng jpeg 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: *//')"
...@@ -47,7 +66,7 @@ jobs: ...@@ -47,7 +66,7 @@ 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 torchvision;print('torchvision version is ', torchvision.__version__)" conda run --cwd /tmp -p ${ENV_NAME} python3 -c "import torchvision;print('torchvision version is ', torchvision.__version__)"
...@@ -60,12 +79,11 @@ jobs: ...@@ -60,12 +79,11 @@ jobs:
name: torchvision-py${{ matrix.py_vers }}-macos11-m1 name: torchvision-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' && (steps.extract_branch.outputs.branch == '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
...@@ -79,7 +97,13 @@ jobs: ...@@ -79,7 +97,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: Install conda-build and purge previous artifacts - name: Install conda-build and purge previous artifacts
shell: arch -arch arm64 bash {0} shell: arch -arch arm64 bash {0}
run: | run: |
...@@ -97,7 +121,13 @@ jobs: ...@@ -97,7 +121,13 @@ 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 [[ $CHANNEL == "test" ]]; then
setup_base_build_version
else
setup_build_version
fi
setup_conda_pytorch_constraint setup_conda_pytorch_constraint
export SOURCE_ROOT_DIR=$(pwd) export SOURCE_ROOT_DIR=$(pwd)
conda build -c defaults $CONDA_CHANNEL_FLAGS --no-anaconda-upload --python "$PYTHON_VERSION" packaging/torchvision conda build -c defaults $CONDA_CHANNEL_FLAGS --no-anaconda-upload --python "$PYTHON_VERSION" packaging/torchvision
...@@ -113,9 +143,8 @@ jobs: ...@@ -113,9 +143,8 @@ jobs:
shell: arch -arch arm64 bash {0} shell: arch -arch arm64 bash {0}
env: env:
CONDA_PYTORCHBOT_TOKEN: ${{ secrets.CONDA_PYTORCHBOT_TOKEN }} CONDA_PYTORCHBOT_TOKEN: ${{ secrets.CONDA_PYTORCHBOT_TOKEN }}
UPLOAD_CHANNEL: nightly
run: | run: |
. ~/miniconda3/etc/profile.d/conda.sh . ~/miniconda3/etc/profile.d/conda.sh
conda install -yq anaconda-client conda install -yq anaconda-client
set -x set -x
anaconda -t "${CONDA_PYTORCHBOT_TOKEN}" upload ~/miniconda3/conda-bld/osx-arm64/*.tar.bz2 -u "pytorch-${UPLOAD_CHANNEL}" --label main --no-progress --force anaconda -t "${CONDA_PYTORCHBOT_TOKEN}" upload ~/miniconda3/conda-bld/osx-arm64/*.tar.bz2 -u "pytorch-${CHANNEL}" --label main --no-progress --force
...@@ -101,23 +101,30 @@ setup_cuda() { ...@@ -101,23 +101,30 @@ setup_cuda() {
setup_build_version() { setup_build_version() {
if [[ -z "$BUILD_VERSION" ]]; then if [[ -z "$BUILD_VERSION" ]]; then
if [[ -z "$1" ]]; then if [[ -z "$1" ]]; then
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" setup_base_build_version
# 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
_VERSION_BASE=$( cut -f 1 -d a "$SCRIPT_DIR/../version.txt" )
else else
_VERSION_BASE="$1" BUILD_VERSION="$1"
fi fi
export BUILD_VERSION="$_VERSION_BASE.dev$(date "+%Y%m%d")$VERSION_SUFFIX" BUILD_VERSION="$BUILD_VERSION.dev$(date "+%Y%m%d")$VERSION_SUFFIX"
else else
export BUILD_VERSION="$BUILD_VERSION$VERSION_SUFFIX" BUILD_VERSION="$BUILD_VERSION$VERSION_SUFFIX"
fi fi
# Set build version based on tag if on tag # Set build version based on tag if on tag
if [[ -n "${CIRCLE_TAG}" ]]; then if [[ -n "${CIRCLE_TAG}" ]]; then
# Strip tag # Strip tag
export BUILD_VERSION="$(echo "${CIRCLE_TAG}" | sed -e 's/^v//' -e 's/-.*$//')${VERSION_SUFFIX}" BUILD_VERSION="$(echo "${CIRCLE_TAG}" | sed -e 's/^v//' -e 's/-.*$//')${VERSION_SUFFIX}"
fi 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
} }
# Set some useful variables for OS X, if applicable # Set some useful variables for OS X, if applicable
......
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