Skip to content

Commit 32fe426

Browse files
NicolasHugfacebook-github-bot
authored andcommitted
[fbsync] Migrate docs workflow to GHA (#7407)
Summary: Co-authored-by: Nikita Shulga <[email protected]> Reviewed By: vmoens Differential Revision: D44416559 fbshipit-source-id: 48db0e9e718954b3c0313df2cf3214d178d3fa5c
1 parent c3cc9ac commit 32fe426

File tree

4 files changed

+69
-217
lines changed

4 files changed

+69
-217
lines changed

.circleci/config.yml

Lines changed: 0 additions & 112 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.circleci/config.yml.in

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -869,73 +869,6 @@ jobs:
869869
conda activate python39
870870
packaging/build_cmake.sh
871871

872-
build_docs:
873-
<<: *binary_common
874-
docker:
875-
- image: cimg/python:3.8
876-
resource_class: 2xlarge+
877-
steps:
878-
- attach_workspace:
879-
at: ~/workspace
880-
- checkout
881-
- download_model_weights
882-
- run:
883-
name: Setup
884-
command: .circleci/unittest/linux/scripts/setup_env.sh
885-
- designate_upload_channel
886-
- run:
887-
name: Install torchvision
888-
command: .circleci/unittest/linux/scripts/install.sh
889-
- run:
890-
name: Build docs
891-
command: |
892-
set -ex
893-
# turn v1.12.0rc3 into 1.12.0
894-
tag=$(echo $CIRCLE_TAG | sed -e 's/v*\([0-9.]*\).*/\1/')
895-
VERSION=${tag:-main}
896-
eval "$(./conda/bin/conda shell.bash hook)"
897-
conda activate ./env
898-
pushd docs
899-
pip install --progress-bar=off -r requirements.txt
900-
make html
901-
popd
902-
- persist_to_workspace:
903-
root: ./
904-
paths:
905-
- "*"
906-
- store_artifacts:
907-
path: ./docs/build/html
908-
destination: docs
909-
910-
upload_docs:
911-
<<: *binary_common
912-
docker:
913-
- image: "pytorch/manylinux-cuda100"
914-
resource_class: 2xlarge+
915-
steps:
916-
- attach_workspace:
917-
at: ~/workspace
918-
- run:
919-
name: Generate netrc
920-
command: |
921-
# set credentials for https pushing
922-
# requires the org-member context
923-
cat > ~/.netrc \<<DONE
924-
machine github.com
925-
login pytorchbot
926-
password ${GITHUB_PYTORCHBOT_TOKEN}
927-
DONE
928-
- run:
929-
name: Upload docs
930-
command: |
931-
# Don't use "checkout" step since it uses ssh, which cannot git push
932-
# https://circleci.com/docs/2.0/configuration-reference/#checkout
933-
set -ex
934-
# Change v1.12.1rc1 into 1.12 (only major.minor)
935-
tag=$(echo $CIRCLE_TAG | sed -e 's/v*\([0-9]*\.[0-9]*\).*/\1/')
936-
target=${tag:-main}
937-
~/workspace/.circleci/build_docs/commit_docs.sh ~/workspace $target
938-
939872

940873
workflows:
941874
lint:

.circleci/regenerate.py

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,8 @@ def build_workflows(prefix="", filter_branch=None, upload=False, indentation=6,
6161
fb = "/.*/"
6262

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

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

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

8981

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

116108

117-
def build_doc_job(filter_branch):
118-
job = {
119-
"name": "build_docs",
120-
"python_version": "3.8",
121-
"requires": [
122-
"binary_linux_wheel_py3.8_cpu",
123-
],
124-
}
125-
126-
if filter_branch:
127-
job["filters"] = gen_filter_branch_tree(filter_branch, tags_list=RC_PATTERN)
128-
return [{"build_docs": job}]
129-
130-
131-
def upload_doc_job(filter_branch):
132-
job = {
133-
"name": "upload_docs",
134-
"context": "org-member",
135-
"python_version": "3.8",
136-
"requires": [
137-
"build_docs",
138-
],
139-
}
140-
141-
if filter_branch:
142-
job["filters"] = gen_filter_branch_tree(filter_branch, tags_list=RC_PATTERN)
143-
return [{"upload_docs": job}]
144-
145-
146109
manylinux_images = {
147110
"cu117": "pytorch/manylinux-cuda117",
148111
"cu118": "pytorch/manylinux-cuda118",

.github/workflows/docs.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Docs
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- nightly
8+
- main
9+
- release/*
10+
workflow_dispatch:
11+
12+
jobs:
13+
build:
14+
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
15+
with:
16+
repository: pytorch/vision
17+
upload-artifact: docs
18+
script: |
19+
set -euo pipefail
20+
21+
export PYTHON_VERSION=3.8
22+
export GPU_ARCH_TYPE=cpu
23+
export GPU_ARCH_VERSION=''
24+
./.github/scripts/setup-env.sh
25+
26+
# Prepare conda
27+
CONDA_PATH=$(which conda)
28+
eval "$(${CONDA_PATH} shell.bash hook)"
29+
conda activate ci
30+
# FIXME: not sure why we need this. `ldd torchvision/video_reader.so` shows that it
31+
# already links against the one pulled from conda. However, at runtime it pulls from
32+
# /lib64
33+
# Should we maybe always do this in `./.github/scripts/setup-env.sh` so that we don't
34+
# have to pay attention in all other workflows?
35+
export LD_LIBRARY_PATH="${CONDA_PREFIX}/lib:${LD_LIBRARY_PATH}"
36+
37+
cd docs
38+
39+
echo '::group::Install doc requirements'
40+
pip install --progress-bar=off -r requirements.txt
41+
echo '::endgroup::'
42+
43+
echo '::group::Build HTML docs'
44+
# The runner does not have sufficient memory to run with as many processes as their are
45+
# cores (`-j auto`). Thus, we limit to a single process (`-j 1`) here.
46+
sed -i -e 's/-j auto/-j 1/' Makefile
47+
make html
48+
echo '::endgroup::'
49+
50+
mv build/html "${RUNNER_ARTIFACT_DIR}"
51+
52+
upload-preview:
53+
if: github.event_name == 'pull_request'
54+
needs: [build]
55+
runs-on: [self-hosted, linux.2xlarge]
56+
steps:
57+
- uses: actions/download-artifact@v3
58+
with:
59+
name: docs
60+
61+
- name: Upload docs preview
62+
uses: seemethere/upload-artifact-s3@v5
63+
with:
64+
retention-days: 14
65+
s3-bucket: doc-previews
66+
if-no-files-found: error
67+
path: html
68+
s3-prefix: pytorch/vision/${{ github.event.pull_request.number }}

0 commit comments

Comments
 (0)