|
96 | 96 | for pkg in dist/*; do
|
97 | 97 | aws s3 cp "$pkg" "s3://pytorch/whl/${CHANNEL}/cpu/" --acl public-read
|
98 | 98 | done
|
| 99 | + build_conda: |
| 100 | + name: "Build TorchText M1 conda packages" |
| 101 | + runs-on: macos-m1 |
| 102 | + strategy: |
| 103 | + matrix: |
| 104 | + py_vers: ["3.8", "3.9", "3.10"] |
| 105 | + steps: |
| 106 | + - name: Checkout repository |
| 107 | + uses: actions/checkout@v2 |
| 108 | + - name: Set CHANNEL (only for tagged pushes) |
| 109 | + if: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/') }} |
| 110 | + run: | |
| 111 | + # reference ends with an RC suffix |
| 112 | + if [[ ${GITHUB_REF_NAME} = *-rc[0-9]* ]]; then |
| 113 | + echo "CHANNEL=test" >> "$GITHUB_ENV" |
| 114 | + fi |
| 115 | + - name: Set CHANNEL Release (for release) |
| 116 | + if: |
| 117 | + ${{ (github.event_name == 'pull_request' && startsWith(github.base_ref, 'release')) || startsWith(github.ref, |
| 118 | + 'refs/heads/release') }} |
| 119 | + run: | |
| 120 | + echo "CHANNEL=test" >> "$GITHUB_ENV" |
| 121 | + - name: Install conda-build and purge previous artifacts |
| 122 | + shell: arch -arch arm64 bash {0} |
| 123 | + run: | |
| 124 | + . ~/miniconda3/etc/profile.d/conda.sh |
| 125 | + conda install -yq conda-build |
| 126 | + conda build purge-all |
| 127 | +
|
| 128 | + - name: Build TorchText M1 conda package |
| 129 | + shell: arch -arch arm64 bash {0} |
| 130 | + env: |
| 131 | + ENV_NAME: conda-env-${{ github.run_id }} |
| 132 | + PYTHON_VERSION: ${{ matrix.py_vers }} |
| 133 | + CU_VERSION: cpu |
| 134 | + run: | |
| 135 | + . ~/miniconda3/etc/profile.d/conda.sh |
| 136 | + set -ex |
| 137 | + . packaging/pkg_helpers.bash |
| 138 | +
|
| 139 | + if [[ $CHANNEL == "test" ]]; then |
| 140 | + setup_base_build_version |
| 141 | + export CONDA_CHANNEL_FLAGS="-c pytorch-test" |
| 142 | + else |
| 143 | + setup_build_version |
| 144 | + fi |
| 145 | + export BUILD_TYPE="conda" |
| 146 | + export NO_CUDA_PACKAGE=1 |
| 147 | + export SOURCE_ROOT_DIR="$PWD" |
| 148 | +
|
| 149 | + setup_conda_pytorch_constraint |
| 150 | + export SOURCE_ROOT_DIR=$(pwd) |
| 151 | + conda build -c defaults $CONDA_CHANNEL_FLAGS --no-anaconda-upload --python "$PYTHON_VERSION" packaging/torchtext |
| 152 | + mkdir -p dist |
| 153 | + cp ~/miniconda3/conda-bld/osx-arm64/*.tar.bz2 dist/ |
| 154 | + - name: Upload package to GitHub |
| 155 | + uses: actions/upload-artifact@v3 |
| 156 | + with: |
| 157 | + name: torchtext-py${{ matrix.py_vers }}-macos11-m1-conda |
| 158 | + path: dist/ |
| 159 | + - name: Upload package to conda |
| 160 | + if: |
| 161 | + ${{ github.event_name == 'push' && (github.event.ref == 'refs/heads/nightly' || startsWith(github.event.ref, |
| 162 | + 'refs/tags/')) }} |
| 163 | + shell: arch -arch arm64 bash {0} |
| 164 | + env: |
| 165 | + CONDA_PYTORCHBOT_TOKEN: ${{ secrets.CONDA_PYTORCHBOT_TOKEN }} |
| 166 | + run: | |
| 167 | + . ~/miniconda3/etc/profile.d/conda.sh |
| 168 | + conda install -yq anaconda-client |
| 169 | + set -x |
| 170 | + anaconda -t "${CONDA_PYTORCHBOT_TOKEN}" upload ~/miniconda3/conda-bld/osx-arm64/*.tar.bz2 -u "pytorch-${CHANNEL}" --label main --no-progress --force |
0 commit comments