Skip to content

Commit

Permalink
chore: Update .gitignore and workflows for documentation deployment a…
Browse files Browse the repository at this point in the history
…nd testing

Signed-off-by: longhao <[email protected]>
  • Loading branch information
loonghao committed Dec 29, 2024
1 parent 6a4eff5 commit baa862b
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 41 deletions.
81 changes: 42 additions & 39 deletions .github/workflows/publish_docs.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,42 @@
name: Deploy Documentation

on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install mkdocs-material
pip install -r docs/requirements.txt
- name: Configure Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Deploy Documentation
run: |
git fetch origin gh-pages || true
mkdocs gh-deploy --force
name: Deploy Documentation

on:
push:
branches: [ main ]
paths:
- 'docs/**'
- 'mkdocs.yml'
- '.github/workflows/publish_docs.yml'
- 'pyproject.toml'
- 'poetry.lock'
workflow_dispatch:

jobs:
deploy-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry config virtualenvs.create false
poetry install --only docs
- name: Configure Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Deploy documentation
run: |
mkdocs gh-deploy --force
43 changes: 43 additions & 0 deletions .github/workflows/test_docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Test Documentation Build

on:
pull_request:
branches: [ main ]
paths:
- 'docs/**'
- 'mkdocs.yml'
- '.github/workflows/test_docs.yml'
- 'pyproject.toml'
- 'poetry.lock'

jobs:
test-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry config virtualenvs.create false
poetry install --with docs
- name: Test documentation build
run: |
mkdocs build --strict
- name: Check for documentation warnings
run: |
if grep -r "WARNING" site/; then
echo "Documentation contains warnings"
exit 1
fi
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@

# Vim / Notepad++ temp files
*~
.*/

# Specific dot directories to ignore (but not .github)
.pytest_cache/
.mypy_cache/
.tox/
.venv/
.coverage/

*.egg-info
# PyInstaller output
build/
Expand Down
7 changes: 6 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,14 @@ pytest = "^7.4.3"
flake8 = "^7.0.0"
mypy = "^1.7.1"
coverage = "^7.3.2"
black = "^23.12.1"

[tool.poetry.group.docs]
optional = true

[tool.poetry.group.docs.dependencies]
mkdocs = "^1.5.3"
mkdocs-git-revision-date-plugin = "^0.3.2"
black = "^23.12.1"
mkdocs-material = "^9.5.2"
mkdocstrings-python = "^1.7.5"
mkdocs-pymdownx-material-extras = "^2.5.5"
Expand Down

0 comments on commit baa862b

Please sign in to comment.