|
| 1 | +name: Build documentation |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - nightly |
| 8 | + - main |
| 9 | + - release/* |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +jobs: |
| 13 | + upload: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + needs: build |
| 16 | + steps: |
| 17 | + - uses: actions/download-artifact@v3 |
| 18 | + with: |
| 19 | + name: docs |
| 20 | + - name: Tweak the doc artifact |
| 21 | + run: | |
| 22 | + ls . |
| 23 | +
|
| 24 | + |
| 25 | + build: |
| 26 | + strategy: |
| 27 | + matrix: |
| 28 | + python_version: ["3.10"] |
| 29 | + cuda_arch_version: ["11.7"] |
| 30 | + fail-fast: false |
| 31 | + uses: pytorch/test-infra/.github/workflows/linux_job.yml@main |
| 32 | + with: |
| 33 | + job-name: Build doc |
| 34 | + runner: linux.g5.4xlarge.nvidia.gpu |
| 35 | + repository: pytorch/audio |
| 36 | + gpu-arch-type: cuda |
| 37 | + gpu-arch-version: ${{ matrix.cuda_arch_version }} |
| 38 | + timeout: 120 |
| 39 | + upload-artifact: docs |
| 40 | + |
| 41 | + script: | |
| 42 | + # Mark Build Directory Safe |
| 43 | + git config --global --add safe.directory /__w/audio/audio |
| 44 | +
|
| 45 | + # Set up Environment Variables |
| 46 | + export PYTHON_VERSION="${{ matrix.python_version }}" |
| 47 | + export CU_VERSION="${{ matrix.cuda_arch_version }}" |
| 48 | + export CUDATOOLKIT="pytorch-cuda=${CU_VERSION}" |
| 49 | +
|
| 50 | + # Set CHANNEL |
| 51 | + if [[(${GITHUB_EVENT_NAME} = 'pull_request' && (${GITHUB_BASE_REF} = 'release'*)) || (${GITHUB_REF} = 'refs/heads/release'*) ]]; then |
| 52 | + export CHANNEL=test |
| 53 | + else |
| 54 | + export CHANNEL=nightly |
| 55 | + fi |
| 56 | +
|
| 57 | + # Create Conda Env |
| 58 | + conda create --quiet -y --prefix ci_env python="${PYTHON_VERSION}" |
| 59 | + conda activate ./ci_env |
| 60 | +
|
| 61 | + # Install PyTorch |
| 62 | + set -ex |
| 63 | + set +u # don't know why |
| 64 | + conda install \ |
| 65 | + --yes \ |
| 66 | + --quiet \ |
| 67 | + -c "pytorch-${CHANNEL}" \ |
| 68 | + -c nvidia "pytorch-${CHANNEL}"::pytorch[build="*${CU_VERSION}*"] \ |
| 69 | + "${CUDATOOLKIT}" |
| 70 | +
|
| 71 | + # Install torchaudio |
| 72 | + # TODO: Enable NVDec/NVEnc |
| 73 | + conda install --quiet -y 'ffmpeg>=4.1' pkg-config |
| 74 | + pip --quiet install cmake>=3.18.0 ninja |
| 75 | + USE_FFMPEG=1 pip install --progress-bar off -v -e . --no-use-pep517 |
| 76 | +
|
| 77 | + # Install build tools |
| 78 | + conda install --quiet -y -c conda-forge pandoc doxygen pysoundfile |
| 79 | + pip install --quiet -r docs/requirements.txt -r docs/requirements-tutorials.txt |
| 80 | +
|
| 81 | + # Build docs |
| 82 | + export BUILD_GALLERY=true |
| 83 | + (cd docs && make html) |
| 84 | +
|
| 85 | + mv docs/build/html /artifacts/ |
0 commit comments