Skip to content

Commit

Permalink
Merge pull request #6919 from smokestacklightnin/ci/docs/check-docs-o…
Browse files Browse the repository at this point in the history
…n-pull-request

Move docs dependencies to common location and check for broken docs on pull request
  • Loading branch information
peytondmurray authored Oct 23, 2024
2 parents 56eb0d0 + 911872e commit 6ac79b8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 14 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/cd-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ on:
workflow_dispatch:
push:
branches:
- master
- 'master'
pull_request:
permissions:
contents: write
jobs:
Expand All @@ -17,6 +18,7 @@ jobs:
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
if: (github.event_name != 'pull_request')

- name: Set up Python 3.9
uses: actions/setup-python@v5
Expand All @@ -26,6 +28,7 @@ jobs:
cache-dependency-path: |
setup.py
tfx/dependencies.py
requirements-docs.txt
- name: Save time for cache for mkdocs
run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
Expand All @@ -39,7 +42,12 @@ jobs:
mkdocs-material-
- name: Install Dependencies
run: pip install mkdocs mkdocs-material mkdocstrings[python] griffe-inherited-docstrings mkdocs-autorefs mkdocs-jupyter mkdocs-caption markdown-grid-tables
run: pip install -r requirements-docs.txt

- name: Deploy to GitHub Pages
run: mkdocs gh-deploy --force
if: (github.event_name != 'pull_request')

- name: Build docs to check for errors
run: mkdocs build
if: (github.event_name == 'pull_request')
8 changes: 8 additions & 0 deletions requirements-docs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
mkdocs
mkdocstrings[python]
mkdocs-material
griffe-inherited-docstrings
mkdocs-autorefs
mkdocs-jupyter
mkdocs-caption
markdown-grid-tables
19 changes: 7 additions & 12 deletions tfx/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from __future__ import annotations

import os

from pathlib import Path

def select_constraint(default, nightly=None, git_master=None):
"""Select dependency constraint based on TFX_DEPENDENCY_SELECTOR env var."""
Expand Down Expand Up @@ -258,17 +258,12 @@ def make_extra_packages_docs() -> list[str]:
list[str]
List of packages required for building docs
"""
return [
"mkdocs",
"mkdocstrings[python]",
"mkdocs-material",
"griffe-inherited-docstrings",
"mkdocs-autorefs",
"mkdocs-jupyter",
"mkdocs-caption",
"pymdown-extensions",
"markdown-grid-tables",
]
with open(Path(__file__).resolve().parent.parent / "requirements-docs.txt", "r") as fp:
reqs = fp.readlines()

reqs = [req.replace("\n", "") for req in reqs]

return reqs


def make_extra_packages_all():
Expand Down

0 comments on commit 6ac79b8

Please sign in to comment.