diff --git a/.github/workflows/test-m1.yml b/.github/workflows/test-m1.yml new file mode 100644 index 000000000..98b7ffd0b --- /dev/null +++ b/.github/workflows/test-m1.yml @@ -0,0 +1,59 @@ +name: Test-M1 +on: + pull_request: + types: [opened, synchronize, reopened] + push: + branches: + - main + +jobs: + + tests: + name: "Unit-tests on M1" + runs-on: macos12.3-m1 + strategy: + matrix: + py_vers: [ "3.8"] + + steps: + - name: Checkout functorch + uses: actions/checkout@v2 + - name: Install PyTorch Nightly + shell: arch -arch arm64 bash {0} + env: + ENV_NAME: conda-env-${{ github.run_id }} + PY_VERS: ${{ matrix.py_vers }} + run: | + . ~/miniconda3/etc/profile.d/conda.sh + export PATH=~/miniconda3/bin:$PATH + set -ex + conda create -yp ${ENV_NAME} python=${PY_VERS} + conda run -p ${ENV_NAME} python3 -mpip install --pre torch>=1.12.0.dev torchvision -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html + - name: Build Functorch and run tests + shell: arch -arch arm64 bash {0} + env: + ENV_NAME: conda-env-${{ github.run_id }} + PY_VERS: ${{ matrix.py_vers }} + run: | + . ~/miniconda3/etc/profile.d/conda.sh + set -ex + + conda run -p ${ENV_NAME} python3 setup.py develop + conda run -p ${ENV_NAME} python3 -m torch.utils.collect_env + # test_functorch_lagging_op_db.py: Only run this locally because it checks + # the functorch lagging op db vs PyTorch's op db. + # EXIT_STATUS=0 + + export IN_CI=1 + mkdir test-reports + + # find test \( -name test\*.py ! -name test_functorch_lagging_op_db.py \) | xargs -I {} -n 1 python3 {} -v || EXIT_STATUS=$? + + # Just check vmap, ops and other eager ops + conda run -p ${ENV_NAME} conda install pyyaml + conda run -p ${ENV_NAME} python3 -mpip install pytest numpy scipy expecttest unittest-xml-reporting networkx av + conda run -p ${ENV_NAME} --no-capture-output python3 -u -mpytest -vvv test/test_vmap.py test/test_ops.py test/test_eager_transforms.py + + conda env remove -p ${ENV_NAME} + # exit $EXIT_STATUS +