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

110 lines
3.9 KiB
YAML
Raw Normal View History

name: "Docs check"
# https://github.com/marketplace/actions/sphinx-build
on: # Trigger the workflow on push or pull request, but only for the master branch
push:
branches: [master, "release/*"]
pull_request:
branches: [master, "release/*"]
jobs:
sphinx-check:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: ammaraskar/sphinx-action@master
with:
# git is required to clone the docs theme
# before custom requirement are resolved https://github.com/ammaraskar/sphinx-action/issues/16
pre-build-command: "apt-get update -y && apt-get install -y git && pip install -r requirements/docs.txt"
docs-folder: "docs/"
repo-token: "${{ secrets.GITHUB_TOKEN }}"
test-docs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.7
# Note: This uses an internal pip API and may not always work
# https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python --version
pip --version
# remove Horovod from requirements
python -c "fname = 'requirements/extra.txt' ; lines = [line for line in open(fname).readlines() if not line.startswith('horovod')] ; open(fname, 'w').writelines(lines)"
# python -m pip install --upgrade --user pip
pip install --requirement requirements.txt --upgrade-strategy only-if-needed --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --quiet
pip install --requirement requirements/extra.txt
pip install --requirement requirements/loggers.txt
pip install --requirement requirements/docs.txt
2020-09-30 12:37:52 +00:00
pip list
shell: bash
- name: Test Documentation
env:
SPHINX_MOCK_REQUIREMENTS: 0
run: |
# First run the same pipeline as Read-The-Docs
apt-get update && sudo apt-get install -y cmake
cd docs
make doctest
make coverage
make-docs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.7
# Note: This uses an internal pip API and may not always work
# https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python --version
pip --version
# pip install --requirement requirements.txt --upgrade-strategy only-if-needed --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --quiet
pip install --requirement requirements/docs.txt
# install Texlive, see https://linuxconfig.org/how-to-install-latex-on-ubuntu-20-04-focal-fossa-linux
sudo apt-get update && sudo apt-get install -y texlive-latex-extra dvipng texlive-pictures
2020-09-30 12:37:52 +00:00
pip list
shell: bash
- name: Make Documentation
run: |
# First run the same pipeline as Read-The-Docs
cd docs
make clean
make html --debug --jobs $(nproc) SPHINXOPTS="-W"
- name: Upload built docs
uses: actions/upload-artifact@v2
with:
name: docs-results-${{ github.sha }}
path: docs/build/html/
# Use always() to always run this step to publish test results when there are test failures
if: success()