Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Update macos runner to self hosted #6290

Merged
merged 8 commits into from
Jul 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions .github/workflows/build-m1-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ env:
jobs:
build_wheels:
name: "Build TorchVision M1 wheels"
runs-on: macos-m1
runs-on: macos-m1-12
strategy:
matrix:
py_vers: [ "3.8", "3.9", "3.10" ]
Expand Down Expand Up @@ -54,13 +54,12 @@ jobs:
setup_build_version
fi

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 jpeg wheel pkg-config
conda run -p ${ENV_NAME} python3 -mpip install torch --pre --extra-index-url=https://download.pytorch.org/whl/${CHANNEL}
conda run -p ${ENV_NAME} python3 -mpip install delocate
conda run -p ${ENV_NAME} python3 setup.py bdist_wheel
export PYTORCH_VERSION="$(conda run -p ${ENV_NAME} python3 -mpip show torch | grep ^Version: | sed 's/Version: *//')"
conda run -p ${ENV_NAME} DYLD_FALLBACK_LIBRARY_PATH="${ENV_NAME}/lib" delocate-wheel -v --ignore-missing-dependencies dist/${WHL_NAME}
conda run -p ${ENV_NAME} DYLD_FALLBACK_LIBRARY_PATH="${ENV_NAME}/lib" delocate-wheel -v --ignore-missing-dependencies dist/*.whl
conda env remove -p ${ENV_NAME}
- name: Test wheel
shell: arch -arch arm64 bash {0}
Expand Down Expand Up @@ -95,7 +94,7 @@ jobs:
done
build_conda:
name: "Build TorchVision M1 conda packages"
runs-on: macos-m1
runs-on: macos-m1-12
strategy:
matrix:
py_vers: [ "3.8", "3.9", "3.10" ]
Expand Down Expand Up @@ -139,9 +138,13 @@ jobs:

setup_conda_pytorch_constraint
export SOURCE_ROOT_DIR=$(pwd)
conda build -c defaults $CONDA_CHANNEL_FLAGS --no-anaconda-upload --python "$PYTHON_VERSION" packaging/torchvision
mkdir -p dist
cp ~/miniconda3/conda-bld/osx-arm64/*.tar.bz2 dist/
conda build \
-c defaults \
$CONDA_CHANNEL_FLAGS \
--no-anaconda-upload \
--python "$PYTHON_VERSION" \
--output-folder=dist/ \
packaging/torchvision
- name: Upload package to GitHub
uses: actions/upload-artifact@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-m1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ env:
jobs:
tests:
name: "Unit-tests on M1"
runs-on: macos-m1
runs-on: macos-m1-12
strategy:
matrix:
py_vers: [ "3.8"]
Expand Down
7 changes: 6 additions & 1 deletion packaging/pkg_helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,13 @@ setup_pip_pytorch_version() {
setup_conda_pytorch_constraint() {
if [[ -z "$PYTORCH_VERSION" ]]; then
export CONDA_CHANNEL_FLAGS="${CONDA_CHANNEL_FLAGS} -c pytorch-nightly -c pytorch"
PYTHON="python"
# Check if we have python 3 instead and prefer that
if python3 --version >/dev/null 2>/dev/null; then
PYTHON="python3"
fi
export PYTORCH_VERSION="$(conda search --json 'pytorch[channel=pytorch-nightly]' | \
python -c "import os, sys, json, re; cuver = os.environ.get('CU_VERSION'); \
${PYTHON} -c "import os, sys, json, re; cuver = os.environ.get('CU_VERSION'); \
cuver_1 = cuver.replace('cu', 'cuda') if cuver != 'cpu' else cuver; \
cuver_2 = (cuver[:-1] + '.' + cuver[-1]).replace('cu', 'cuda') if cuver != 'cpu' else cuver; \
print(re.sub(r'\\+.*$', '', \
Expand Down