Skip to content

Commit

Permalink
Merge pull request #320 from akutz/feature/gh-action-verify-docs
Browse files Browse the repository at this point in the history
✨ GitHub action to verify docs
  • Loading branch information
akutz authored Dec 26, 2023
2 parents af9cf50 + 7bd347b commit b76f234
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,24 @@ jobs:
- name: Lint Shell
run: make lint-shell

verify-docs:
needs:
- lint-markdown
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: 'docs/requirements.txt'
- name: Install Doc Requirements
run: pip install -r docs/requirements.txt
- name: Verify Docs
run: make docs-build-python

verify-go-modules:
runs-on: ubuntu-latest
steps:
Expand Down
17 changes: 11 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -530,15 +530,18 @@ deploy-local-vcsim: prereqs kustomize-local-vcsim ## Deploy controller in the c
## Documentation
## --------------------------------------

ifeq (,$(strip $(GITHUB_RUN_ID)))
MKDOCS := $$(python3 -m site --user-base)/bin/mkdocs
else
MKDOCS := mkdocs
endif

.PHONY: docs-build-python
docs-build-python: ## Build docs w python

# SKIP_PIP_INSTALL is set to true by the GitHub action that verifies the docs
# can be built successfully since the GitHub action directly installs the deps.
ifneq (true,$(SKIP_PIP_INSTALL))
ifeq (,$(strip $(GITHUB_RUN_ID)))
pip3 install --user -r ./docs/requirements.txt
endif
$$(python3 -m site --user-base)/bin/mkdocs build --clean --config-file mkdocs.yml
$(MKDOCS) build --clean --config-file mkdocs.yml

.PHONY: docs-build-docker
docs-build-docker: ## Build docs w Docker
Expand All @@ -548,8 +551,10 @@ docs-build-docker: ## Build docs w Docker

.PHONY: docs-serve-python
docs-serve-python: ## Serve docs w python
ifeq (,$(strip $(GITHUB_RUN_ID)))
pip3 install --user -r ./docs/requirements.txt
$$(python3 -m site --user-base)/bin/mkdocs serve
endif
$(MKDOCS) serve

.PHONY: docs-serve-docker
docs-serve-docker: ## Serve docs w docker
Expand Down

0 comments on commit b76f234

Please sign in to comment.