From 5b5f4100cd6dd9f1133d3a44d0e17789b56a7d47 Mon Sep 17 00:00:00 2001 From: Jirka Borovec <6035284+Borda@users.noreply.github.com> Date: Mon, 20 Mar 2023 17:24:06 +0100 Subject: [PATCH] docs: build docs for specific tags (#17055) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Adrian Wälchli --- .github/workflows/docs-build.yml | 2 +- .gitignore | 2 + docs/generate_docs_for_tags.sh | 59 +++++++++++++++++++++++++++ docs/source-pytorch/past_versions.rst | 45 ++++++++++---------- 4 files changed, 85 insertions(+), 23 deletions(-) create mode 100644 docs/generate_docs_for_tags.sh diff --git a/.github/workflows/docs-build.yml b/.github/workflows/docs-build.yml index d1cd725943..a86f091f0b 100644 --- a/.github/workflows/docs-build.yml +++ b/.github/workflows/docs-build.yml @@ -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 }} diff --git a/.gitignore b/.gitignore index bc108553a9..375d77d5ef 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,8 @@ lightning_logs/ .vscode/ # Documentations +docs/venv*/ +docs/build*/ docs/source-app/generated docs/source-app/*/generated docs/source-pytorch/api diff --git a/docs/generate_docs_for_tags.sh b/docs/generate_docs_for_tags.sh new file mode 100644 index 0000000000..a354421e19 --- /dev/null +++ b/docs/generate_docs_for_tags.sh @@ -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 diff --git a/docs/source-pytorch/past_versions.rst b/docs/source-pytorch/past_versions.rst index 416ef5411c..45183c0344 100644 --- a/docs/source-pytorch/past_versions.rst +++ b/docs/source-pytorch/past_versions.rst @@ -15,34 +15,35 @@ TO help you with keeping up to spead, check :doc:`Migration guide <./upgrade/mig - Upgrade guide * - `1.9 `_ - - `Stability and additional improvements `_ - - `1.9.0 `_, - `1.9.1 `_, - `1.9.2 `_, - `1.9.3 `_ + - `Stability and additional improvements `_ + - `1.9.0 `_, + `1.9.1 `_, + `1.9.2 `_, + `1.9.3 `_, + `1.9.4 `_ - :doc:`from 1.9 to 2.0 ` * - `1.8 `_ - - `Colossal-AI Strategy, Commands and Secrets for Apps, FSDP Improvements and More! `_ - - `1.8.0 `_, - `1.8.1 `_, - `1.8.2 `_, - `1.8.3 `_, - `1.8.4 `_, - `1.8.5 `_, - `1.8.6 `_ + - `Colossal-AI Strategy, Commands and Secrets for Apps, FSDP Improvements and More! `_ + - `1.8.0 `_, + `1.8.1 `_, + `1.8.2 `_, + `1.8.3 `_, + `1.8.4 `_, + `1.8.5 `_, + `1.8.6 `_ - :doc:`from 1.8 to 2.0 ` * - `1.7 `_ - - `Apple Silicon support, Native FSDP, Collaborative training, and multi-GPU support with Jupyter notebooks `_ - - `1.7.0 `_, - `1.7.1 `_, - `1.7.2 `_, - `1.7.3 `_, - `1.7.4 `_, - `1.7.5 `_, - `1.7.6 `_, - `1.7.7 `_ + - `Apple Silicon support, Native FSDP, Collaborative training, and multi-GPU support with Jupyter notebooks `_ + - `1.7.0 `_, + `1.7.1 `_, + `1.7.2 `_, + `1.7.3 `_, + `1.7.4 `_, + `1.7.5 `_, + `1.7.6 `_, + `1.7.7 `_ - :doc:`from 1.7 to 2.0 ` * - `1.6 `_