From b38995261da9d5a3ba1bf3bcbb5255812a7fc6a0 Mon Sep 17 00:00:00 2001 From: smokestacklightnin <125844868+smokestacklightnin@users.noreply.github.com> Date: Sat, 28 Sep 2024 23:42:23 -0700 Subject: [PATCH 1/6] Build docs to check for errors on pull request --- .github/workflows/cd-docs.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cd-docs.yml b/.github/workflows/cd-docs.yml index 6616cd5aea..a70da22ad4 100644 --- a/.github/workflows/cd-docs.yml +++ b/.github/workflows/cd-docs.yml @@ -2,8 +2,7 @@ name: deploy-docs on: workflow_dispatch: push: - branches: - - master + pull_request: permissions: contents: write jobs: @@ -17,6 +16,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 @@ -43,3 +43,8 @@ jobs: - 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 --verbose + if: (github.event_name == 'pull_request') From 1f36d9085743bd23bb7149a81e39ea44371a8e7e Mon Sep 17 00:00:00 2001 From: smokestacklightnin <125844868+smokestacklightnin@users.noreply.github.com> Date: Sun, 29 Sep 2024 00:07:55 -0700 Subject: [PATCH 2/6] Move dependencies for docs to `requirements-docs.txt` so they don't need to be duplicated in the github docs workflow --- .github/workflows/cd-docs.yml | 2 +- requirements-docs.txt | 8 ++++++++ tfx/dependencies.py | 19 +++++++------------ 3 files changed, 16 insertions(+), 13 deletions(-) create mode 100644 requirements-docs.txt diff --git a/.github/workflows/cd-docs.yml b/.github/workflows/cd-docs.yml index a70da22ad4..b92f523938 100644 --- a/.github/workflows/cd-docs.yml +++ b/.github/workflows/cd-docs.yml @@ -39,7 +39,7 @@ 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 $( 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(): From 523bad74684d93dd6a93f50ff6bcd78fd3a16ccb Mon Sep 17 00:00:00 2001 From: smokestacklightnin <125844868+smokestacklightnin@users.noreply.github.com> Date: Sun, 29 Sep 2024 00:31:35 -0700 Subject: [PATCH 3/6] Add docs dependencies to github workflow cache dependency paths --- .github/workflows/cd-docs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cd-docs.yml b/.github/workflows/cd-docs.yml index b92f523938..a2eaca901a 100644 --- a/.github/workflows/cd-docs.yml +++ b/.github/workflows/cd-docs.yml @@ -26,6 +26,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 From 1d067cdb54ee2621f3bc3b9324915299317f5d15 Mon Sep 17 00:00:00 2001 From: smokestacklightnin <125844868+smokestacklightnin@users.noreply.github.com> Date: Sun, 29 Sep 2024 18:14:15 -0700 Subject: [PATCH 4/6] Call requirements file correctly --- .github/workflows/cd-docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd-docs.yml b/.github/workflows/cd-docs.yml index a2eaca901a..c8a32a7348 100644 --- a/.github/workflows/cd-docs.yml +++ b/.github/workflows/cd-docs.yml @@ -40,7 +40,7 @@ jobs: mkdocs-material- - name: Install Dependencies - run: pip install $( Date: Tue, 1 Oct 2024 18:10:25 -0700 Subject: [PATCH 5/6] Remove `--verbose` flag --- .github/workflows/cd-docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd-docs.yml b/.github/workflows/cd-docs.yml index c8a32a7348..a584add65c 100644 --- a/.github/workflows/cd-docs.yml +++ b/.github/workflows/cd-docs.yml @@ -47,5 +47,5 @@ jobs: if: (github.event_name != 'pull_request') - name: Build docs to check for errors - run: mkdocs build --verbose + run: mkdocs build if: (github.event_name == 'pull_request') From 911872ebabc136469732ac2f69721df8740ed7d6 Mon Sep 17 00:00:00 2001 From: smokestacklightnin <125844868+smokestacklightnin@users.noreply.github.com> Date: Wed, 2 Oct 2024 22:57:38 -0700 Subject: [PATCH 6/6] Only trigger on push to master --- .github/workflows/cd-docs.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/cd-docs.yml b/.github/workflows/cd-docs.yml index a584add65c..cedb64e38a 100644 --- a/.github/workflows/cd-docs.yml +++ b/.github/workflows/cd-docs.yml @@ -2,6 +2,8 @@ name: deploy-docs on: workflow_dispatch: push: + branches: + - 'master' pull_request: permissions: contents: write