update pyproject.toml #38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Documentation | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| paths: | |
| - 'docs/**' | |
| - 'src/**' | |
| - '.github/workflows/docs.yml' | |
| - 'pyproject.toml' | |
| pull_request: | |
| branches: [ main ] | |
| paths: | |
| - 'docs/**' | |
| - 'src/**' | |
| - '.github/workflows/docs.yml' | |
| - 'pyproject.toml' | |
| # Add permissions for GitHub Pages deployment | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| jobs: | |
| build-docs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.12' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e .[docs] | |
| - name: Check documentation coverage | |
| run: | | |
| cd docs | |
| make coverage | |
| - name: Check for broken links | |
| run: | | |
| cd docs | |
| make linkcheck | |
| continue-on-error: true # Don't fail build on broken external links | |
| - name: Build documentation | |
| run: | | |
| cd docs | |
| make html | |
| - name: Check build warnings | |
| run: | | |
| cd docs | |
| if [ -s _build/html/.doctrees/warnings.txt ]; then | |
| echo "Documentation build has warnings:" | |
| cat _build/html/.doctrees/warnings.txt | |
| exit 1 | |
| fi | |
| continue-on-error: true | |
| - name: Upload documentation artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: documentation | |
| path: docs/_build/html/ | |
| deploy-docs: | |
| runs-on: ubuntu-latest | |
| needs: build-docs | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| # Grant GITHUB_TOKEN the permissions required to make a Pages deployment | |
| permissions: | |
| pages: write # to deploy to Pages | |
| id-token: write # to verify the deployment originates from an appropriate source | |
| # Configure environment for GitHub Pages deployment | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Download documentation artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: documentation | |
| path: docs/_build/html/ | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v4 | |
| - name: Upload to GitHub Pages | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: docs/_build/html/ | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| readthedocs-webhook: | |
| runs-on: ubuntu-latest | |
| needs: build-docs | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| steps: | |
| - name: Trigger ReadTheDocs build | |
| run: | | |
| curl -X POST \ | |
| -H "Authorization: Token ${{ secrets.READTHEDOCS_TOKEN }}" \ | |
| https://readthedocs.org/api/v3/projects/project-x-py/builds/ | |
| continue-on-error: true # Don't fail if webhook isn't configured |