Skip to content

Commit b728e4a

Browse files
committed
GH: Add M1 conda build step
1 parent d4a03fc commit b728e4a

File tree

1 file changed

+49
-1
lines changed

1 file changed

+49
-1
lines changed

.github/workflows/build-m1-binaries.yml

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ jobs:
1212
build_wheels:
1313
name: "Build TorchVision M1 wheels"
1414
runs-on: macos-m1
15+
if: false
1516
strategy:
1617
matrix:
1718
py_vers: [ "3.8", "3.9", "3.10" ]
@@ -55,7 +56,6 @@ jobs:
5556
conda run --cwd /tmp -p ${ENV_NAME} python3 -c "import torchvision;print(torchvision.io.read_image('${PWD}/gallery/assets/dog1.jpg').shape)"
5657
conda env remove -p ${ENV_NAME}
5758
- name: Upload wheel to GitHub
58-
if: ${{ github.event_name == 'push' && steps.extract_branch.outputs.branch == 'nightly' }}
5959
uses: actions/upload-artifact@v3
6060
with:
6161
name: torchvision-py${{ matrix.py_vers }}-macos11-m1
@@ -71,3 +71,51 @@ jobs:
7171
for pkg in dist/*; do
7272
aws s3 cp "$pkg" "s3://pytorch/whl/${CHANNEL}/cpu/" --acl public-read
7373
done
74+
build_conda:
75+
name: "Build TorchVision M1 conda packages"
76+
runs-on: macos-m1
77+
strategy:
78+
matrix:
79+
py_vers: [ "3.8", "3.9", "3.10" ]
80+
steps:
81+
- name: Checkout repository
82+
uses: actions/checkout@v2
83+
84+
- name: Install conda-build and purge previous artifacts
85+
shell: arch -arch arm64 bash {0}
86+
run: |
87+
. ~/miniconda3/etc/profile.d/conda.sh
88+
conda install -yq conda-build
89+
conda build purge-all
90+
91+
- name: Build TorchVision M1 conda package
92+
shell: arch -arch arm64 bash {0}
93+
env:
94+
ENV_NAME: conda-env-${{ github.run_id }}
95+
PYTHON_VERSION: ${{ matrix.py_vers }}
96+
CU_VERSION: cpu
97+
run: |
98+
. ~/miniconda3/etc/profile.d/conda.sh
99+
set -ex
100+
. packaging/pkg_helpers.bash
101+
setup_build_version
102+
setup_conda_pytorch_constraint
103+
export SOURCE_ROOT_DIR=$(pwd)
104+
conda build -c defaults $CONDA_CHANNEL_FLAGS --no-anaconda-upload --python "$PYTHON_VERSION" packaging/torchvision
105+
mkdir -p dist
106+
cp ~/miniconda3/conda-bld/osx-arm64/*.tar.bz2 dist/
107+
- name: Upload package to GitHub
108+
uses: actions/upload-artifact@v3
109+
with:
110+
name: torchvision-py${{ matrix.py_vers }}-macos11-m1-conda
111+
path: dist/
112+
- name: Upload package to conda
113+
shell: arch -arch arm64 bash {0}
114+
env:
115+
CONDA_PYTORCHBOT_TOKEN: ${{ secrets.CONDA_PYTORCHBOT_TOKEN }}
116+
UPLOAD_CHANNEL: nightly
117+
run: |
118+
. ~/miniconda3/etc/profile.d/conda.sh
119+
conda install -yq anaconda-client
120+
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

0 commit comments

Comments
 (0)