Skip to content

Commit 2a81071

Browse files
authored
[M1] Set build version and delocate wheels (#6110)
This would package libpng and libjpeg.dylib into wheel files Add a very simple test step, copied from https://github.com/pytorch/pytorch.github.io/blob/1eaa33a3d3f1b83b64c5031c6dd04dbb238d6105/scripts/test_install.py#L78 Cherry-picked from https://github.com/pytorch/builder/blob/d0bc74cc363a9da5a8b6a40e883d40d25d050036/build_m1_domains.sh#L22
1 parent 22153d3 commit 2a81071

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

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

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,30 @@ jobs:
2323
ENV_NAME: conda-env-${{ github.run_id }}
2424
PY_VERS: ${{ matrix.py_vers }}
2525
run: |
26-
echo $PATH
2726
. ~/miniconda3/etc/profile.d/conda.sh
2827
set -ex
28+
export BUILD_VERSION=0.14.0.dev$(date "+%Y%m%d")
29+
WHL_NAME=torchvision-${BUILD_VERSION}-cp${PY_VERS/.}-cp${PY_VERS/.}-macosx_11_0_arm64.whl
2930
conda create -yp ${ENV_NAME} python=${PY_VERS} numpy libpng openjpeg wheel pkg-config
30-
conda run -p ${ENV_NAME} python3 -mpip install torch --extra-index-url=https://download.pytorch.org/whl/nightly torch
31+
conda run -p ${ENV_NAME} python3 -mpip install torch --extra-index-url=https://download.pytorch.org/whl/nightly
3132
conda run -p ${ENV_NAME} python3 -mpip install delocate
3233
conda run -p ${ENV_NAME} python3 setup.py bdist_wheel
34+
conda run -p ${ENV_NAME} DYLD_FALLBACK_LIBRARY_PATH="${ENV_NAME}/lib" delocate-wheel -v --ignore-missing-dependencies dist/${WHL_NAME}
35+
conda env remove -p ${ENV_NAME}
36+
- name: Test wheel
37+
shell: arch -arch arm64 bash {0}
38+
env:
39+
ENV_NAME: conda-test-env-${{ github.run_id }}
40+
PY_VERS: ${{ matrix.py_vers }}
41+
run: |
42+
. ~/miniconda3/etc/profile.d/conda.sh
43+
set -ex
44+
conda create -yp ${ENV_NAME} python=${PY_VERS} numpy
45+
conda run -p ${ENV_NAME} python3 -mpip install torch --extra-index-url=https://download.pytorch.org/whl/nightly
46+
conda run -p ${ENV_NAME} python3 -mpip install dist/*.whl
47+
# Test torch is importable, by changing cwd and running import commands
48+
conda run --cwd /tmp -p ${ENV_NAME} python3 -c "import torchvision;print('torchvision version is ', torchvision.__version__)"
49+
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]))"
3350
conda env remove -p ${ENV_NAME}
3451
- name: Upload wheel to GitHub
3552
uses: actions/upload-artifact@v3

0 commit comments

Comments
 (0)