|
| 1 | +name: Docs |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - nightly |
| 8 | + - main |
| 9 | + - release/* |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +jobs: |
| 13 | + build: |
| 14 | + strategy: |
| 15 | + matrix: |
| 16 | + python-version: ["3.11"] |
| 17 | + cuda-version: ["12.6"] |
| 18 | + ffmpeg-version: ["7"] |
| 19 | + fail-fast: false |
| 20 | + uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main |
| 21 | + permissions: |
| 22 | + id-token: write |
| 23 | + contents: read |
| 24 | + with: |
| 25 | + runner: linux.4xlarge.nvidia.gpu |
| 26 | + repository: pytorch/audio |
| 27 | + gpu-arch-type: cuda |
| 28 | + gpu-arch-version: ${{ matrix.cuda-version }} |
| 29 | + timeout: 120 |
| 30 | + job-name: docs |
| 31 | + |
| 32 | + script: | |
| 33 | + set -ex |
| 34 | + # Set up Environment Variables |
| 35 | + export PYTHON_VERSION="${{ matrix.python-version }}" |
| 36 | + export FFMPEG_VERSION="${{ matrix.ffmpeg-version }}" |
| 37 | + export CU_VERSION_WITHOUT_PERIODS="$(echo "${{ matrix.cuda-version }}" | sed 's/\.//g')" |
| 38 | + export PIP_PROGRESS_BAR=off |
| 39 | + export CONDA_QUIET=1 |
| 40 | +
|
| 41 | + # Set UPLOAD_CHANNEL |
| 42 | + if [[(${GITHUB_EVENT_NAME} = 'pull_request' && (${GITHUB_BASE_REF} = 'release'*)) || (${GITHUB_REF} = 'refs/heads/release'*) ]]; then |
| 43 | + export UPLOAD_CHANNEL=test |
| 44 | + else |
| 45 | + export UPLOAD_CHANNEL=nightly |
| 46 | + fi |
| 47 | +
|
| 48 | + echo "::group::Create conda env" |
| 49 | + # Mark Build Directory Safe |
| 50 | + git config --global --add safe.directory /__w/audio/audio |
| 51 | + conda create -c conda-forge --strict-channel-priority -y --prefix ci_env python="${PYTHON_VERSION}" ffmpeg="${FFMPEG_VERSION}" cmake ninja |
| 52 | + conda activate ./ci_env |
| 53 | + conda info |
| 54 | + python -m pip install --upgrade pip |
| 55 | + echo "::endgroup::" |
| 56 | +
|
| 57 | + echo "::group::Install PyTorch and TorchCodec" |
| 58 | + PYTORCH_WHEEL_INDEX="https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/cu${CU_VERSION_WITHOUT_PERIODS}" |
| 59 | + python -m pip install numpy |
| 60 | + python -m pip install --pre torch torchcodec --index-url="${PYTORCH_WHEEL_INDEX}" |
| 61 | + python -c 'import torch; print(f"{torch.__version__}"); print(f"{torch.__file__}"); print(f"{torch.cuda.is_available()=}")' |
| 62 | + echo "::endgroup::" |
| 63 | +
|
| 64 | + echo "::group::Build and install TorchAudio" |
| 65 | + python -m pip install . -v --no-build-isolation |
| 66 | + echo "::endgroup::" |
| 67 | +
|
| 68 | + echo "::group::Install TorchAudio documentation build requirements" |
| 69 | + python -m pip install -r docs/requirements.txt -r docs/requirements-tutorials.txt |
| 70 | + echo "::endgroup::" |
| 71 | +
|
| 72 | + echo "::group::Build TorchAudio documentation" |
| 73 | + export BUILD_GALLERY=true |
| 74 | + (cd docs && make html) |
| 75 | + echo "::endgroup::" |
| 76 | +
|
| 77 | + echo "::group::Copy artifacts" |
| 78 | + cp -rf docs/build/html/* "${RUNNER_DOCS_DIR}" |
| 79 | + mv docs/build/html /artifacts/ |
| 80 | + echo "::endgroup::" |
0 commit comments