Skip to content

Commit

Permalink
[PoC] migrate docs workflow to GHA
Browse files Browse the repository at this point in the history
  • Loading branch information
pmeier committed Mar 10, 2023
1 parent 82cf540 commit 26cf7d8
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 217 deletions.
112 changes: 0 additions & 112 deletions .circleci/config.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

67 changes: 0 additions & 67 deletions .circleci/config.yml.in
Original file line number Diff line number Diff line change
Expand Up @@ -869,73 +869,6 @@ jobs:
conda activate python39
packaging/build_cmake.sh

build_docs:
<<: *binary_common
docker:
- image: cimg/python:3.8
resource_class: 2xlarge+
steps:
- attach_workspace:
at: ~/workspace
- checkout
- download_model_weights
- run:
name: Setup
command: .circleci/unittest/linux/scripts/setup_env.sh
- designate_upload_channel
- run:
name: Install torchvision
command: .circleci/unittest/linux/scripts/install.sh
- run:
name: Build docs
command: |
set -ex
# turn v1.12.0rc3 into 1.12.0
tag=$(echo $CIRCLE_TAG | sed -e 's/v*\([0-9.]*\).*/\1/')
VERSION=${tag:-main}
eval "$(./conda/bin/conda shell.bash hook)"
conda activate ./env
pushd docs
pip install --progress-bar=off -r requirements.txt
make html
popd
- persist_to_workspace:
root: ./
paths:
- "*"
- store_artifacts:
path: ./docs/build/html
destination: docs

upload_docs:
<<: *binary_common
docker:
- image: "pytorch/manylinux-cuda100"
resource_class: 2xlarge+
steps:
- attach_workspace:
at: ~/workspace
- run:
name: Generate netrc
command: |
# set credentials for https pushing
# requires the org-member context
cat > ~/.netrc \<<DONE
machine github.com
login pytorchbot
password ${GITHUB_PYTORCHBOT_TOKEN}
DONE
- run:
name: Upload docs
command: |
# Don't use "checkout" step since it uses ssh, which cannot git push
# https://circleci.com/docs/2.0/configuration-reference/#checkout
set -ex
# Change v1.12.1rc1 into 1.12 (only major.minor)
tag=$(echo $CIRCLE_TAG | sed -e 's/v*\([0-9]*\.[0-9]*\).*/\1/')
target=${tag:-main}
~/workspace/.circleci/build_docs/commit_docs.sh ~/workspace $target


workflows:
lint:
Expand Down
39 changes: 1 addition & 38 deletions .circleci/regenerate.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,8 @@ def build_workflows(prefix="", filter_branch=None, upload=False, indentation=6,
fb = "/.*/"

# Disable all Linux Wheels Workflows from CircleCI
# since those will now be done through Nova. We'll keep
# around the py3.8 CPU Linux Wheels build since the docs
# job depends on it.
if os_type == "linux" and btype == "wheel":
if not (python_version == "3.8" and cu_version == "cpu"):
continue
continue

# Disable all Macos Wheels Workflows from CircleCI.
if os_type == "macos" and btype == "wheel":
Expand All @@ -80,10 +76,6 @@ def build_workflows(prefix="", filter_branch=None, upload=False, indentation=6,
btype, os_type, python_version, cu_version, unicode, prefix, upload, filter_branch=fb
)

if not filter_branch:
# Build on every pull request, but upload only on nightly and tags
w += build_doc_job("/.*/")
w += upload_doc_job("nightly")
return indent(indentation, w)


Expand Down Expand Up @@ -114,35 +106,6 @@ def workflow_pair(btype, os_type, python_version, cu_version, unicode, prefix=""
return w


def build_doc_job(filter_branch):
job = {
"name": "build_docs",
"python_version": "3.8",
"requires": [
"binary_linux_wheel_py3.8_cpu",
],
}

if filter_branch:
job["filters"] = gen_filter_branch_tree(filter_branch, tags_list=RC_PATTERN)
return [{"build_docs": job}]


def upload_doc_job(filter_branch):
job = {
"name": "upload_docs",
"context": "org-member",
"python_version": "3.8",
"requires": [
"build_docs",
],
}

if filter_branch:
job["filters"] = gen_filter_branch_tree(filter_branch, tags_list=RC_PATTERN)
return [{"upload_docs": job}]


manylinux_images = {
"cu117": "pytorch/manylinux-cuda117",
"cu118": "pytorch/manylinux-cuda118",
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: docs

on:
pull_request:
push:
branches:
- nightly
- main
- release/*
workflow_dispatch:

jobs:
build:
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
id: build
with:
repository: pytorch/vision
upload-artifact: docs
script: |
set -euo pipefail
export PYTHON_VERSION=3.8
export GPU_ARCH_TYPE=cpu
./.github/scripts/setup-env.sh
# Prepare conda
CONDA_PATH=$(which conda)
eval "$(${CONDA_PATH} shell.bash hook)"
conda activate ci
cd docs
echo '::group::Install doc requirements'
pip install --progress-bar=off -r requirements.txt
echo '::endgroup::'
echo '::group::Build HTML docs'
make html
echo '::endgroup::'
mv build/html "${RUNNER_ARTIFACT_DIR}"

0 comments on commit 26cf7d8

Please sign in to comment.