pytorch/.github/workflows/_docs.yml
atalman 07088df37b Bumping doc build instance type (#82740)
### Description
Bumping doc build instance type since we have constant failures in nightly docs build, running out of memory
Example:
https://github.com/pytorch/pytorch/runs/7642875300?check_suite_focus=true#step:8:26330
```
waiting for workers...
/home/ec2-user/actions-runner/_work/_temp/318122b1-3455-4a6b-bcb0-32b541662a5e.sh: line 28: 12686 Killed                  docker exec -t "${container_name}" bash -c "sudo chown -R jenkins . && pip install dist/*.whl && ./.circleci/scripts/${DOCS_TYPE}_doc_push_script.sh"
Error: Process completed with exit code 137.
```

### Testing
In CI

Pull Request resolved: https://github.com/pytorch/pytorch/pull/82740
Approved by: https://github.com/kit1980, https://github.com/janeyx99, https://github.com/seemethere
2022-08-03 20:58:51 +00:00

137 lines
4.7 KiB
YAML

name: build docs
on:
workflow_call:
inputs:
build-environment:
required: true
type: string
description: Top-level label for what's being built/tested.
docker-image:
required: true
type: string
description: Docker image to run in.
push:
required: false
type: boolean
default: false
description: If set, push the docs to the docs website.
run-doxygen:
required: false
type: boolean
default: false
description: If set, will enable C++ API doc generation using doxygen / breathe / exhale.
sync-tag:
required: false
type: string
default: ""
description: |
If this is set, our linter will use this to make sure that every other
job with the same `sync-tag` is identical.
secrets:
GH_PYTORCHBOT_TOKEN:
required: false
description: Permissions for pushing to the docs site.
jobs:
build-docs:
# Don't run on forked repos.
if: github.repository_owner == 'pytorch'
runs-on: [self-hosted, linux.4xlarge]
strategy:
matrix:
docs_type: [cpp, python]
steps:
# [see note: pytorch repo ref]
- name: Checkout PyTorch
uses: pytorch/pytorch/.github/actions/checkout-pytorch@master
- name: Setup Linux
uses: ./.github/actions/setup-linux
- name: Setup SSH (Click me for login details)
uses: ./.github/actions/setup-ssh
with:
github-secret: ${{ secrets.GITHUB_TOKEN }}
- name: Pull docker image
uses: ./.github/actions/pull-docker-image
with:
docker-image: ${{ inputs.docker-image }}
- name: Download build artifacts
uses: ./.github/actions/download-build-artifacts
with:
name: ${{ inputs.build-environment }}
- name: Generate netrc (only for docs-push)
if: inputs.push
env:
GITHUB_PYTORCHBOT_TOKEN: ${{ secrets.GH_PYTORCHBOT_TOKEN }}
run: |
# set credentials for https pushing
echo "machine github.com" > "${RUNNER_TEMP}/.netrc"
echo "login pytorchbot" >> "${RUNNER_TEMP}/.netrc"
echo "password ${GITHUB_PYTORCHBOT_TOKEN}" >> "${RUNNER_TEMP}/.netrc"
- name: Build ${{ matrix.docs_type }} docs
env:
WITH_PUSH: ${{ github.event_name == 'schedule' || startsWith(github.event.ref, 'refs/tags/v') }}
DOCKER_IMAGE: ${{ inputs.docker-image }}
DOCS_TYPE: ${{ matrix.docs_type }}
RUN_DOXYGEN: ${{ inputs.run-doxygen }}
BUILD_ENVIRONMENT: ${{ inputs.build-environment }}
run: |
set -ex
# Convert refs/tags/v1.12.0rc3 into 1.12
if [[ "${GITHUB_REF}" =~ ^refs/tags/v([0-9]+\.[0-9]+)\.* ]]; then
target="${BASH_REMATCH[1]}"
else
target="master"
fi
# detached container should get cleaned up by teardown_ec2_linux
container_name=$(docker run \
-e BUILD_ENVIRONMENT \
-e MAX_JOBS="$(nproc --ignore=2)" \
-e SHA1="$GITHUB_SHA" \
-e DOCS_VERSION="${target}" \
-e DOCS_TYPE \
-e RUN_DOXYGEN \
-e WITH_PUSH \
--env-file="/tmp/github_env_${GITHUB_RUN_ID}" \
--security-opt seccomp=unconfined \
--cap-add=SYS_PTRACE \
--tty \
--detach \
--user jenkins \
-v "${RUNNER_TEMP}/.netrc":/var/lib/jenkins/.netrc \
-v "${GITHUB_WORKSPACE}:/var/lib/jenkins/workspace" \
-w /var/lib/jenkins/workspace \
"${DOCKER_IMAGE}"
)
docker exec -t "${container_name}" bash -c "sudo chown -R jenkins . && pip install dist/*.whl && ./.circleci/scripts/${DOCS_TYPE}_doc_push_script.sh"
- name: Chown workspace
uses: ./.github/actions/chown-workspace
if: always()
- name: Upload Python Docs Preview
uses: seemethere/upload-artifact-s3@v5
if: ${{ github.event_name == 'pull_request' && matrix.docs_type == 'python' }}
with:
retention-days: 14
s3-bucket: doc-previews
if-no-files-found: error
path: pytorch.github.io/docs/master/
s3-prefix: pytorch/${{ github.event.pull_request.number }}
- name: Upload C++ Docs Preview
uses: seemethere/upload-artifact-s3@v5
if: ${{ github.event_name == 'pull_request' && matrix.docs_type == 'cpp' }}
with:
retention-days: 14
if-no-files-found: error
s3-bucket: doc-previews
path: cppdocs/
s3-prefix: pytorch/${{ github.event.pull_request.number }}/cppdocs