Skip to content

Commit 417938a

Browse files
committed
Switch to using linux_job_v2
1 parent b6ab64a commit 417938a

File tree

1 file changed

+63
-71
lines changed

1 file changed

+63
-71
lines changed

.github/workflows/docs.yaml

Lines changed: 63 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,71 @@
11
name: Docs
22

33
on:
4-
push:
5-
branches: [ main ]
64
pull_request:
7-
8-
permissions:
9-
id-token: write
10-
contents: write
11-
12-
defaults:
13-
run:
14-
shell: bash -l -eo pipefail {0}
5+
push:
6+
branches:
7+
- nightly
8+
- main
9+
- release/*
10+
workflow_dispatch:
1511

1612
jobs:
17-
build-docs:
13+
build:
1814
strategy:
19-
fail-fast: false
2015
matrix:
21-
python-version: ['3.10']
22-
cuda-version: ['12.6']
23-
ffmpeg-version: ['7']
24-
runs-on: linux.g5.4xlarge.nvidia.gpu
25-
env:
26-
REPOSITORY: pytorch/audio
27-
REF: ""
28-
steps:
29-
- name: Setup env vars
30-
run: |
31-
cuda_version_without_periods=$(echo "${{ matrix.cuda-version }}" | sed 's/\.//g')
32-
echo cuda_version_without_periods=${cuda_version_without_periods} >> $GITHUB_ENV
33-
python_version_without_periods=$(echo "${{ matrix.python-version }}" | sed 's/\.//g')
34-
echo python_version_without_periods=${python_version_without_periods} >> $GITHUB_ENV
35-
- name: Setup miniconda using test-infra
36-
uses: pytorch/test-infra/.github/actions/setup-miniconda@main
37-
with:
38-
python-version: ${{ matrix.python-version }}
39-
# We install conda packages at the start because otherwise conda may have conflicts with dependencies.
40-
default-packages: "nvidia/label/cuda-${{ matrix.cuda-version }}.0::libnpp nvidia::cuda-nvrtc=${{ matrix.cuda-version }} nvidia::cuda-toolkit=${{ matrix.cuda-version }} nvidia::cuda-cudart=${{ matrix.cuda-version }} nvidia::cuda-driver-dev=${{ matrix.cuda-version }} conda-forge::ffmpeg=${{ matrix.ffmpeg-version }} cmake ninja"
41-
- uses: pytorch/test-infra/.github/actions/setup-binary-builds@main
42-
with:
43-
setup-miniconda: false
44-
python-version: ${{ matrix.python-version }}
45-
cuda-version: ${{ matrix.cuda-version }}
46-
repository: ""
47-
- name: Check env
48-
run: |
49-
${CONDA_RUN} env
50-
${CONDA_RUN} conda info
51-
${CONDA_RUN} nvidia-smi
52-
${CONDA_RUN} conda list
53-
- name: Assert ffmpeg exists
54-
run: |
55-
${CONDA_RUN} ffmpeg -buildconf
56-
- name: Update pip
57-
run: ${CONDA_RUN} python -m pip install --upgrade pip
58-
- name: Install PyTorch
59-
run: |
60-
${CONDA_RUN} python -m pip install --pre torch torchcodec --index-url https://download.pytorch.org/whl/nightly/cu${{ env.cuda_version_without_periods }}
61-
${CONDA_RUN} python -c 'import torch; print(f"{torch.__version__}"); print(f"{torch.__file__}"); print(f"{torch.cuda.is_available()=}")'
62-
- name: Check out repo
63-
uses: actions/checkout@v3
64-
- name: Install torchaudio
65-
run: |
66-
export USE_CUDA=1
67-
${CONDA_RUN} python -m pip install . -v --no-build-isolation
68-
- name: Install doc dependencies
69-
run: |
70-
cd docs
71-
${CONDA_RUN} python -m pip install -r requirements.txt -r requirements-tutorials.txt
72-
- name: Build docs
73-
run: |
74-
cd docs
75-
${CONDA_RUN} make html
76-
- uses: actions/upload-artifact@v4
77-
with:
78-
name: Built-Docs
79-
path: docs/build/html/
16+
# TODO add up to 3.13
17+
python_version: ["3.10"]
18+
cuda-version: ["12.6"]
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.g5.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+
# run-with-docker: false
32+
33+
script: |
34+
set -ex
35+
# Set up Environment Variables
36+
export PYTHON_VERSION="${{ matrix.python_version }}"
37+
export PIP_PROGRESS_BAR=off
38+
export CONDA_QUIET=1
39+
export CU_VERSION="${{ matrix.cuda-version }}"
40+
export CU_VERSION_WITHOUT_PERIODS="$(echo "${{ matrix.cuda-version }}" | sed 's/\.//g')"
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=7 cmake ninja
52+
conda activate ./ci_env
53+
conda info
54+
55+
python -m pip install --upgrade pip
56+
57+
echo "::endgroup::"
58+
echo "::group::Install PyTorch and TorchCodec"
59+
PYTORCH_WHEEL_INDEX="https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/cu${CU_VERSION_WITHOUT_PERIODS}"
60+
python -m pip install --progress-bar=off --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+
echo "::group::Build and install TorchAudio"
64+
python -m pip install . -v --no-build-isolation
65+
echo "::endgroup::"
66+
echo "::group::Build TorchAudio documentation"
67+
cd docs
68+
python -m pip install -r requirements.txt -r requirements-tutorials.txt
69+
make html
70+
echo "::endgroup::"
71+
# TODO: upload

0 commit comments

Comments
 (0)