lightning/.github/workflows/docs-build.yml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

170 lines
5.6 KiB
YAML
Raw Normal View History

2023-08-30 17:11:35 +00:00
name: Docs builds
# https://github.com/marketplace/actions/sphinx-build
on:
push:
branches: ["master", "release/*"]
tags: ["*"]
pull_request:
branches: ["master", "release/*"]
types: [opened, reopened, ready_for_review, synchronize] # added `ready_for_review` since draft is skipped
paths:
2023-06-15 15:25:59 +00:00
- ".actions/*"
2023-03-05 10:41:00 +00:00
- ".github/workflows/docs-build.yml"
- "requirements/**"
2022-11-02 21:27:25 +00:00
- "docs/**"
- "src/**"
- "setup.py"
- "pyproject.toml" # includes metadata used in the package creation
2022-11-16 10:07:02 +00:00
- "!*.md"
- "!**/*.md"
2022-02-02 19:48:15 +00:00
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
cancel-in-progress: ${{ ! (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/')) }}
defaults:
run:
shell: bash
env:
FREEZE_REQUIREMENTS: "1"
TORCH_URL: "https://download.pytorch.org/whl/cpu/torch_stable.html"
PYPI_CACHE_DIR: "_pip-wheels"
PYPI_LOCAL_DIR: "pypi_pkgs/"
jobs:
2023-08-29 08:54:51 +00:00
docs-make:
if: github.event.pull_request.draft == false
2023-08-04 20:16:24 +00:00
runs-on: ubuntu-20.04
Add `lightning_app` docs (#13656) * update * update * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * update * update * update * update * update * update * update * update * update * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * update * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * update latest docs * remove image * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * update * ci * update * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * update * update * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * update * update * update * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * update * update * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * update * update * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * update * update * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * update * update * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * update * update * make * Update .gitignore Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com> * Update .github/workflows/docs-deploy.yml Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com> * update * update * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * update * update * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * update * update * update * update * update * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * update * update * update * update * update * update * update * Update docs/source-app/_templates/theme_variables.jinja Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com> * Update docs/source-app/api_reference/api_references.rst Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com> * Update docs/source-app/api_reference/api_references.rst Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com> * Update docs/source-app/api_reference/api_references.rst Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com> * Update docs/source-app/code_samples/convert_pl_to_app/train.py Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com> * Update docs/source-app/core_api/lightning_app/communication_content.rst Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com> * Update docs/source-app/examples/model_server_app/model_server_app_content.rst Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com> * Update docs/source-app/get_started/training_with_apps.rst Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com> * Update docs/source-app/get_started/training_with_apps.rst Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com> * Update docs/source-app/get_started/training_with_apps.rst Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com> * Update docs/source-app/examples/hpo/hpo.py Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com> * Update docs/source-app/core_api/lightning_app/communication_content.rst Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com> * Update docs/source-app/core_api/lightning_app/communication_content.rst Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com> * Update docs/source-app/core_api/lightning_app/dynamic_work_content.rst Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com> * Update docs/source-app/examples/github_repo_runner/github_repo_runner_content.rst Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com> * Update docs/source-app/examples/github_repo_runner/github_repo_runner_content.rst Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com> * Update docs/source-app/examples/github_repo_runner/github_repo_runner_step_2.rst Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com> * Update docs/source-app/examples/github_repo_runner/github_repo_runner_step_4.rst Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com> * Update docs/source-app/examples/model_server_app/model_server.py Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com> * update * Update docs/source-app/core_api/lightning_app/dynamic_work_content.rst Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com> * Update docs/source-app/examples/github_repo_runner/app.py Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com> * Update docs/source-app/examples/github_repo_runner/app.py Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com> * update * update * update * update * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Jirka <jirka.borovec@seznam.cz> Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com> Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>
2022-07-15 12:45:50 +00:00
strategy:
fail-fast: false
matrix:
pkg-name: ["app", "fabric", "pytorch"]
2023-08-29 08:54:51 +00:00
check: ["html", "doctest", "linkcheck"]
steps:
- uses: actions/checkout@v3
with:
submodules: true
2023-08-04 20:16:24 +00:00
- uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Pull sphinx template
2023-07-11 13:45:53 +00:00
run: |
pip install awscli
aws s3 sync --no-sign-request s3://sphinx-packages/ ${PYPI_LOCAL_DIR}
2023-03-05 10:41:00 +00:00
- name: pip wheels cache
uses: actions/cache/restore@v3
with:
path: ${{ env.PYPI_CACHE_DIR }}
2023-03-05 10:41:00 +00:00
key: pypi_wheels
2023-08-04 20:16:24 +00:00
- name: Install pandoc & texlive
if: ${{ matrix.pkg-name == 'pytorch' }}
run: |
sudo apt-get update
sudo apt-get install -y pandoc texlive-latex-extra dvipng texlive-pictures
- name: Install package & dependencies
run: |
mkdir -p ${PYPI_CACHE_DIR} # in case cache was not hit
ls -lh ${PYPI_CACHE_DIR}
mkdir -p ${PYPI_LOCAL_DIR} # in case template is not pulled
2023-08-29 08:54:51 +00:00
pip install .[all] -U -r requirements/${{ matrix.pkg-name }}/docs.txt \
-f ${PYPI_LOCAL_DIR} -f ${PYPI_CACHE_DIR} -f ${TORCH_URL}
pip list
2023-08-29 08:54:51 +00:00
- name: Test Examples in Docs
if: ${{ matrix.check == 'doctest' }}
working-directory: ./docs/source-${{ matrix.pkg-name }}
2023-08-29 08:54:51 +00:00
env:
FAST_DOCS_DEV: 1
run: |
make doctest
make coverage
- name: Check External Links
if: ${{ matrix.check == 'linkcheck' }}
working-directory: ./docs/source-${{ matrix.pkg-name }}
2023-07-11 13:45:53 +00:00
env:
2023-08-29 08:54:51 +00:00
FAST_DOCS_DEV: 1
run: make linkcheck SPHINXOPTS="--keep-going"
- name: Make Documentation
2023-08-29 08:54:51 +00:00
if: ${{ matrix.check == 'html' }}
working-directory: ./docs/source-${{ matrix.pkg-name }}
2023-08-29 08:54:51 +00:00
env:
FAST_DOCS_DEV: 0
run: make html --debug --jobs $(nproc) SPHINXOPTS="-W --keep-going"
- name: Keep artifact
id: keep-artifact
run: python -c "print('DAYS=' + str(7 if '${{ github.event_name }}'.startswith('pull_request') else 0))" >> $GITHUB_OUTPUT
- name: Upload built docs
2023-08-29 08:54:51 +00:00
if: ${{ matrix.check == 'html' }}
uses: actions/upload-artifact@v3
with:
2022-11-02 13:00:48 +00:00
name: docs-${{ matrix.pkg-name }}-${{ github.sha }}
path: docs/build/html/
retention-days: ${{ steps.keep-artifact.outputs.DAYS }}
2023-03-05 10:41:00 +00:00
- name: Dump handy wheels
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
continue-on-error: true
uses: ./.github/actions/pip-wheels
with:
wheel-dir: ${{ env.PYPI_CACHE_DIR }}
torch-url: ${{ env.TORCH_URL }}
cache-key: "pypi_wheels"
2023-03-05 10:41:00 +00:00
deploy-docs:
2023-08-29 08:54:51 +00:00
needs: docs-make
2023-03-05 10:41:00 +00:00
if: github.repository_owner == 'Lightning-AI' && github.event_name == 'push'
2023-08-04 20:16:24 +00:00
runs-on: ubuntu-20.04
2023-03-05 10:41:00 +00:00
strategy:
fail-fast: false
matrix:
pkg-name: ["app", "fabric", "pytorch"]
2023-08-16 22:57:19 +00:00
env:
GCP_TARGET: "gs://lightning-docs-${{ matrix.pkg-name }}"
2023-03-05 10:41:00 +00:00
steps:
- uses: actions/download-artifact@v3
with:
name: docs-${{ matrix.pkg-name }}-${{ github.sha }}
path: docs/build/html/
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GCS_SA_KEY }}
- name: Setup gcloud
uses: google-github-actions/setup-gcloud@v1
with:
project_id: ${{ secrets.GCS_PROJECT }}
# Uploading docs to GCS, so they can be served on lightning.ai
2023-03-07 15:39:52 +00:00
- name: Upload docs/${{ matrix.pkg-name }}/stable to GCS 🪣
2023-03-05 10:41:00 +00:00
if: startsWith(github.ref, 'refs/heads/release/')
2023-08-16 22:57:19 +00:00
run: gsutil -m rsync -d -R docs/build/html/ ${GCP_TARGET}/stable
2023-03-05 10:41:00 +00:00
# Uploading docs to GCS, so they can be served on lightning.ai
2023-03-07 15:39:52 +00:00
- name: Upload docs/${{ matrix.pkg-name }}/latest to GCS 🪣
2023-03-05 10:41:00 +00:00
if: github.ref == 'refs/heads/master'
2023-08-16 22:57:19 +00:00
run: gsutil -m rsync -d -R docs/build/html/ ${GCP_TARGET}/latest
# Uploading docs to GCS, so they can be served on lightning.ai
2023-03-07 15:39:52 +00:00
- name: Upload docs/${{ matrix.pkg-name }}/release to GCS 🪣
if: startsWith(github.ref, 'refs/tags/')
2023-08-16 22:57:19 +00:00
run: gsutil -m rsync -d -R docs/build/html/ ${GCP_TARGET}/${{ github.ref_name }}
# Uploading docs as archive to GCS, so they can be as backup
- name: Upload docs as archive to GCS 🪣
if: startsWith(github.ref, 'refs/tags/')
working-directory: docs/build
run: |
zip ${{ github.ref_name }}.zip -r html/
gsutil cp ${{ github.ref_name }}.zip ${GCP_TARGET}