Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PoC] migrate docs workflow to GHA #7407

Merged
merged 13 commits into from
Mar 15, 2023
Merged
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
68 changes: 68 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Docs

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

jobs:
build:
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
with:
repository: pytorch/vision
upload-artifact: docs
script: |
set -euo pipefail
export PYTHON_VERSION=3.8
export GPU_ARCH_TYPE=cpu
export GPU_ARCH_VERSION=''
./.github/scripts/setup-env.sh
# Prepare conda
CONDA_PATH=$(which conda)
eval "$(${CONDA_PATH} shell.bash hook)"
conda activate ci
# FIXME: not sure why we need this. `ldd torchvision/video_reader.so` shows that it
# already links against the one pulled from conda. However, at runtime it pulls from
# /lib64
# Should we maybe always do this in `./.github/scripts/setup-env.sh` so that we don't
# have to pay attention in all other workflows?
export LD_LIBRARY_PATH="${CONDA_PREFIX}/lib:${LD_LIBRARY_PATH}"
cd docs
echo '::group::Install doc requirements'
pip install --progress-bar=off -r requirements.txt
echo '::endgroup::'
echo '::group::Build HTML docs'
# The runner does not have sufficient memory to run with as many processes as their are
# cores (`-j auto`). Thus, we limit to a single process (`-j 1`) here.
sed -i -e 's/-j auto/-j 1/' Makefile
make html
echo '::endgroup::'
mv build/html "${RUNNER_ARTIFACT_DIR}"
upload-preview:
if: github.event_name == 'pull_request'
needs: [build]
runs-on: [self-hosted, linux.2xlarge]
steps:
- uses: actions/download-artifact@v3
with:
name: docs

- name: Upload docs preview
uses: seemethere/upload-artifact-s3@v5
with:
retention-days: 14
s3-bucket: doc-previews
if-no-files-found: error
path: html
s3-prefix: pytorch/vision/${{ github.event.pull_request.number }}