Skip to content

Commit baa862b

Browse files
committed
chore: Update .gitignore and workflows for documentation deployment and testing
Signed-off-by: longhao <[email protected]>
1 parent 6a4eff5 commit baa862b

File tree

4 files changed

+99
-41
lines changed

4 files changed

+99
-41
lines changed

.github/workflows/publish_docs.yml

Lines changed: 42 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,42 @@
1-
name: Deploy Documentation
2-
3-
on:
4-
push:
5-
branches:
6-
- main
7-
pull_request:
8-
branches:
9-
- main
10-
workflow_dispatch:
11-
12-
jobs:
13-
deploy:
14-
runs-on: ubuntu-latest
15-
steps:
16-
- uses: actions/checkout@v3
17-
with:
18-
fetch-depth: 0
19-
20-
- name: Set up Python
21-
uses: actions/setup-python@v4
22-
with:
23-
python-version: '3.x'
24-
25-
- name: Install dependencies
26-
run: |
27-
python -m pip install --upgrade pip
28-
pip install mkdocs-material
29-
pip install -r docs/requirements.txt
30-
31-
- name: Configure Git
32-
run: |
33-
git config --global user.name "github-actions[bot]"
34-
git config --global user.email "github-actions[bot]@users.noreply.github.com"
35-
36-
- name: Deploy Documentation
37-
run: |
38-
git fetch origin gh-pages || true
39-
mkdocs gh-deploy --force
1+
name: Deploy Documentation
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- 'docs/**'
8+
- 'mkdocs.yml'
9+
- '.github/workflows/publish_docs.yml'
10+
- 'pyproject.toml'
11+
- 'poetry.lock'
12+
workflow_dispatch:
13+
14+
jobs:
15+
deploy-docs:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: '3.9'
26+
cache: 'pip'
27+
28+
- name: Install dependencies
29+
run: |
30+
python -m pip install --upgrade pip
31+
pip install poetry
32+
poetry config virtualenvs.create false
33+
poetry install --only docs
34+
35+
- name: Configure Git
36+
run: |
37+
git config --global user.name "github-actions[bot]"
38+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
39+
40+
- name: Deploy documentation
41+
run: |
42+
mkdocs gh-deploy --force

.github/workflows/test_docs.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Test Documentation Build
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
paths:
7+
- 'docs/**'
8+
- 'mkdocs.yml'
9+
- '.github/workflows/test_docs.yml'
10+
- 'pyproject.toml'
11+
- 'poetry.lock'
12+
13+
jobs:
14+
test-docs:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: '3.9'
25+
cache: 'pip'
26+
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
pip install poetry
31+
poetry config virtualenvs.create false
32+
poetry install --with docs
33+
34+
- name: Test documentation build
35+
run: |
36+
mkdocs build --strict
37+
38+
- name: Check for documentation warnings
39+
run: |
40+
if grep -r "WARNING" site/; then
41+
echo "Documentation contains warnings"
42+
exit 1
43+
fi

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@
66

77
# Vim / Notepad++ temp files
88
*~
9-
.*/
9+
10+
# Specific dot directories to ignore (but not .github)
11+
.pytest_cache/
12+
.mypy_cache/
13+
.tox/
14+
.venv/
15+
.coverage/
16+
1017
*.egg-info
1118
# PyInstaller output
1219
build/

pyproject.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,14 @@ pytest = "^7.4.3"
4242
flake8 = "^7.0.0"
4343
mypy = "^1.7.1"
4444
coverage = "^7.3.2"
45+
black = "^23.12.1"
46+
47+
[tool.poetry.group.docs]
48+
optional = true
49+
50+
[tool.poetry.group.docs.dependencies]
4551
mkdocs = "^1.5.3"
4652
mkdocs-git-revision-date-plugin = "^0.3.2"
47-
black = "^23.12.1"
4853
mkdocs-material = "^9.5.2"
4954
mkdocstrings-python = "^1.7.5"
5055
mkdocs-pymdownx-material-extras = "^2.5.5"

0 commit comments

Comments
 (0)