|
1 |
| -# name: Build documentation |
2 |
| - |
3 |
| -# # Documentation is deployed in the following ways |
4 |
| -# # 1. Each time a commit is pushed to main branch |
5 |
| -# # 2. Nightly (so that docs are updated even when there is no commit to main branch on the day) |
6 |
| -# # 3. Manual trigger for release |
7 |
| -# # Because release requires changing the version number, which is used as a directory name, |
8 |
| -# # automating release doc deployment is tricky. |
9 |
| -# # There is no reliable way to know if there should have been a minor version bump. |
10 |
| -# # |
11 |
| -# on: |
12 |
| -# pull_request: |
13 |
| -# push: |
14 |
| -# branches: |
15 |
| -# - main |
16 |
| -# workflow_dispatch: |
17 |
| -# schedule: |
18 |
| -# - cron: '0 0 * * *' |
19 |
| - |
20 |
| -# jobs: |
21 |
| -# build: |
22 |
| -# # Do not use matrix here to parameterize Python/CUDA versions. |
23 |
| -# # This job is required to pass for each PR. |
24 |
| -# # The name of the required job is sensitive to matrix parameter. |
25 |
| -# uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main |
26 |
| -# permissions: |
27 |
| -# id-token: write |
28 |
| -# contents: read |
29 |
| -# with: |
30 |
| -# job-name: Build doc |
31 |
| -# runner: linux.g5.4xlarge.nvidia.gpu |
32 |
| -# repository: pytorch/audio |
33 |
| -# gpu-arch-type: cuda |
34 |
| -# gpu-arch-version: "11.8" |
35 |
| -# timeout: 120 |
36 |
| -# upload-artifact: docs |
37 |
| - |
38 |
| -# script: | |
39 |
| -# set -ex |
40 |
| -# # Set up Environment Variables |
41 |
| -# export PYTHON_VERSION="3.10" |
42 |
| -# export CU_VERSION="11.8" |
43 |
| -# export CUDATOOLKIT="pytorch-cuda=${CU_VERSION}" |
44 |
| - |
45 |
| -# # Set CHANNEL |
46 |
| -# if [[(${GITHUB_EVENT_NAME} = 'pull_request' && (${GITHUB_BASE_REF} = 'release'*)) || (${GITHUB_REF} = 'refs/heads/release'*) ]]; then |
47 |
| -# export CHANNEL=test |
48 |
| -# export BUILD_VERSION="$( cut -f 1 -d a version.txt )" |
49 |
| -# else |
50 |
| -# export CHANNEL=nightly |
51 |
| -# export BUILD_VERSION="$( cut -f 1 -d a version.txt )".dev"$(date "+%Y%m%d")" |
52 |
| -# fi |
53 |
| - |
54 |
| -# echo "::group::Create conda env" |
55 |
| -# # Mark Build Directory Safe |
56 |
| -# git config --global --add safe.directory /__w/audio/audio |
57 |
| -# conda create --quiet -y --prefix ci_env python="${PYTHON_VERSION}" |
58 |
| -# conda activate ./ci_env |
59 |
| - |
60 |
| -# echo "::endgroup::" |
61 |
| -# echo "::group::Install PyTorch" |
62 |
| -# conda install \ |
63 |
| -# --yes \ |
64 |
| -# --quiet \ |
65 |
| -# -c "pytorch-${CHANNEL}" \ |
66 |
| -# -c nvidia "pytorch-${CHANNEL}"::pytorch[build="*${CU_VERSION}*"] \ |
67 |
| -# "${CUDATOOLKIT}" |
68 |
| - |
69 |
| -# echo "::endgroup::" |
70 |
| -# echo "::group::Install TorchAudio" |
71 |
| -# conda install --quiet --yes cmake>=3.18.0 ninja |
72 |
| -# pip3 install --progress-bar off -v -e . --no-use-pep517 |
73 |
| - |
74 |
| -# echo "::endgroup::" |
75 |
| -# echo "::group::Build FFmpeg" |
76 |
| -# .github/scripts/ffmpeg/build_gpu.sh |
77 |
| - |
78 |
| -# echo "::endgroup::" |
79 |
| -# echo "::group::Install other dependencies" |
80 |
| -# conda install \ |
81 |
| -# --quiet --yes \ |
82 |
| -# -c conda-forge \ |
83 |
| -# sox libvorbis pandoc doxygen pysoundfile |
84 |
| -# pip install --progress-bar off \ |
85 |
| -# git+https://github.com/kpu/kenlm/ flashlight-text \ |
86 |
| -# -r docs/requirements.txt -r docs/requirements-tutorials.txt |
87 |
| - |
88 |
| -# echo "::endgroup::" |
89 |
| -# echo "::group::Build documentation" |
90 |
| -# export BUILD_GALLERY=true |
91 |
| -# (cd docs && make html) |
92 |
| - |
93 |
| -# echo "::endgroup::" |
94 |
| -# echo "::group::Copy artifact" |
95 |
| -# cp -rf docs/build/html/* "${RUNNER_DOCS_DIR}" |
96 |
| -# mv docs/build/html /artifacts/ |
97 |
| - |
98 |
| -# commit-main: |
99 |
| -# if: github.ref_name == 'main' |
100 |
| -# permissions: |
101 |
| -# # Required for `git push` |
102 |
| -# # Note: |
103 |
| -# # This is not effective from fork. |
104 |
| -# # When you debug this, make sure to make a branch on pytorch and |
105 |
| -# # make PR from there. |
106 |
| -# contents: write |
107 |
| -# runs-on: ubuntu-latest |
108 |
| -# needs: build |
109 |
| -# steps: |
110 |
| -# - uses: actions/checkout@v3 |
111 |
| -# with: |
112 |
| -# ref: gh-pages |
113 |
| -# fetch-depth: 5 |
114 |
| -# - uses: actions/download-artifact@v3 |
115 |
| -# with: |
116 |
| -# name: docs |
117 |
| -# - name: Update main doc |
118 |
| -# run: | |
119 |
| -# set -x |
120 |
| - |
121 |
| -# git config user.name "pytorchbot" |
122 |
| -# git config user.email "[email protected]" |
123 |
| -# # When `git clone`, `gh-pages` branch is fetched by default. |
124 |
| -# # The size of gh-pages grows significantly, so we use ammend and force push |
125 |
| -# # We add a new commit once a week |
126 |
| -# if [ "$(date +%d)" = "1" ]; then |
127 |
| -# git commit --allow-empty -m "placeholder" |
128 |
| -# fi |
129 |
| - |
130 |
| -# # TODO: add tag-based process (need to handle the main directory name) |
131 |
| -# # Update the main doc |
132 |
| -# rm -rf main |
133 |
| -# mv html main |
134 |
| -# git add --all main || true |
135 |
| - |
136 |
| -# git commit --amend -m "auto-generating sphinx docs" || true |
137 |
| -# git push -f |
138 |
| - |
139 |
| -# # Push for release |
140 |
| -# # Make sure that version.txt is updated first (alpha suffix is removed) |
141 |
| -# commit-release: |
142 |
| -# if: startsWith(github.ref_name, 'release/') && ( github.event_name == 'workflow_dispatch' ) |
143 |
| -# permissions: |
144 |
| -# # Required for `git push` |
145 |
| -# # Note: |
146 |
| -# # This is not effective from fork. |
147 |
| -# # When you debug this, make sure to make a branch on pytorch and |
148 |
| -# # make PR from there. |
149 |
| -# contents: write |
150 |
| -# runs-on: ubuntu-latest |
151 |
| -# needs: build |
152 |
| -# steps: |
153 |
| -# - uses: actions/checkout@v3 |
154 |
| -# with: |
155 |
| -# ref: gh-pages |
156 |
| -# fetch-depth: 5 |
157 |
| -# - uses: actions/checkout@v4 |
158 |
| -# with: |
159 |
| -# path: _src |
160 |
| -# - uses: actions/download-artifact@v3 |
161 |
| -# with: |
162 |
| -# name: docs |
163 |
| -# - name: Update doc |
164 |
| -# run: | |
165 |
| -# set -x |
166 |
| - |
167 |
| -# git config user.name "pytorchbot" |
168 |
| -# git config user.email "[email protected]" |
169 |
| -# # When `git clone`, `gh-pages` branch is fetched by default. |
170 |
| -# # The size of gh-pages grows significantly, so we use ammend and force push |
171 |
| -# # We add a new commit once a week |
172 |
| -# if [ "$(date +%d)" = "1" ]; then |
173 |
| -# git commit --allow-empty -m "placeholder" |
174 |
| -# fi |
175 |
| - |
176 |
| -# dirname="$(cat _src/version.txt)" |
177 |
| -# rm -rf "${dirname}" |
178 |
| -# mv html "${dirname}" |
179 |
| -# git add --all "${dirname}" || true |
180 |
| - |
181 |
| -# git commit --amend -m "auto-generating sphinx docs" || true |
182 |
| -# git push -f |
| 1 | +name: Build documentation |
| 2 | + |
| 3 | +# Documentation is deployed in the following ways |
| 4 | +# 1. Each time a commit is pushed to main branch |
| 5 | +# 2. Nightly (so that docs are updated even when there is no commit to main branch on the day) |
| 6 | +# 3. Manual trigger for release |
| 7 | +# Because release requires changing the version number, which is used as a directory name, |
| 8 | +# automating release doc deployment is tricky. |
| 9 | +# There is no reliable way to know if there should have been a minor version bump. |
| 10 | +# |
| 11 | +on: |
| 12 | + pull_request: |
| 13 | + push: |
| 14 | + branches: |
| 15 | + - main |
| 16 | + workflow_dispatch: |
| 17 | + schedule: |
| 18 | + - cron: '0 0 * * *' |
| 19 | + |
| 20 | +jobs: |
| 21 | + build: |
| 22 | + # Do not use matrix here to parameterize Python/CUDA versions. |
| 23 | + # This job is required to pass for each PR. |
| 24 | + # The name of the required job is sensitive to matrix parameter. |
| 25 | + uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main |
| 26 | + permissions: |
| 27 | + id-token: write |
| 28 | + contents: read |
| 29 | + with: |
| 30 | + job-name: Build doc |
| 31 | + runner: linux.g5.4xlarge.nvidia.gpu |
| 32 | + repository: pytorch/audio |
| 33 | + gpu-arch-type: cuda |
| 34 | + gpu-arch-version: "12.6" # See GPU_ARCH_ID below |
| 35 | + timeout: 120 |
| 36 | + upload-artifact: docs |
| 37 | + |
| 38 | + script: | |
| 39 | + set -ex |
| 40 | + # Set up Environment Variables |
| 41 | + export PYTHON_VERSION="3.10" |
| 42 | + export CU_VERSION="11.8" |
| 43 | + export CUDATOOLKIT="pytorch-cuda=${CU_VERSION}" |
| 44 | +
|
| 45 | + # Set CHANNEL |
| 46 | + if [[(${GITHUB_EVENT_NAME} = 'pull_request' && (${GITHUB_BASE_REF} = 'release'*)) || (${GITHUB_REF} = 'refs/heads/release'*) ]]; then |
| 47 | + export CHANNEL=test |
| 48 | + export BUILD_VERSION="$( cut -f 1 -d a version.txt )" |
| 49 | + else |
| 50 | + export CHANNEL=nightly |
| 51 | + export BUILD_VERSION="$( cut -f 1 -d a version.txt )".dev"$(date "+%Y%m%d")" |
| 52 | + fi |
| 53 | +
|
| 54 | + echo "::group::Create conda env" |
| 55 | + # Mark Build Directory Safe |
| 56 | + git config --global --add safe.directory /__w/audio/audio |
| 57 | + conda create --quiet -y --prefix ci_env python="${PYTHON_VERSION}" |
| 58 | + conda activate ./ci_env |
| 59 | +
|
| 60 | + echo "::endgroup::" |
| 61 | + echo "::group::Install PyTorch" |
| 62 | + # conda install \ |
| 63 | + # --yes \ |
| 64 | + # --quiet \ |
| 65 | + # -c "pytorch-${CHANNEL}" \ |
| 66 | + # -c nvidia "pytorch-${CHANNEL}"::pytorch[build="*${CU_VERSION}*"] \ |
| 67 | + # "${CUDATOOLKIT}" |
| 68 | +
|
| 69 | + GPU_ARCH_ID=cu126 # This is hard-coded and must be consistent with gpu-arch-version. |
| 70 | + PYTORCH_WHEEL_INDEX="https://download.pytorch.org/whl/${CHANNEL}/${GPU_ARCH_ID}" |
| 71 | + pip install --progress-bar=off --pre torch --index-url="${PYTORCH_WHEEL_INDEX}" |
| 72 | +
|
| 73 | + echo "::endgroup::" |
| 74 | + echo "::group::Install TorchAudio" |
| 75 | + conda install --quiet --yes cmake>=3.18.0 ninja |
| 76 | + pip3 install --progress-bar off -v -e . --no-use-pep517 |
| 77 | +
|
| 78 | + echo "::endgroup::" |
| 79 | + echo "::group::Build FFmpeg" |
| 80 | + .github/scripts/ffmpeg/build_gpu.sh |
| 81 | +
|
| 82 | + echo "::endgroup::" |
| 83 | + echo "::group::Install other dependencies" |
| 84 | + conda install \ |
| 85 | + --quiet --yes \ |
| 86 | + -c conda-forge \ |
| 87 | + sox libvorbis pandoc doxygen pysoundfile |
| 88 | + pip install --progress-bar off \ |
| 89 | + git+https://github.com/kpu/kenlm/ flashlight-text \ |
| 90 | + -r docs/requirements.txt -r docs/requirements-tutorials.txt |
| 91 | +
|
| 92 | + echo "::endgroup::" |
| 93 | + echo "::group::Build documentation" |
| 94 | + # export BUILD_GALLERY=true # TODO put this back? |
| 95 | + (cd docs && make html) |
| 96 | +
|
| 97 | + echo "::endgroup::" |
| 98 | + echo "::group::Copy artifact" |
| 99 | + cp -rf docs/build/html/* "${RUNNER_DOCS_DIR}" |
| 100 | + mv docs/build/html /artifacts/ |
| 101 | +
|
| 102 | + commit-main: |
| 103 | + if: github.ref_name == 'main' |
| 104 | + permissions: |
| 105 | + # Required for `git push` |
| 106 | + # Note: |
| 107 | + # This is not effective from fork. |
| 108 | + # When you debug this, make sure to make a branch on pytorch and |
| 109 | + # make PR from there. |
| 110 | + contents: write |
| 111 | + runs-on: ubuntu-latest |
| 112 | + needs: build |
| 113 | + steps: |
| 114 | + - uses: actions/checkout@v3 |
| 115 | + with: |
| 116 | + ref: gh-pages |
| 117 | + fetch-depth: 5 |
| 118 | + - uses: actions/download-artifact@v3 |
| 119 | + with: |
| 120 | + name: docs |
| 121 | + - name: Update main doc |
| 122 | + run: | |
| 123 | + set -x |
| 124 | +
|
| 125 | + git config user.name "pytorchbot" |
| 126 | + git config user.email "[email protected]" |
| 127 | + # When `git clone`, `gh-pages` branch is fetched by default. |
| 128 | + # The size of gh-pages grows significantly, so we use ammend and force push |
| 129 | + # We add a new commit once a week |
| 130 | + if [ "$(date +%d)" = "1" ]; then |
| 131 | + git commit --allow-empty -m "placeholder" |
| 132 | + fi |
| 133 | +
|
| 134 | + # TODO: add tag-based process (need to handle the main directory name) |
| 135 | + # Update the main doc |
| 136 | + rm -rf main |
| 137 | + mv html main |
| 138 | + git add --all main || true |
| 139 | +
|
| 140 | + git commit --amend -m "auto-generating sphinx docs" || true |
| 141 | + git push -f |
| 142 | +
|
| 143 | + # Push for release |
| 144 | + # Make sure that version.txt is updated first (alpha suffix is removed) |
| 145 | + commit-release: |
| 146 | + if: startsWith(github.ref_name, 'release/') && ( github.event_name == 'workflow_dispatch' ) |
| 147 | + permissions: |
| 148 | + # Required for `git push` |
| 149 | + # Note: |
| 150 | + # This is not effective from fork. |
| 151 | + # When you debug this, make sure to make a branch on pytorch and |
| 152 | + # make PR from there. |
| 153 | + contents: write |
| 154 | + runs-on: ubuntu-latest |
| 155 | + needs: build |
| 156 | + steps: |
| 157 | + - uses: actions/checkout@v3 |
| 158 | + with: |
| 159 | + ref: gh-pages |
| 160 | + fetch-depth: 5 |
| 161 | + - uses: actions/checkout@v4 |
| 162 | + with: |
| 163 | + path: _src |
| 164 | + - uses: actions/download-artifact@v3 |
| 165 | + with: |
| 166 | + name: docs |
| 167 | + - name: Update doc |
| 168 | + run: | |
| 169 | + set -x |
| 170 | +
|
| 171 | + git config user.name "pytorchbot" |
| 172 | + git config user.email "[email protected]" |
| 173 | + # When `git clone`, `gh-pages` branch is fetched by default. |
| 174 | + # The size of gh-pages grows significantly, so we use ammend and force push |
| 175 | + # We add a new commit once a week |
| 176 | + if [ "$(date +%d)" = "1" ]; then |
| 177 | + git commit --allow-empty -m "placeholder" |
| 178 | + fi |
| 179 | +
|
| 180 | + dirname="$(cat _src/version.txt)" |
| 181 | + rm -rf "${dirname}" |
| 182 | + mv html "${dirname}" |
| 183 | + git add --all "${dirname}" || true |
| 184 | +
|
| 185 | + git commit --amend -m "auto-generating sphinx docs" || true |
| 186 | + git push -f |
0 commit comments