Repository navigation
127 lines (119 loc) · 4.11 KB
/
Copy pathdocs.yaml
File metadata and controls
127 lines (119 loc) · 4.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
name: Docs
on:
push:
branches:
- main
pull_request:
jobs:
build-docs:
if: github.repository_owner == 'meta-pytorch'
name: Build Documentation
runs-on: linux.12xlarge
container:
image: nvidia/cuda:13.2.1-cudnn-devel-ubuntu24.04
timeout-minutes: 30
steps:
- name: Setup git
shell: bash -l {0}
run: |
set -eux
apt-get update
apt-get install -y git
# git doesn't like mixed ownership, override it
chown -R root:root .
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup conda env
uses: conda-incubator/setup-miniconda@8ee1f361103df19b6f8c8655fd3967a8ecb162d5 # v4
with:
miniconda-version: "latest"
activate-environment: test
python-version: '3.14'
auto-activate: false
- name: Verify conda environment
shell: bash -l {0}
run: |
conda info
which python
which conda
- name: Update pip
shell: bash -l {0}
run: python -m pip install --upgrade pip
- name: Install pytorch
shell: bash -l {0}
run: pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu128
- name: Install Dependencies
shell: bash -l {0}
run: |
set -eux
conda install -y git
conda install -y -c conda-forge glog==0.4.0 gflags==2.2.2 fmt==12.2.0
pip install cmake==3.31.6
pip install -r docs/requirements.txt
export USE_NCCL=0
export USE_NCCLX=0
export USE_TRANSPORT=0
export USE_SYSTEM_LIBS=1
pip install --no-build-isolation .[dev] -v
- name: Build Sphinx Docs
shell: bash -l {0}
working-directory: docs
run: |
set -eux
conda activate test
make html SPHINXOPTS="-WT --keep-going"
- name: Remove noindex meta tag from docs
working-directory: docs/build/html
run: |
# Remove the noindex meta tag from all HTML files
# This allows search engines to index the documentation
find . -name "*.html" -type f -exec sed -i '/<meta name="robots" content="noindex">/d' {} \;
- name: Upload static files as artifact
id: deployment
uses: actions/upload-artifact@v4
with:
name: docs
path: docs/build/html/
upload:
runs-on: linux.12xlarge
permissions:
# Grant write permission here so that the doc can be pushed to gh-pages branch
contents: write
needs: build-docs
if: github.repository == 'meta-pytorch/torchcomms' && github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch')
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: gh-pages
persist-credentials: true
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: docs
path: docs
- name: Move and commit changes
run: |
set -euo pipefail
# Get github.ref for the output doc folder. By default "main"
# If matches a tag like refs/tags/v1.12.0-rc3 or
# refs/tags/v1.12.0 convert to 1.12
GITHUB_REF=${{ github.ref }}
# Convert refs/tags/v1.12.0rc3 into 1.12.
# Adopted from https://github.com/pytorch/pytorch/blob/main/.github/workflows/_docs.yml#L150C11-L155C13
if [[ "${GITHUB_REF}" =~ ^refs/tags/v([0-9]+\.[0-9]+)\.* ]]; then
TARGET_FOLDER="${BASH_REMATCH[1]}"
else
TARGET_FOLDER="main"
fi
echo "Target Folder: ${TARGET_FOLDER}"
mkdir -p "${TARGET_FOLDER}"
rm -rf "${TARGET_FOLDER}"/*
mv docs/* "${TARGET_FOLDER}"
git config user.name 'pytorchbot'
git config user.email 'soumith+bot@pytorch.org'
git add "${TARGET_FOLDER}" || true
git commit -m "auto-generating sphinx docs" || true
git push -f