7
7
branches :
8
8
- nightly
9
9
- main
10
+ - release/*
11
+ tags :
12
+ # NOTE: Binary build pipelines should only get triggered on release candidate builds
13
+ # Release candidate tags look like: v1.11.0-rc1
14
+ - v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+
10
15
workflow_dispatch :
16
+ env :
17
+ CHANNEL : " nightly"
11
18
jobs :
12
19
build_wheels :
13
20
name : " Build TorchVision M1 wheels"
18
25
steps :
19
26
- name : Checkout repository
20
27
uses : actions/checkout@v2
28
+ - name : Set CHANNEL (only for tagged pushes)
29
+ if : ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/') }}
30
+ run : |
31
+ # reference ends with an RC suffix
32
+ if [[ ${GITHUB_REF_NAME} = *-rc[0-9]* ]]; then
33
+ echo "CHANNEL=test" >> "$GITHUB_ENV"
34
+ fi
35
+ - name : Set Release CHANNEL (for release)
36
+ if : ${{ (github.event_name == 'pull_request' && startsWith(github.base_ref, 'release')) || startsWith(github.ref, 'refs/heads/release') }}
37
+ run : |
38
+ echo "CHANNEL=test" >> "$GITHUB_ENV"
21
39
- name : Build TorchVision M1 wheel
22
40
shell : arch -arch arm64 bash {0}
23
41
env :
@@ -29,10 +47,16 @@ jobs:
29
47
export PATH=~/miniconda3/bin:$PATH
30
48
set -ex
31
49
. packaging/pkg_helpers.bash
32
- setup_build_version
50
+ # if we are uploading to test channell, our version consist only of the base: 0.x.x - no date string or suffix added
51
+ if [[ $CHANNEL == "test" ]]; then
52
+ setup_base_build_version
53
+ else
54
+ setup_build_version
55
+ fi
56
+
33
57
WHL_NAME=torchvision-${BUILD_VERSION}-cp${PY_VERS/.}-cp${PY_VERS/.}-macosx_11_0_arm64.whl
34
58
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
59
+ conda run -p ${ENV_NAME} python3 -mpip install torch --pre --extra-index-url=https://download.pytorch.org/whl/${CHANNEL}
36
60
conda run -p ${ENV_NAME} python3 -mpip install delocate
37
61
conda run -p ${ENV_NAME} python3 setup.py bdist_wheel
38
62
export PYTORCH_VERSION="$(conda run -p ${ENV_NAME} python3 -mpip show torch | grep ^Version: | sed 's/Version: *//')"
@@ -47,27 +71,89 @@ jobs:
47
71
. ~/miniconda3/etc/profile.d/conda.sh
48
72
set -ex
49
73
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
74
+ conda run -p ${ENV_NAME} python3 -mpip install torch --pre --extra-index-url=https://download.pytorch.org/whl/${CHANNEL}
51
75
conda run -p ${ENV_NAME} python3 -mpip install dist/*.whl
52
76
# Test torch is importable, by changing cwd and running import commands
53
77
conda run --cwd /tmp -p ${ENV_NAME} python3 -c "import torchvision;print('torchvision version is ', torchvision.__version__)"
54
78
conda run --cwd /tmp -p ${ENV_NAME} python3 -c "import torch;import torchvision;print('Is torchvision useable?', all(x is not None for x in [torch.ops.image.decode_png, torch.ops.torchvision.roi_align]))"
55
79
conda run --cwd /tmp -p ${ENV_NAME} python3 -c "import torchvision;print(torchvision.io.read_image('${PWD}/gallery/assets/dog1.jpg').shape)"
56
80
conda env remove -p ${ENV_NAME}
57
81
- name : Upload wheel to GitHub
58
- if : ${{ github.event_name == 'push' && steps.extract_branch.outputs.branch == 'nightly' }}
59
82
uses : actions/upload-artifact@v3
60
83
with :
61
84
name : torchvision-py${{ matrix.py_vers }}-macos11-m1
62
85
path : dist/
63
86
- name : Upload wheel to S3
64
- if : ${{ github.event_name == 'push' && steps.extract_branch.outputs.branch == 'nightly' }}
87
+ if : ${{ github.event_name == 'push' && (github.event.ref == 'refs/heads/ nightly' || startsWith(github.event.ref, 'refs/tags/')) }}
65
88
shell : arch -arch arm64 bash {0}
66
89
env :
67
90
AWS_ACCESS_KEY_ID : ${{ secrets.AWS_PYTORCH_UPLOADER_ACCESS_KEY_ID }}
68
91
AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_PYTORCH_UPLOADER_SECRET_ACCESS_KEY }}
69
- CHANNEL : nightly
70
92
run : |
71
93
for pkg in dist/*; do
72
94
aws s3 cp "$pkg" "s3://pytorch/whl/${CHANNEL}/cpu/" --acl public-read
73
95
done
96
+ build_conda :
97
+ name : " Build TorchVision M1 conda packages"
98
+ runs-on : macos-m1
99
+ strategy :
100
+ matrix :
101
+ py_vers : [ "3.8", "3.9", "3.10" ]
102
+ steps :
103
+ - name : Checkout repository
104
+ uses : actions/checkout@v2
105
+ - name : Set CHANNEL (only for tagged pushes)
106
+ if : ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/') }}
107
+ run : |
108
+ # reference ends with an RC suffix
109
+ if [[ ${GITHUB_REF_NAME} = *-rc[0-9]* ]]; then
110
+ echo "CHANNEL=test" >> "$GITHUB_ENV"
111
+ fi
112
+ - name : Set CHANNEL Release (for release)
113
+ if : ${{ (github.event_name == 'pull_request' && startsWith(github.base_ref, 'release')) || startsWith(github.ref, 'refs/heads/release') }}
114
+ run : |
115
+ echo "CHANNEL=test" >> "$GITHUB_ENV"
116
+ - name : Install conda-build and purge previous artifacts
117
+ shell : arch -arch arm64 bash {0}
118
+ run : |
119
+ . ~/miniconda3/etc/profile.d/conda.sh
120
+ conda install -yq conda-build
121
+ conda build purge-all
122
+
123
+ - name : Build TorchVision M1 conda package
124
+ shell : arch -arch arm64 bash {0}
125
+ env :
126
+ ENV_NAME : conda-env-${{ github.run_id }}
127
+ PYTHON_VERSION : ${{ matrix.py_vers }}
128
+ CU_VERSION : cpu
129
+ run : |
130
+ . ~/miniconda3/etc/profile.d/conda.sh
131
+ set -ex
132
+ . packaging/pkg_helpers.bash
133
+
134
+ if [[ $CHANNEL == "test" ]]; then
135
+ setup_base_build_version
136
+ else
137
+ setup_build_version
138
+ fi
139
+
140
+ setup_conda_pytorch_constraint
141
+ export SOURCE_ROOT_DIR=$(pwd)
142
+ conda build -c defaults $CONDA_CHANNEL_FLAGS --no-anaconda-upload --python "$PYTHON_VERSION" packaging/torchvision
143
+ mkdir -p dist
144
+ cp ~/miniconda3/conda-bld/osx-arm64/*.tar.bz2 dist/
145
+ - name : Upload package to GitHub
146
+ uses : actions/upload-artifact@v3
147
+ with :
148
+ name : torchvision-py${{ matrix.py_vers }}-macos11-m1-conda
149
+ path : dist/
150
+ - name : Upload package to conda
151
+ if : ${{ github.event_name == 'push' && (github.event.ref == 'refs/heads/nightly' || startsWith(github.event.ref, 'refs/tags/')) }}
152
+ shell : arch -arch arm64 bash {0}
153
+ env :
154
+ CONDA_PYTORCHBOT_TOKEN : ${{ secrets.CONDA_PYTORCHBOT_TOKEN }}
155
+ run : |
156
+ . ~/miniconda3/etc/profile.d/conda.sh
157
+ conda install -yq anaconda-client
158
+ set -x
159
+ anaconda -t "${CONDA_PYTORCHBOT_TOKEN}" upload ~/miniconda3/conda-bld/osx-arm64/*.tar.bz2 -u "pytorch-${CHANNEL}" --label main --no-progress --force
0 commit comments