|
| 1 | +name: Validate MacOS Binaries |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + main |
| 7 | + paths: |
| 8 | + - .github/workflows/validate-MacOS-binaries.yml |
| 9 | + pull_request: |
| 10 | + paths: |
| 11 | + - .github/workflows/validate-MacOS-binaries.yml |
| 12 | + |
| 13 | +jobs: |
| 14 | + validate-MacOS-conda-packages: |
| 15 | + runs-on: ${{ matrix.mac_arch }} |
| 16 | + strategy: |
| 17 | + fail-fast: false |
| 18 | + matrix: |
| 19 | + mac_arch: [macos-m1-12, macos-12-xl] |
| 20 | + python_version: ["3.8", "3.9", "3.10"] |
| 21 | + conda_channel: [pytorch-nightly, pytorch-test, pytorch] |
| 22 | + include: |
| 23 | + - mac_arch: macos-12-xl |
| 24 | + python_version: "3.7" |
| 25 | + conda_channel: pytorch-nightly |
| 26 | + - mac_arch: macos-12-xl |
| 27 | + python_version: "3.7" |
| 28 | + conda_channel: pytorch-test |
| 29 | + - mac_arch: macos-12-xl |
| 30 | + python_version: "3.7" |
| 31 | + conda_channel: pytorch |
| 32 | + env: |
| 33 | + MAC_ARCH: ${{ matrix.mac_arch }} |
| 34 | + PYTHON_VERSION: ${{ matrix.python_version }} |
| 35 | + steps: |
| 36 | + - name: Install Fresh Miniconda in Runner Temp Dir |
| 37 | + run: | |
| 38 | + set -ex |
| 39 | + if [ ${MAC_ARCH} == 'macos-m1-12' ]; then |
| 40 | + cd ${{ runner.temp }} |
| 41 | + curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh |
| 42 | + sh Miniconda3-latest-MacOSX-arm64.sh -b -f -p ${{ runner.temp }} |
| 43 | + elif [ ${MAC_ARCH} == 'macos-12-xl' ]; then |
| 44 | + cd ${{ runner.temp }} |
| 45 | + curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh |
| 46 | + sh Miniconda3-latest-MacOSX-x86_64.sh -b -f -p ${{ runner.temp }} |
| 47 | + fi |
| 48 | + - name: Conda Install pytorch and smoke test |
| 49 | + env: |
| 50 | + ENV_NAME: conda-env-${{ github.run_id }} |
| 51 | + run: | |
| 52 | + set -ex |
| 53 | + conda create -yp ${ENV_NAME} python=${PYTHON_VERSION} numpy |
| 54 | + conda install -p ${ENV_NAME} pytorch torchvision torchaudio -c ${{ matrix.conda_channel }} |
| 55 | + # Test torch is importable |
| 56 | + conda run -p ${ENV_NAME} python3 -c "import torch;y=torch.randn([3,5]);print(y);" |
| 57 | + conda env remove -p ${ENV_NAME} |
| 58 | +
|
| 59 | + validate-MacOS-wheels: |
| 60 | + runs-on: ${{ matrix.mac_arch }} |
| 61 | + strategy: |
| 62 | + fail-fast: false |
| 63 | + matrix: |
| 64 | + mac_arch: [macos-m1-12, macos-12-xl] |
| 65 | + python_version: ["3.8", "3.9", "3.10"] |
| 66 | + pip_channel: [pytorch-nightly, pytorch-test, pytorch] |
| 67 | + include: |
| 68 | + - mac_arch: macos-12-xl |
| 69 | + python_version: "3.7" |
| 70 | + pip_channel: pytorch-nightly |
| 71 | + - mac_arch: macos-12-xl |
| 72 | + python_version: "3.7" |
| 73 | + pip_channel: pytorch-test |
| 74 | + - mac_arch: macos-12-xl |
| 75 | + python_version: "3.7" |
| 76 | + pip_channel: pytorch |
| 77 | + env: |
| 78 | + MAC_ARCH: ${{ matrix.mac_arch }} |
| 79 | + PYTHON_VERSION: ${{ matrix.python_version }} |
| 80 | + PIP_CHANNEL: ${{ matrix.pip_channel }} |
| 81 | + steps: |
| 82 | + - name: Install Fresh Miniconda in Runner Temp Dir |
| 83 | + run: | |
| 84 | + set -ex |
| 85 | + if [ ${MAC_ARCH} == 'macos-m1-12' ]; then |
| 86 | + cd ${{ runner.temp }} |
| 87 | + curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh |
| 88 | + sh Miniconda3-latest-MacOSX-arm64.sh -b -f -p ${{ runner.temp }} |
| 89 | + elif [ ${MAC_ARCH} == 'macos-12-xl' ]; then |
| 90 | + cd ${{ runner.temp }} |
| 91 | + curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh |
| 92 | + sh Miniconda3-latest-MacOSX-x86_64.sh -b -f -p ${{ runner.temp }} |
| 93 | + fi |
| 94 | + - name: pip install pytorch nightly and smoke test |
| 95 | + env: |
| 96 | + ENV_NAME: conda-env-${{ github.run_id }} |
| 97 | + run: | |
| 98 | + set -ex |
| 99 | + conda create -yp ${ENV_NAME} python=${PYTHON_VERSION} numpy |
| 100 | +
|
| 101 | + if [ ${PIP_CHANNEL} == 'pytorch-nightly' ]; then |
| 102 | + conda run -p ${ENV_NAME} pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu |
| 103 | + elif [ ${PIP_CHANNEL} == 'pytorch-test' ]; then |
| 104 | + conda run -p ${ENV_NAME} pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/test/cpu |
| 105 | + else |
| 106 | + conda run -p ${ENV_NAME} pip3 install torch torchvision torchaudio |
| 107 | + fi |
| 108 | +
|
| 109 | + # Test torch is importable |
| 110 | + conda run -p ${ENV_NAME} python3 -c "import torch;y=torch.randn([3,5]);print(y);" |
| 111 | + conda env remove -p ${ENV_NAME} |
0 commit comments