|
35 | 35 | env:
|
36 | 36 | ENV_NAME: conda-env-${{ github.run_id }}
|
37 | 37 | PY_VERS: ${{ matrix.py_vers }}
|
| 38 | + CU_VERSION: cpu |
| 39 | + USE_FFMPEG: true |
| 40 | + USE_OPENMP: false |
| 41 | + USE_CUDA: false |
38 | 42 | run: |
|
39 | 43 | echo $PATH
|
40 | 44 | . ~/miniconda3/etc/profile.d/conda.sh
|
|
46 | 50 | else
|
47 | 51 | setup_build_version
|
48 | 52 | fi
|
| 53 | + git submodule update --init --recursive |
| 54 | + export SOURCE_ROOT_DIR=$(pwd) |
| 55 | + export FFMPEG_ROOT="${SOURCE_ROOT_DIR}/third_party/ffmpeg" |
| 56 | + . packaging/ffmpeg/build.sh |
49 | 57 | WHL_NAME=torchaudio-${BUILD_VERSION}-cp${PY_VERS/.}-cp${PY_VERS/.}-macosx_11_0_arm64.whl
|
50 | 58 | conda create -yp ${ENV_NAME} python=${PY_VERS} numpy cmake ninja wheel pkg-config
|
51 | 59 | conda run -p ${ENV_NAME} python3 -mpip install torch --pre --extra-index-url=https://download.pytorch.org/whl/${CHANNEL}
|
|
70 | 78 | conda run --cwd /tmp -p ${ENV_NAME} python3 -c "import torch;import torchaudio;torchaudio.set_audio_backend('sox_io')"
|
71 | 79 | conda env remove -p ${ENV_NAME}
|
72 | 80 | - name: Upload wheel to GitHub
|
73 |
| - if: ${{ github.event_name == 'push' && (github.event.ref == 'refs/heads/nightly' || startsWith(github.event.ref, 'refs/tags/')) }} |
74 | 81 | uses: actions/upload-artifact@v3
|
75 | 82 | with:
|
76 | 83 | name: torchaudio-py${{ matrix.py_vers }}-macos11-m1
|
|
85 | 92 | for pkg in dist/*; do
|
86 | 93 | aws s3 cp "$pkg" "s3://pytorch/whl/${CHANNEL}/cpu/" --acl public-read
|
87 | 94 | done
|
| 95 | + build_conda: |
| 96 | + name: "Build TorchAudio M1 conda packages" |
| 97 | + runs-on: macos-m1-11 |
| 98 | + strategy: |
| 99 | + matrix: |
| 100 | + py_vers: [ "3.8", "3.9", "3.10" ] |
| 101 | + steps: |
| 102 | + - name: Checkout repository |
| 103 | + uses: actions/checkout@v2 |
| 104 | + - name: Set CHANNEL (only for tagged pushes) |
| 105 | + if: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/') }} |
| 106 | + run: | |
| 107 | + # reference ends with an RC suffix |
| 108 | + if [[ ${GITHUB_REF_NAME} = *-rc[0-9]* ]]; then |
| 109 | + echo "CHANNEL=test" >> "$GITHUB_ENV" |
| 110 | + fi |
| 111 | + - name: Install conda-build and purge previous artifacts |
| 112 | + shell: arch -arch arm64 bash {0} |
| 113 | + run: | |
| 114 | + . ~/miniconda3/etc/profile.d/conda.sh |
| 115 | + conda install -yq conda-build |
| 116 | + conda build purge-all |
| 117 | + - name: Build TorchAudio M1 conda package |
| 118 | + shell: arch -arch arm64 bash {0} |
| 119 | + env: |
| 120 | + ENV_NAME: conda-env-${{ github.run_id }} |
| 121 | + PYTHON_VERSION: ${{ matrix.py_vers }} |
| 122 | + CU_VERSION: cpu |
| 123 | + USE_FFMPEG: true |
| 124 | + USE_OPENMP: false |
| 125 | + USE_CUDA: false |
| 126 | + run: | |
| 127 | + . ~/miniconda3/etc/profile.d/conda.sh |
| 128 | + set -ex |
| 129 | + . packaging/pkg_helpers.bash |
| 130 | +
|
| 131 | + export CONDA_CHANNEL_FLAGS="" |
| 132 | + if [[ $CHANNEL == "test" ]]; then |
| 133 | + setup_cuda |
| 134 | + setup_base_build_version |
| 135 | + export CONDA_CHANNEL_FLAGS="pytorch-test" |
| 136 | + etup_macos |
| 137 | + else |
| 138 | + setup_cuda |
| 139 | + setup_build_version |
| 140 | + setup_macos |
| 141 | + fi |
| 142 | + export PYTORCH_VERSION="$(conda run -p ${ENV_NAME} python3 -mpip show torch | grep ^Version: | sed 's/Version: *//')" |
| 143 | + git submodule update --init --recursive |
| 144 | + export SOURCE_ROOT_DIR=$(pwd) |
| 145 | + export FFMPEG_ROOT="${SOURCE_ROOT_DIR}/third_party/ffmpeg" |
| 146 | + . packaging/ffmpeg/build.sh |
| 147 | + setup_conda_pytorch_constraint |
| 148 | + setup_conda_cudatoolkit_constraint |
| 149 | + setup_visual_studio_constraint |
| 150 | + conda build -c defaults $CONDA_CHANNEL_FLAGS --no-anaconda-upload --python "$PYTHON_VERSION" packaging/torchaudio |
| 151 | + mkdir -p dist |
| 152 | + cp ~/miniconda3/conda-bld/osx-arm64/*.tar.bz2 dist/ |
| 153 | + - name: Upload package to GitHub |
| 154 | + uses: actions/upload-artifact@v3 |
| 155 | + with: |
| 156 | + name: torchaudio-py${{ matrix.py_vers }}-macos11-m1-conda |
| 157 | + path: dist/ |
| 158 | + - name: Upload package to conda |
| 159 | + if: ${{ github.event_name == 'push' && (github.event.ref == 'refs/heads/nightly' || startsWith(github.event.ref, 'refs/tags/')) }} |
| 160 | + shell: arch -arch arm64 bash {0} |
| 161 | + env: |
| 162 | + CONDA_PYTORCHBOT_TOKEN: ${{ secrets.CONDA_PYTORCHBOT_TOKEN }} |
| 163 | + run: | |
| 164 | + . ~/miniconda3/etc/profile.d/conda.sh |
| 165 | + conda install -yq anaconda-client |
| 166 | + set -x |
| 167 | + anaconda -t "${CONDA_PYTORCHBOT_TOKEN}" upload ~/miniconda3/conda-bld/osx-arm64/*.tar.bz2 -u "pytorch-${CHANNEL}" --label main --no-progress --force |
0 commit comments