Unverified Commit 8d0c08db authored by Matti Picus's avatar Matti Picus Committed by GitHub
Browse files

[Doc] Build docs and push to branch in CI (#1006)

parent 0e1d814b
#!/usr/bin/env bash
set -ex
source ./packaging/pkg_helpers.bash
export NO_CUDA_PACKAGE=1
setup_env 0.8.0
setup_wheel_python
pushd docs
pip install -r requirements.txt
make html
popd
#!/usr/bin/env bash
set -ex
if [ "$2" == "" ]; then
echo call as $0 "<src>" "<target branch>"
echo where src is the built documentation and
echo branch should be "master" or "1.7" or so
exit 1
fi
scr=$1
target=$2
set -ex
echo "committing docs from ${stc} to ${target}"
git checkout gh-pages
rm -rf docs/$target/*
cp -r ${src}/build/html/* docs/$target
if [ $target == "master" ]; then
rm -rf docs/_static/*
cp -r ${src}/build/html/_static/* docs/_static
fi
git add docs || true
git config user.email "soumith+bot@pytorch.org"
git config user.name "pytorchbot"
# If there aren't changes, don't make a commit; push is no-op
git commit -m "auto-generating sphinx docs" || true
git push -u origin gh-pages
set -ex
source ./packaging/pkg_helpers.bash
export NO_CUDA_PACKAGE=1
setup_env 0.8.0
setup_wheel_python
setup_pip_pytorch_version
# pytorch is already installed
pip install --no-deps ~/workspace/torchaudio*
......@@ -654,6 +654,46 @@ jobs:
command: |
.circleci/torchscript_bc_test/setup_master_envs.sh
.circleci/torchscript_bc_test/validate_objects.sh
build_docs:
<<: *binary_common
docker:
- image: "pytorch/manylinux-cuda100"
resource_class: 2xlarge+
steps:
- attach_workspace:
at: ~/workspace
- designate_upload_channel
- checkout
- run:
name: Install pytorch-audio
command: .circleci/build_docs/install_wheels.sh
- run:
name: Build docs
command: .circleci/build_docs/build_docs.sh
- persist_to_workspace:
root: docs
paths:
- "*"
upload_docs:
<<: *binary_common
docker:
- image: "pytorch/manylinux-cuda100"
resource_class: 2xlarge+
steps:
- attach_workspace:
at: ~/workspace
- designate_upload_channel
- checkout
- run:
name: Upload docs
command: |
set -ex
echo $PWD
ls ~/workspace
tag=${CIRCLE_TAG:1:5}
target=${tag:-master}
.circleci/build_docs/commit_docs.sh ~/workspace $target
workflows:
build:
......@@ -739,6 +779,22 @@ workflows:
- binary_windows_conda:
name: binary_windows_conda_py3.8
python_version: '3.8'
- build_docs:
name: build_docs
python_version: '3.8'
requires:
- binary_linux_wheel_py3.8
- upload_docs:
filters:
branches:
only:
- nightly
tags:
only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/
name: upload_docs
python_version: '3.8'
requires:
- build_docs
unittest:
jobs:
- torchscript_bc_test:
......
......@@ -654,6 +654,46 @@ jobs:
command: |
.circleci/torchscript_bc_test/setup_master_envs.sh
.circleci/torchscript_bc_test/validate_objects.sh
build_docs:
<<: *binary_common
docker:
- image: "pytorch/manylinux-cuda100"
resource_class: 2xlarge+
steps:
- attach_workspace:
at: ~/workspace
- designate_upload_channel
- checkout
- run:
name: Install pytorch-audio
command: .circleci/build_docs/install_wheels.sh
- run:
name: Build docs
command: .circleci/build_docs/build_docs.sh
- persist_to_workspace:
root: docs
paths:
- "*"
upload_docs:
<<: *binary_common
docker:
- image: "pytorch/manylinux-cuda100"
resource_class: 2xlarge+
steps:
- attach_workspace:
at: ~/workspace
- designate_upload_channel
- checkout
- run:
name: Upload docs
command: |
set -ex
echo $PWD
ls ~/workspace
tag=${CIRCLE_TAG:1:5}
target=${tag:-master}
.circleci/build_docs/commit_docs.sh ~/workspace $target
workflows:
build:
......
......@@ -21,6 +21,8 @@ import os.path
PYTHON_VERSIONS = ["3.6", "3.7", "3.8"]
DOC_VERSION = ('linux', '3.8')
def build_workflows(prefix='', upload=False, filter_branch=None, indentation=6):
w = []
......@@ -30,6 +32,11 @@ def build_workflows(prefix='', upload=False, filter_branch=None, indentation=6):
for python_version in PYTHON_VERSIONS:
w += build_workflow_pair(btype, os_type, python_version, filter_branch, prefix, upload)
if not filter_branch:
# Build on every pull request, but upload only on nightly and tags
w += build_doc_job(None)
w += upload_doc_job('nightly')
return indent(indentation, w)
......@@ -67,6 +74,28 @@ def build_workflow_pair(btype, os_type, python_version, filter_branch, prefix=''
return w
def build_doc_job(filter_branch):
job = {
"name": "build_docs",
"python_version": "3.8",
"requires": ["binary_linux_wheel_py3.8",],
}
if filter_branch:
job["filters"] = gen_filter_branch_tree(filter_branch)
return [{"build_docs": job}]
def upload_doc_job(filter_branch):
job = {
"name": "upload_docs",
"python_version": "3.8",
"requires": ["build_docs",],
}
if filter_branch:
job["filters"] = gen_filter_branch_tree(filter_branch)
return [{"upload_docs": job}]
def generate_base_workflow(base_workflow_name, python_version, filter_branch, os_type, btype):
......@@ -81,7 +110,7 @@ def generate_base_workflow(base_workflow_name, python_version, filter_branch, os
if filter_branch:
d["filters"] = gen_filter_branch_tree(filter_branch)
return {"binary_{os_type}_{btype}".format(os_type=os_type, btype=btype): d}
return {f"binary_{os_type}_{btype}": d}
def gen_filter_branch_tree(*branches):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment