Skip to content

Commit

Permalink
docs: build docs for specific tags (Lightning-AI#17055)
Browse files Browse the repository at this point in the history
Co-authored-by: Adrian Wälchli <[email protected]>
  • Loading branch information
Borda and awaelchli authored Mar 20, 2023
1 parent 7e08ba1 commit 5b5f410
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,4 @@ jobs:
# Uploading docs to GCS, so they can be served on lightning.ai
- name: Upload docs/${{ matrix.pkg-name }}/release to GCS 🪣
if: startsWith(github.ref, 'refs/tags/')
run: gsutil -m rsync -d -R docs/build/html/ gs://lightning-docs-${{ matrix.pkg-name }}/${{ github.ref_name }}"
run: gsutil -m rsync -d -R docs/build/html/ gs://lightning-docs-${{ matrix.pkg-name }}/${{ github.ref_name }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ lightning_logs/
.vscode/

# Documentations
docs/venv*/
docs/build*/
docs/source-app/generated
docs/source-app/*/generated
docs/source-pytorch/api
Expand Down
59 changes: 59 additions & 0 deletions docs/generate_docs_for_tags.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash
# Usage:
# 1. Generate docs with one or more specified versions:
# $ export PACKAGE_NAME=app
# $ bash docs/generate_docs_for_tags.sh 1.9.3 1.9.2 1.9.1 1.9.0
# OR
# $ PACKAGE_NAME=pytorch bash docs/generate_docs_for_tags.sh 1.8.6 1.8.5 1.8.4 1.8.3 1.8.2 1.8.1 1.8.0
set -e

PATH_ROOT=~/Desktop/builds
PATH_ENV=$PATH_ROOT/venv-docs-$PACKAGE_NAME
# export PACKAGE_NAME=app
export FREEZE_REQUIREMENTS=1

echo PATH_ROOT: $PATH_ROOT
echo PATH_ENV: $PATH_ENV
echo PYTHONPATH: $PYTHONPATH

function build_docs {
python --version
pip --version

pip install -q setuptools wheel python-multipart
pip install -e . -q -r requirements/$PACKAGE_NAME/docs.txt \
-f ../pypi -f https://download.pytorch.org/whl/cpu/torch_stable.html
pip list

cd docs/source-$PACKAGE_NAME
make html --jobs=$(nproc)
# make html SPHINXOPTS="-W --keep-going" --jobs=$(nproc)
cd ../..

mkdir -p $PATH_ROOT/docs-${PACKAGE_NAME}
mv docs/build/html $PATH_ROOT/docs-${PACKAGE_NAME}/$tag
}

# iterate over all arguments assuming that each argument is version
for tag in "$@"
do
echo processing version: $tag

# Don't install/update anything before activating venv
# to avoid breaking any existing environment.
python -m venv $PATH_ENV
source $PATH_ENV/bin/activate

cd $PATH_ROOT
git clone --single-branch --branch $tag --depth 1 --recurse-submodules \
https://github.com/Lightning-AI/lightning.git
cd lightning

build_docs > "$PATH_ROOT/building-${PACKAGE_NAME}_${tag}.log"

cd ..
rm -rf lightning

deactivate
rm -rf $PATH_ENV
done
45 changes: 23 additions & 22 deletions docs/source-pytorch/past_versions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,35 @@ TO help you with keeping up to spead, check :doc:`Migration guide <./upgrade/mig
- Upgrade guide

* - `1.9 <https://github.com/Lightning-AI/lightning/releases/tag/1.9.0>`_
- `Stability and additional improvements <https://pytorch-lightning.readthedocs.io/en/1.9.3>`_
- `1.9.0 <https://pytorch-lightning.readthedocs.io/en/1.9.0>`_,
`1.9.1 <https://pytorch-lightning.readthedocs.io/en/1.9.1>`_,
`1.9.2 <https://pytorch-lightning.readthedocs.io/en/1.9.2>`_,
`1.9.3 <https://pytorch-lightning.readthedocs.io/en/1.9.3>`_
- `Stability and additional improvements <https://lightning.ai/docs/pytorch/1.9.3>`_
- `1.9.0 <https://lightning.ai/docs/pytorch/1.9.0>`_,
`1.9.1 <https://lightning.ai/docs/pytorch/1.9.1>`_,
`1.9.2 <https://lightning.ai/docs/pytorch/1.9.2>`_,
`1.9.3 <https://lightning.ai/docs/pytorch/1.9.3>`_,
`1.9.4 <https://lightning.ai/docs/pytorch/1.9.4>`_
- :doc:`from 1.9 to 2.0 <upgrade/from_1_9>`

* - `1.8 <https://github.com/Lightning-AI/lightning/releases/tag/1.8.0>`_
- `Colossal-AI Strategy, Commands and Secrets for Apps, FSDP Improvements and More! <https://pytorch-lightning.readthedocs.io/en/1.8.6>`_
- `1.8.0 <https://pytorch-lightning.readthedocs.io/en/1.8.0>`_,
`1.8.1 <https://pytorch-lightning.readthedocs.io/en/1.8.1>`_,
`1.8.2 <https://pytorch-lightning.readthedocs.io/en/1.8.2>`_,
`1.8.3 <https://pytorch-lightning.readthedocs.io/en/1.8.3>`_,
`1.8.4 <https://pytorch-lightning.readthedocs.io/en/1.8.4>`_,
`1.8.5 <https://pytorch-lightning.readthedocs.io/en/1.8.5>`_,
`1.8.6 <https://pytorch-lightning.readthedocs.io/en/1.8.6>`_
- `Colossal-AI Strategy, Commands and Secrets for Apps, FSDP Improvements and More! <https://lightning.ai/docs/pytorch/1.8.6>`_
- `1.8.0 <https://lightning.ai/docs/pytorch/1.8.0>`_,
`1.8.1 <https://lightning.ai/docs/pytorch/1.8.1>`_,
`1.8.2 <https://lightning.ai/docs/pytorch/1.8.2>`_,
`1.8.3 <https://lightning.ai/docs/pytorch/1.8.3>`_,
`1.8.4 <https://lightning.ai/docs/pytorch/1.8.4>`_,
`1.8.5 <https://lightning.ai/docs/pytorch/1.8.5>`_,
`1.8.6 <https://lightning.ai/docs/pytorch/1.8.6>`_
- :doc:`from 1.8 to 2.0 <upgrade/from_1_8>`

* - `1.7 <https://github.com/Lightning-AI/lightning/releases/tag/1.7.0>`_
- `Apple Silicon support, Native FSDP, Collaborative training, and multi-GPU support with Jupyter notebooks <https://pytorch-lightning.readthedocs.io/en/1.7.7>`_
- `1.7.0 <https://pytorch-lightning.readthedocs.io/en/1.7.0>`_,
`1.7.1 <https://pytorch-lightning.readthedocs.io/en/1.7.1>`_,
`1.7.2 <https://pytorch-lightning.readthedocs.io/en/1.7.2>`_,
`1.7.3 <https://pytorch-lightning.readthedocs.io/en/1.7.3>`_,
`1.7.4 <https://pytorch-lightning.readthedocs.io/en/1.7.4>`_,
`1.7.5 <https://pytorch-lightning.readthedocs.io/en/1.7.5>`_,
`1.7.6 <https://pytorch-lightning.readthedocs.io/en/1.7.6>`_,
`1.7.7 <https://pytorch-lightning.readthedocs.io/en/1.7.7>`_
- `Apple Silicon support, Native FSDP, Collaborative training, and multi-GPU support with Jupyter notebooks <https://lightning.ai/docs/pytorch/1.7.7>`_
- `1.7.0 <https://lightning.ai/docs/pytorch/1.7.0>`_,
`1.7.1 <https://lightning.ai/docs/pytorch/1.7.1>`_,
`1.7.2 <https://lightning.ai/docs/pytorch/1.7.2>`_,
`1.7.3 <https://lightning.ai/docs/pytorch/1.7.3>`_,
`1.7.4 <https://lightning.ai/docs/pytorch/1.7.4>`_,
`1.7.5 <https://lightning.ai/docs/pytorch/1.7.5>`_,
`1.7.6 <https://lightning.ai/docs/pytorch/1.7.6>`_,
`1.7.7 <https://lightning.ai/docs/pytorch/1.7.7>`_
- :doc:`from 1.7 to 2.0 <upgrade/from_1_7>`

* - `1.6 <https://github.com/Lightning-AI/lightning/releases/tag/1.6.0>`_
Expand Down

0 comments on commit 5b5f410

Please sign in to comment.