Unverified Commit 8e078971 authored by Philip Meier's avatar Philip Meier Committed by GitHub
Browse files

Migrate docs workflow to GHA (#7407)


Co-authored-by: default avatarNikita Shulga <nikita.shulga@gmail.com>
parent 6c4ff94b
...@@ -869,73 +869,6 @@ jobs: ...@@ -869,73 +869,6 @@ jobs:
conda activate python39 conda activate python39
packaging/build_cmake.sh 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: workflows:
lint: lint:
...@@ -944,17 +877,6 @@ workflows: ...@@ -944,17 +877,6 @@ workflows:
build: build:
jobs: jobs:
- binary_linux_wheel:
conda_docker_image: pytorch/conda-builder:cpu
cu_version: cpu
filters:
branches:
only: /.*/
tags:
only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/
name: binary_linux_wheel_py3.8_cpu
python_version: '3.8'
wheel_docker_image: pytorch/manylinux-cpu
- binary_win_wheel: - binary_win_wheel:
cu_version: cpu cu_version: cpu
filters: filters:
...@@ -1151,29 +1073,6 @@ workflows: ...@@ -1151,29 +1073,6 @@ workflows:
cu_version: cu118 cu_version: cu118
name: binary_win_conda_py3.11_cu118 name: binary_win_conda_py3.11_cu118
python_version: '3.11' python_version: '3.11'
- build_docs:
filters:
branches:
only:
- /.*/
tags:
only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/
name: build_docs
python_version: '3.8'
requires:
- binary_linux_wheel_py3.8_cpu
- upload_docs:
context: org-member
filters:
branches:
only:
- nightly
tags:
only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/
name: upload_docs
python_version: '3.8'
requires:
- build_docs
- binary_ios_build: - binary_ios_build:
build_environment: binary-libtorchvision_ops-ios-12.0.0-x86_64 build_environment: binary-libtorchvision_ops-ios-12.0.0-x86_64
ios_arch: x86_64 ios_arch: x86_64
...@@ -1301,17 +1200,6 @@ workflows: ...@@ -1301,17 +1200,6 @@ workflows:
only: only:
- nightly - nightly
name: nightly_binary_libtorchvision_ops_android_upload name: nightly_binary_libtorchvision_ops_android_upload
- binary_linux_wheel:
conda_docker_image: pytorch/conda-builder:cpu
cu_version: cpu
filters:
branches:
only: nightly
tags:
only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/
name: nightly_binary_linux_wheel_py3.8_cpu
python_version: '3.8'
wheel_docker_image: pytorch/manylinux-cpu
- binary_win_wheel: - binary_win_wheel:
cu_version: cpu cu_version: cpu
filters: filters:
......
...@@ -869,73 +869,6 @@ jobs: ...@@ -869,73 +869,6 @@ jobs:
conda activate python39 conda activate python39
packaging/build_cmake.sh 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: workflows:
lint: lint:
......
...@@ -61,12 +61,8 @@ def build_workflows(prefix="", filter_branch=None, upload=False, indentation=6, ...@@ -61,12 +61,8 @@ def build_workflows(prefix="", filter_branch=None, upload=False, indentation=6,
fb = "/.*/" fb = "/.*/"
# Disable all Linux Wheels Workflows from CircleCI # 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 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. # Disable all Macos Wheels Workflows from CircleCI.
if os_type == "macos" and btype == "wheel": if os_type == "macos" and btype == "wheel":
...@@ -80,10 +76,6 @@ def build_workflows(prefix="", filter_branch=None, upload=False, indentation=6, ...@@ -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 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) return indent(indentation, w)
...@@ -114,35 +106,6 @@ def workflow_pair(btype, os_type, python_version, cu_version, unicode, prefix="" ...@@ -114,35 +106,6 @@ def workflow_pair(btype, os_type, python_version, cu_version, unicode, prefix=""
return w 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 = { manylinux_images = {
"cu117": "pytorch/manylinux-cuda117", "cu117": "pytorch/manylinux-cuda117",
"cu118": "pytorch/manylinux-cuda118", "cu118": "pytorch/manylinux-cuda118",
......
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 }}
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