Docs #841
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: Docs | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - 'release/v*' | |
| - 'release/[0-9]*' | |
| tags: | |
| - 'v*' | |
| pull_request: | |
| branches: | |
| - main | |
| - 'release/v*' | |
| - 'release/[0-9]*' | |
| workflow_run: | |
| workflows: ["Tests"] | |
| types: | |
| - completed | |
| branches: | |
| - main | |
| - 'release/v*' | |
| - 'release/[0-9]*' | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: docs-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| if: github.event_name != 'workflow_run' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 # Needed for mike to work with git history | |
| - uses: astral-sh/setup-uv@v7 | |
| - name: Set up Python | |
| run: uv python install 3.12 | |
| - name: Install dependencies | |
| run: uv sync --extra docs --extra dev --extra plot | |
| - name: Lint documentation examples | |
| run: uv run pytest tests/doctest/test_docs_lint.py -v -p no:xdist -o "addopts=" | |
| - name: Test documentation examples (moto) | |
| run: uv run pytest tests/doctest/test_docs_run.py -v -p no:xdist -o "addopts=" --cov=zae_limiter --cov-report=xml --junitxml=junit.xml -o junit_family=legacy | |
| - name: Upload coverage | |
| uses: codecov/codecov-action@v6 | |
| with: | |
| files: coverage.xml | |
| flags: doctest | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| fail_ci_if_error: false | |
| - name: Upload test results to Codecov | |
| if: "!cancelled()" | |
| uses: codecov/codecov-action@v6 | |
| with: | |
| files: junit.xml | |
| flags: doctest | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| report_type: test_results | |
| fail_ci_if_error: false | |
| - name: Build docs (PR check) | |
| if: github.event_name == 'pull_request' | |
| run: uv run mkdocs build --strict | |
| deploy: | |
| if: | | |
| (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') || | |
| (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: gh-pages-write-${{ github.ref }} | |
| cancel-in-progress: false | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.event.workflow_run.head_sha || github.sha }} | |
| fetch-depth: 0 | |
| - uses: astral-sh/setup-uv@v7 | |
| - name: Set up Python | |
| run: uv python install 3.12 | |
| - name: Install dependencies | |
| run: uv sync --extra docs | |
| - name: Configure git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Deploy dev docs (main branch) | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| uv run mike deploy --push --update-aliases dev latest | |
| uv run mike set-default --push latest | |
| - name: Deploy next docs (release branch) | |
| if: startsWith(github.ref, 'refs/heads/release/') | |
| run: | | |
| VERSION=${GITHUB_REF#refs/heads/release/} | |
| VERSION=${VERSION#v} # Strip 'v' prefix if present | |
| uv run mike deploy --push --update-aliases ${VERSION}-dev next | |
| - name: Deploy versioned docs (tag) | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: | | |
| VERSION=${GITHUB_REF#refs/tags/v} | |
| MAJOR_MINOR=$(echo $VERSION | cut -d. -f1,2) | |
| uv run mike deploy --push --update-aliases $VERSION $MAJOR_MINOR latest | |
| uv run mike set-default --push latest |