From 5648cb7c0515b6892bba15159ab5b182469ea3ab Mon Sep 17 00:00:00 2001 From: longhao Date: Sun, 29 Dec 2024 11:58:18 +0800 Subject: [PATCH] chore: Update .gitignore and workflows for documentation deployment and testing Signed-off-by: longhao --- .github/workflows/publish_docs.yml | 81 ++++++++++++++++-------------- .github/workflows/test_docs.yaml | 43 ++++++++++++++++ .gitignore | 9 +++- 3 files changed, 93 insertions(+), 40 deletions(-) create mode 100644 .github/workflows/test_docs.yaml diff --git a/.github/workflows/publish_docs.yml b/.github/workflows/publish_docs.yml index 2adf5076..4b31048c 100644 --- a/.github/workflows/publish_docs.yml +++ b/.github/workflows/publish_docs.yml @@ -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 diff --git a/.github/workflows/test_docs.yaml b/.github/workflows/test_docs.yaml new file mode 100644 index 00000000..9512ca60 --- /dev/null +++ b/.github/workflows/test_docs.yaml @@ -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 --only 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 diff --git a/.gitignore b/.gitignore index 31bea1f4..7d7c5dfd 100644 --- a/.gitignore +++ b/.gitignore @@ -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/