7
7
branches :
8
8
- nightly
9
9
- main
10
+ tags :
11
+ # NOTE: Binary build pipelines should only get triggered on release candidate builds
12
+ # Release candidate tags look like: v1.11.0-rc1
13
+ - v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+
10
14
workflow_dispatch :
15
+ env :
16
+ CHANNEL : " nightly"
11
17
jobs :
12
18
build_wheels :
13
19
name : " Build TorchVision M1 wheels"
18
24
steps :
19
25
- name : Checkout repository
20
26
uses : actions/checkout@v2
27
+ - name : Set CHANNEL (only for tagged pushes)
28
+ if : ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/') }}
29
+ run : |
30
+ # reference ends with an RC suffix
31
+ if [[ ${GITHUB_REF_NAME} = *-rc[0-9]* ]]; then
32
+ echo "CHANNEL=test" >> "$GITHUB_ENV"
33
+ fi
21
34
- name : Build TorchVision M1 wheel
22
35
shell : arch -arch arm64 bash {0}
23
36
env :
@@ -29,10 +42,16 @@ jobs:
29
42
export PATH=~/miniconda3/bin:$PATH
30
43
set -ex
31
44
. packaging/pkg_helpers.bash
32
- setup_build_version
45
+ # if we are uploading to test channell, our version consist only of the base: 0.x.x - no date string or suffix added
46
+ if [[ $CHANNEL == "test" ]]; then
47
+ setup_base_build_version
48
+ else
49
+ setup_build_version
50
+ fi
51
+
33
52
WHL_NAME=torchvision-${BUILD_VERSION}-cp${PY_VERS/.}-cp${PY_VERS/.}-macosx_11_0_arm64.whl
34
53
conda create -yp ${ENV_NAME} python=${PY_VERS} numpy libpng jpeg wheel pkg-config
35
- conda run -p ${ENV_NAME} python3 -mpip install torch --pre --extra-index-url=https://download.pytorch.org/whl/nightly
54
+ conda run -p ${ENV_NAME} python3 -mpip install torch --pre --extra-index-url=https://download.pytorch.org/whl/${CHANNEL}
36
55
conda run -p ${ENV_NAME} python3 -mpip install delocate
37
56
conda run -p ${ENV_NAME} python3 setup.py bdist_wheel
38
57
export PYTORCH_VERSION="$(conda run -p ${ENV_NAME} python3 -mpip show torch | grep ^Version: | sed 's/Version: *//')"
47
66
. ~/miniconda3/etc/profile.d/conda.sh
48
67
set -ex
49
68
conda create -yp ${ENV_NAME} python=${PY_VERS} numpy
50
- conda run -p ${ENV_NAME} python3 -mpip install torch --pre --extra-index-url=https://download.pytorch.org/whl/nightly
69
+ conda run -p ${ENV_NAME} python3 -mpip install torch --pre --extra-index-url=https://download.pytorch.org/whl/${CHANNEL}
51
70
conda run -p ${ENV_NAME} python3 -mpip install dist/*.whl
52
71
# Test torch is importable, by changing cwd and running import commands
53
72
conda run --cwd /tmp -p ${ENV_NAME} python3 -c "import torchvision;print('torchvision version is ', torchvision.__version__)"
@@ -60,12 +79,11 @@ jobs:
60
79
name : torchvision-py${{ matrix.py_vers }}-macos11-m1
61
80
path : dist/
62
81
- name : Upload wheel to S3
63
- if : ${{ github.event_name == 'push' && steps.extract_branch.outputs.branch == 'nightly' }}
82
+ if : ${{ github.event_name == 'push' && ( steps.extract_branch.outputs.branch == 'nightly' || startsWith(github.event.ref, 'refs/tags/')) }}
64
83
shell : arch -arch arm64 bash {0}
65
84
env :
66
85
AWS_ACCESS_KEY_ID : ${{ secrets.AWS_PYTORCH_UPLOADER_ACCESS_KEY_ID }}
67
86
AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_PYTORCH_UPLOADER_SECRET_ACCESS_KEY }}
68
- CHANNEL : nightly
69
87
run : |
70
88
for pkg in dist/*; do
71
89
aws s3 cp "$pkg" "s3://pytorch/whl/${CHANNEL}/cpu/" --acl public-read
79
97
steps :
80
98
- name : Checkout repository
81
99
uses : actions/checkout@v2
82
-
100
+ - name : Set CHANNEL (only for tagged pushes)
101
+ if : ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/') }}
102
+ run : |
103
+ # reference ends with an RC suffix
104
+ if [[ ${GITHUB_REF_NAME} = *-rc[0-9]* ]]; then
105
+ echo "CHANNEL=test" >> "$GITHUB_ENV"
106
+ fi
83
107
- name : Install conda-build and purge previous artifacts
84
108
shell : arch -arch arm64 bash {0}
85
109
run : |
@@ -97,7 +121,13 @@ jobs:
97
121
. ~/miniconda3/etc/profile.d/conda.sh
98
122
set -ex
99
123
. packaging/pkg_helpers.bash
100
- setup_build_version
124
+
125
+ if [[ $CHANNEL == "test" ]]; then
126
+ setup_base_build_version
127
+ else
128
+ setup_build_version
129
+ fi
130
+
101
131
setup_conda_pytorch_constraint
102
132
export SOURCE_ROOT_DIR=$(pwd)
103
133
conda build -c defaults $CONDA_CHANNEL_FLAGS --no-anaconda-upload --python "$PYTHON_VERSION" packaging/torchvision
@@ -113,9 +143,8 @@ jobs:
113
143
shell : arch -arch arm64 bash {0}
114
144
env :
115
145
CONDA_PYTORCHBOT_TOKEN : ${{ secrets.CONDA_PYTORCHBOT_TOKEN }}
116
- UPLOAD_CHANNEL : nightly
117
146
run : |
118
147
. ~/miniconda3/etc/profile.d/conda.sh
119
148
conda install -yq anaconda-client
120
149
set -x
121
- anaconda -t "${CONDA_PYTORCHBOT_TOKEN}" upload ~/miniconda3/conda-bld/osx-arm64/*.tar.bz2 -u "pytorch-${UPLOAD_CHANNEL }" --label main --no-progress --force
150
+ anaconda -t "${CONDA_PYTORCHBOT_TOKEN}" upload ~/miniconda3/conda-bld/osx-arm64/*.tar.bz2 -u "pytorch-${CHANNEL }" --label main --no-progress --force
0 commit comments