Skip to content

Commit 6d6e4ce

Browse files
NicolasHugatalman
authored andcommitted
Add unit-tests for M1 (pytorch#6132)
* Add M1 testing job * libjpeg -> jpeg<=9b in test-m1.yml * Added export PATH=~/miniconda3/bin... from 6122 * Tests were OK, let's see if we can remove the pinning
1 parent e02f370 commit 6d6e4ce

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
push:
77
branches:
88
- nightly
9+
- main
910
workflow_dispatch:
1011
jobs:
1112
build_wheels:
@@ -30,7 +31,7 @@ jobs:
3031
. packaging/pkg_helpers.bash
3132
setup_build_version
3233
WHL_NAME=torchvision-${BUILD_VERSION}-cp${PY_VERS/.}-cp${PY_VERS/.}-macosx_11_0_arm64.whl
33-
conda create -yp ${ENV_NAME} python=${PY_VERS} numpy libpng "jpeg<=9b" wheel pkg-config
34+
conda create -yp ${ENV_NAME} python=${PY_VERS} numpy libpng jpeg wheel pkg-config
3435
conda run -p ${ENV_NAME} python3 -mpip install torch --pre --extra-index-url=https://download.pytorch.org/whl/nightly
3536
conda run -p ${ENV_NAME} python3 -mpip install delocate
3637
conda run -p ${ENV_NAME} python3 setup.py bdist_wheel
@@ -54,11 +55,13 @@ jobs:
5455
conda run --cwd /tmp -p ${ENV_NAME} python3 -c "import torchvision;print(torchvision.io.read_image('${PWD}/gallery/assets/dog1.jpg').shape)"
5556
conda env remove -p ${ENV_NAME}
5657
- name: Upload wheel to GitHub
58+
if: ${{ github.event_name == 'push' && steps.extract_branch.outputs.branch == 'nightly' }}
5759
uses: actions/upload-artifact@v3
5860
with:
5961
name: torchvision-py${{ matrix.py_vers }}-macos11-m1
6062
path: dist/
6163
- name: Upload wheel to S3
64+
if: ${{ github.event_name == 'push' && steps.extract_branch.outputs.branch == 'nightly' }}
6265
shell: arch -arch arm64 bash {0}
6366
env:
6467
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_PYTORCH_UPLOADER_ACCESS_KEY_ID }}

.github/workflows/test-m1.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Unit-tests on M1
2+
on:
3+
pull_request:
4+
paths:
5+
- .github/workflows/test-m1.yml
6+
push:
7+
branches:
8+
- nightly
9+
- main
10+
workflow_dispatch:
11+
jobs:
12+
tests:
13+
name: "Unit-tests on M1"
14+
runs-on: macos-m1
15+
strategy:
16+
matrix:
17+
py_vers: [ "3.8"]
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v2
22+
- name: Install TorchVision
23+
shell: arch -arch arm64 bash {0}
24+
env:
25+
ENV_NAME: conda-env-${{ github.run_id }}
26+
PY_VERS: ${{ matrix.py_vers }}
27+
run: |
28+
. ~/miniconda3/etc/profile.d/conda.sh
29+
# Needed for JPEG library detection as setup.py detects conda presence by running `shlex.which('conda')`
30+
export PATH=~/miniconda3/bin:$PATH
31+
set -ex
32+
conda create -yp ${ENV_NAME} python=${PY_VERS} numpy libpng jpeg scipy
33+
conda run -p ${ENV_NAME} python3 -mpip install torch --extra-index-url=https://download.pytorch.org/whl/nightly
34+
conda run -p ${ENV_NAME} python3 setup.py develop
35+
conda run -p ${ENV_NAME} python3 -mpip install pytest pytest-mock av
36+
- name: Run tests
37+
shell: arch -arch arm64 bash {0}
38+
env:
39+
ENV_NAME: conda-env-${{ github.run_id }}
40+
PY_VERS: ${{ matrix.py_vers }}
41+
run: |
42+
. ~/miniconda3/etc/profile.d/conda.sh
43+
set -ex
44+
conda run -p ${ENV_NAME} --no-capture-output python3 -u -mpytest -v --tb=long --durations 20
45+
conda env remove -p ${ENV_NAME}

0 commit comments

Comments
 (0)