Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.

Commit d6249f8

Browse files
Merge branch 'master' into sp-binding2
2 parents 5b8f220 + 9562f80 commit d6249f8

File tree

4 files changed

+199
-0
lines changed

4 files changed

+199
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env bash
2+
3+
set -ex
4+
5+
6+
if [ "$2" == "" ]; then
7+
echo call as "$0" "<src>" "<target branch>"
8+
echo where src is the root of the built documentation git checkout and
9+
echo branch should be "master" or "1.7" or so
10+
exit 1
11+
fi
12+
13+
src=$1
14+
target=$2
15+
16+
echo "committing docs from ${src} to ${target}"
17+
18+
pushd $src
19+
git checkout gh-pages
20+
git pull
21+
mkdir -p ./"${target}"
22+
rm -rf ./"${target}"/*
23+
cp -r "${src}/docs/build/html/"* ./"$target"
24+
if [ "${target}" == "master" ]; then
25+
mkdir -p ./_static
26+
rm -rf ./_static/*
27+
cp -r "${src}/docs/build/html/_static/"* ./_static
28+
git add --all ./_static || true
29+
fi
30+
git add --all ./"${target}" || true
31+
git config user.email "[email protected]"
32+
git config user.name "pytorchbot"
33+
# If there aren't changes, don't make a commit; push is no-op
34+
git commit -m "auto-generating sphinx docs" || true
35+
git remote add https https://github.com/pytorch/audio.git
36+
git push -u https gh-pages

.circleci/config.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,63 @@ jobs:
467467
- run:
468468
name: Run style check
469469
command: .circleci/unittest/linux/scripts/run_style_checks.sh
470+
build_docs:
471+
<<: *binary_common
472+
docker:
473+
- image: continuumio/miniconda3
474+
resource_class: medium
475+
steps:
476+
- attach_workspace:
477+
at: ~/workspace
478+
- designate_upload_channel
479+
- checkout
480+
- run:
481+
name: install binaries
482+
command: |
483+
set -x
484+
conda install make
485+
pip install $(ls ~/workspace/torchtext*.whl) --pre -f "https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/cpu/torch_${UPLOAD_CHANNEL}.html"
486+
- run:
487+
name: Build docs
488+
command: |
489+
set -x
490+
pushd docs
491+
pip install -r requirements.txt
492+
make html
493+
popd
494+
- persist_to_workspace:
495+
root: ./
496+
paths:
497+
- "*"
498+
499+
upload_docs:
500+
<<: *binary_common
501+
docker:
502+
- image: continuumio/miniconda3
503+
resource_class: medium
504+
steps:
505+
- attach_workspace:
506+
at: ~/workspace
507+
- run:
508+
name: Generate netrc
509+
command: |
510+
# set credentials for https pushing
511+
# requires the org-member context
512+
cat > ~/.netrc \<<DONE
513+
machine github.com
514+
login pytorchbot
515+
password ${GITHUB_PYTORCHBOT_TOKEN}
516+
DONE
517+
- run:
518+
name: Upload docs
519+
command: |
520+
# Don't use "checkout" step since it uses ssh, which cannot git push
521+
# https://circleci.com/docs/2.0/configuration-reference/#checkout
522+
set -ex
523+
tag=${CIRCLE_TAG:1:5}
524+
target=${tag:-master}
525+
~/workspace/.circleci/build_docs/commit_docs.sh ~/workspace $target
526+
470527
471528
workflows:
472529
build:
@@ -526,6 +583,22 @@ workflows:
526583
- binary_windows_conda:
527584
name: binary_windows_conda_py3.8
528585
python_version: '3.8'
586+
- build_docs:
587+
name: build_docs
588+
python_version: '3.8'
589+
requires:
590+
- binary_linux_wheel_py3.8
591+
- upload_docs:
592+
context: org-member
593+
filters:
594+
branches:
595+
only: nightly
596+
tags:
597+
only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/
598+
name: upload_docs
599+
python_version: '3.8'
600+
requires:
601+
- build_docs
529602
unittest:
530603
jobs:
531604
- unittest_linux:

.circleci/config.yml.in

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,63 @@ jobs:
467467
- run:
468468
name: Run style check
469469
command: .circleci/unittest/linux/scripts/run_style_checks.sh
470+
build_docs:
471+
<<: *binary_common
472+
docker:
473+
- image: continuumio/miniconda3
474+
resource_class: medium
475+
steps:
476+
- attach_workspace:
477+
at: ~/workspace
478+
- designate_upload_channel
479+
- checkout
480+
- run:
481+
name: install binaries
482+
command: |
483+
set -x
484+
conda install make
485+
pip install $(ls ~/workspace/torchtext*.whl) --pre -f "https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/cpu/torch_${UPLOAD_CHANNEL}.html"
486+
- run:
487+
name: Build docs
488+
command: |
489+
set -x
490+
pushd docs
491+
pip install -r requirements.txt
492+
make html
493+
popd
494+
- persist_to_workspace:
495+
root: ./
496+
paths:
497+
- "*"
498+
499+
upload_docs:
500+
<<: *binary_common
501+
docker:
502+
- image: continuumio/miniconda3
503+
resource_class: medium
504+
steps:
505+
- attach_workspace:
506+
at: ~/workspace
507+
- run:
508+
name: Generate netrc
509+
command: |
510+
# set credentials for https pushing
511+
# requires the org-member context
512+
cat > ~/.netrc \<<DONE
513+
machine github.com
514+
login pytorchbot
515+
password ${GITHUB_PYTORCHBOT_TOKEN}
516+
DONE
517+
- run:
518+
name: Upload docs
519+
command: |
520+
# Don't use "checkout" step since it uses ssh, which cannot git push
521+
# https://circleci.com/docs/2.0/configuration-reference/#checkout
522+
set -ex
523+
tag=${CIRCLE_TAG:1:5}
524+
target=${tag:-master}
525+
~/workspace/.circleci/build_docs/commit_docs.sh ~/workspace $target
526+
470527

471528
workflows:
472529
build:

.circleci/regenerate.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,21 @@
2121

2222
PYTHON_VERSIONS = ["3.6", "3.7", "3.8"]
2323

24+
DOC_VERSION = ('linux', '3.8')
25+
2426

2527
def build_workflows(prefix='', upload=False, filter_branch=None, indentation=6):
2628
w = []
2729
for btype in ["wheel", "conda"]:
2830
for os_type in ["linux", "macos", "windows"]:
2931
for python_version in PYTHON_VERSIONS:
3032
w += build_workflow_pair(btype, os_type, python_version, filter_branch, prefix, upload)
33+
34+
if not filter_branch:
35+
# Build on every pull request, but upload only on nightly and tags
36+
w += build_doc_job(None)
37+
w += upload_doc_job('nightly')
38+
3139
return indent(indentation, w)
3240

3341

@@ -44,6 +52,31 @@ def build_workflow_pair(btype, os_type, python_version, filter_branch, prefix=''
4452
return w
4553

4654

55+
def build_doc_job(filter_branch):
56+
job = {
57+
"name": "build_docs",
58+
"python_version": "3.8",
59+
"requires": ["binary_linux_wheel_py3.8", ],
60+
}
61+
62+
if filter_branch:
63+
job["filters"] = gen_filter_branch_tree(filter_branch)
64+
return [{"build_docs": job}]
65+
66+
67+
def upload_doc_job(filter_branch):
68+
job = {
69+
"name": "upload_docs",
70+
"context": "org-member",
71+
"python_version": "3.8",
72+
"requires": ["build_docs", ],
73+
}
74+
75+
if filter_branch:
76+
job["filters"] = gen_filter_branch_tree(filter_branch)
77+
return [{"upload_docs": job}]
78+
79+
4780
def generate_base_workflow(base_workflow_name, python_version, filter_branch, os_type, btype):
4881
d = {
4982
"name": base_workflow_name,

0 commit comments

Comments
 (0)