"src/vscode:/vscode.git/clone" did not exist on "2ea22e1cc7188ee14d41112be1b3413aa1e920c5"
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:
branches:
- nightly
- 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:
env:
CHANNEL: "nightly"
jobs:
build_wheels:
name: "Build TorchVision M1 wheels"
......@@ -18,6 +24,13 @@ jobs:
steps:
- name: Checkout repository
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
shell: arch -arch arm64 bash {0}
env:
......@@ -29,10 +42,16 @@ jobs:
export PATH=~/miniconda3/bin:$PATH
set -ex
. packaging/pkg_helpers.bash
# 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
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 setup.py bdist_wheel
export PYTORCH_VERSION="$(conda run -p ${ENV_NAME} python3 -mpip show torch | grep ^Version: | sed 's/Version: *//')"
......@@ -47,7 +66,7 @@ jobs:
. ~/miniconda3/etc/profile.d/conda.sh
set -ex
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
# 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__)"
......@@ -60,12 +79,11 @@ jobs:
name: torchvision-py${{ matrix.py_vers }}-macos11-m1
path: dist/
- 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}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_PYTORCH_UPLOADER_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_PYTORCH_UPLOADER_SECRET_ACCESS_KEY }}
CHANNEL: nightly
run: |
for pkg in dist/*; do
aws s3 cp "$pkg" "s3://pytorch/whl/${CHANNEL}/cpu/" --acl public-read
......@@ -79,7 +97,13 @@ jobs:
steps:
- name: Checkout repository
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
shell: arch -arch arm64 bash {0}
run: |
......@@ -97,7 +121,13 @@ jobs:
. ~/miniconda3/etc/profile.d/conda.sh
set -ex
. packaging/pkg_helpers.bash
if [[ $CHANNEL == "test" ]]; then
setup_base_build_version
else
setup_build_version
fi
setup_conda_pytorch_constraint
export SOURCE_ROOT_DIR=$(pwd)
conda build -c defaults $CONDA_CHANNEL_FLAGS --no-anaconda-upload --python "$PYTHON_VERSION" packaging/torchvision
......@@ -113,9 +143,8 @@ jobs:
shell: arch -arch arm64 bash {0}
env:
CONDA_PYTORCHBOT_TOKEN: ${{ secrets.CONDA_PYTORCHBOT_TOKEN }}
UPLOAD_CHANNEL: nightly
run: |
. ~/miniconda3/etc/profile.d/conda.sh
conda install -yq anaconda-client
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() {
setup_build_version() {
if [[ -z "$BUILD_VERSION" ]]; then
if [[ -z "$1" ]]; then
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
_VERSION_BASE=$( cut -f 1 -d a "$SCRIPT_DIR/../version.txt" )
setup_base_build_version
else
_VERSION_BASE="$1"
BUILD_VERSION="$1"
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
export BUILD_VERSION="$BUILD_VERSION$VERSION_SUFFIX"
BUILD_VERSION="$BUILD_VERSION$VERSION_SUFFIX"
fi
# Set build version based on tag if on tag
if [[ -n "${CIRCLE_TAG}" ]]; then
# 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
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
......
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