Unverified Commit 2a810713 authored by Nikita Shulga's avatar Nikita Shulga Committed by GitHub
Browse files

[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
parent 22153d37
...@@ -23,13 +23,30 @@ jobs: ...@@ -23,13 +23,30 @@ jobs:
ENV_NAME: conda-env-${{ github.run_id }} ENV_NAME: conda-env-${{ github.run_id }}
PY_VERS: ${{ matrix.py_vers }} PY_VERS: ${{ matrix.py_vers }}
run: | run: |
echo $PATH
. ~/miniconda3/etc/profile.d/conda.sh . ~/miniconda3/etc/profile.d/conda.sh
set -ex set -ex
export BUILD_VERSION=0.14.0.dev$(date "+%Y%m%d")
WHL_NAME=torchvision-${BUILD_VERSION}-cp${PY_VERS/.}-cp${PY_VERS/.}-macosx_11_0_arm64.whl
conda create -yp ${ENV_NAME} python=${PY_VERS} numpy libpng openjpeg wheel pkg-config conda create -yp ${ENV_NAME} python=${PY_VERS} numpy libpng openjpeg wheel pkg-config
conda run -p ${ENV_NAME} python3 -mpip install torch --extra-index-url=https://download.pytorch.org/whl/nightly torch conda run -p ${ENV_NAME} python3 -mpip install torch --extra-index-url=https://download.pytorch.org/whl/nightly
conda run -p ${ENV_NAME} python3 -mpip install delocate conda run -p ${ENV_NAME} python3 -mpip install delocate
conda run -p ${ENV_NAME} python3 setup.py bdist_wheel conda run -p ${ENV_NAME} python3 setup.py bdist_wheel
conda run -p ${ENV_NAME} DYLD_FALLBACK_LIBRARY_PATH="${ENV_NAME}/lib" delocate-wheel -v --ignore-missing-dependencies dist/${WHL_NAME}
conda env remove -p ${ENV_NAME}
- name: Test wheel
shell: arch -arch arm64 bash {0}
env:
ENV_NAME: conda-test-env-${{ github.run_id }}
PY_VERS: ${{ matrix.py_vers }}
run: |
. ~/miniconda3/etc/profile.d/conda.sh
set -ex
conda create -yp ${ENV_NAME} python=${PY_VERS} numpy
conda run -p ${ENV_NAME} python3 -mpip install torch --extra-index-url=https://download.pytorch.org/whl/nightly
conda run -p ${ENV_NAME} python3 -mpip install dist/*.whl
# Test torch is importable, by changing cwd and running import commands
conda run --cwd /tmp -p ${ENV_NAME} python3 -c "import torchvision;print('torchvision version is ', torchvision.__version__)"
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]))"
conda env remove -p ${ENV_NAME} conda env remove -p ${ENV_NAME}
- name: Upload wheel to GitHub - name: Upload wheel to GitHub
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment