Skip to content

Commit ee6f6ec

Browse files
authored
GH: Add M1 conda build workflows (#6135)
Clean up Conda build folder before every run Enable artifact upload to GitHub for every workflow run, but upload to Conda/S3 only on nightly pushes Test plan: `conda install -c pytorch-nightly torchvision; python -c "import torchvision;print(torchvision.io.read_image('hummingbird.jpg').shape)"`
1 parent d4a03fc commit ee6f6ec

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
@@ -55,7 +55,6 @@ jobs:
5555
conda run --cwd /tmp -p ${ENV_NAME} python3 -c "import torchvision;print(torchvision.io.read_image('${PWD}/gallery/assets/dog1.jpg').shape)"
5656
conda env remove -p ${ENV_NAME}
5757
- name: Upload wheel to GitHub
58-
if: ${{ github.event_name == 'push' && steps.extract_branch.outputs.branch == 'nightly' }}
5958
uses: actions/upload-artifact@v3
6059
with:
6160
name: torchvision-py${{ matrix.py_vers }}-macos11-m1
@@ -71,3 +70,52 @@ jobs:
7170
for pkg in dist/*; do
7271
aws s3 cp "$pkg" "s3://pytorch/whl/${CHANNEL}/cpu/" --acl public-read
7372
done
73+
build_conda:
74+
name: "Build TorchVision M1 conda packages"
75+
runs-on: macos-m1
76+
strategy:
77+
matrix:
78+
py_vers: [ "3.8", "3.9", "3.10" ]
79+
steps:
80+
- name: Checkout repository
81+
uses: actions/checkout@v2
82+
83+
- name: Install conda-build and purge previous artifacts
84+
shell: arch -arch arm64 bash {0}
85+
run: |
86+
. ~/miniconda3/etc/profile.d/conda.sh
87+
conda install -yq conda-build
88+
conda build purge-all
89+
90+
- name: Build TorchVision M1 conda package
91+
shell: arch -arch arm64 bash {0}
92+
env:
93+
ENV_NAME: conda-env-${{ github.run_id }}
94+
PYTHON_VERSION: ${{ matrix.py_vers }}
95+
CU_VERSION: cpu
96+
run: |
97+
. ~/miniconda3/etc/profile.d/conda.sh
98+
set -ex
99+
. packaging/pkg_helpers.bash
100+
setup_build_version
101+
setup_conda_pytorch_constraint
102+
export SOURCE_ROOT_DIR=$(pwd)
103+
conda build -c defaults $CONDA_CHANNEL_FLAGS --no-anaconda-upload --python "$PYTHON_VERSION" packaging/torchvision
104+
mkdir -p dist
105+
cp ~/miniconda3/conda-bld/osx-arm64/*.tar.bz2 dist/
106+
- name: Upload package to GitHub
107+
uses: actions/upload-artifact@v3
108+
with:
109+
name: torchvision-py${{ matrix.py_vers }}-macos11-m1-conda
110+
path: dist/
111+
- name: Upload package to conda
112+
if: ${{ github.event_name == 'push' && steps.extract_branch.outputs.branch == 'nightly' }}
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)