From 4281b1114eecdc3bf7bd49d2849b53b4589efac7 Mon Sep 17 00:00:00 2001 From: Raphael Vallat Date: Fri, 6 Mar 2026 16:04:58 +0100 Subject: [PATCH] Switch to GH Pages workflow --- .github/workflows/deploy_doc.yml | 51 ++++++++++++++++++++++++++++++++ .github/workflows/docs.yml | 38 ++++++++++++++++++++++++ .gitignore | 2 +- docs/contributing.rst | 28 ++++++++++++++++++ 4 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/deploy_doc.yml create mode 100644 .github/workflows/docs.yml diff --git a/.github/workflows/deploy_doc.yml b/.github/workflows/deploy_doc.yml new file mode 100644 index 0000000..4bb0957 --- /dev/null +++ b/.github/workflows/deploy_doc.yml @@ -0,0 +1,51 @@ +name: Deploy Documentation to GitHub Pages + +on: + push: + branches: [master] + workflow_dispatch: + +# Cancel any in-progress job or run +concurrency: + group: "pages" + cancel-in-progress: true + +jobs: + deploy-docs: + runs-on: ubuntu-latest + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + env: + FORCE_COLOR: true + UV_SYSTEM_PYTHON: 1 + steps: + - uses: actions/checkout@v6 + + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version-file: "pyproject.toml" + + - name: Set up uv + uses: astral-sh/setup-uv@v7 + + - name: Install dependencies + run: uv pip install --group=docs --editable . + + - name: Build documentation + run: | + make -C docs clean + make -C docs html + + - name: Upload Pages artifact + uses: actions/upload-pages-artifact@v3 + with: + path: docs/build/html + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..e6f45ac --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,38 @@ +name: Build documentation and upload as artifact to GitHub Actions + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + docs: + runs-on: ubuntu-latest + env: + FORCE_COLOR: true + UV_SYSTEM_PYTHON: 1 + steps: + - uses: actions/checkout@v6 + + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version-file: "pyproject.toml" + + - name: Set up uv + uses: astral-sh/setup-uv@v7 + + - name: Install dependencies + run: uv pip install --group=docs --editable . + + - name: Build documentation + run: | + make -C docs clean + make -C docs html + + - name: Upload documentation artifacts + uses: actions/upload-artifact@v6 + with: + name: docs-artifact + path: docs/build/html diff --git a/.gitignore b/.gitignore index f8e5056..78257e5 100644 --- a/.gitignore +++ b/.gitignore @@ -102,7 +102,7 @@ venv.bak/ # mypy .mypy_cache/ desktop.ini -docs/build/doctrees/ +docs/build/ docs/generated/ .DS_Store push_pypi.md diff --git a/docs/contributing.rst b/docs/contributing.rst index a090953..3ae6941 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -48,6 +48,34 @@ Submitting a pull request 6. Open a pull request against the ``master`` branch. +Updating the documentation +-------------------------- + +The documentation is built with `Sphinx `_. To build it locally: + +1. Install the documentation dependencies: + + .. code-block:: shell + + uv pip install --group=docs --editable . + +2. Build the HTML docs: + + .. code-block:: shell + + make -C docs clean + make -C docs html + +3. Open ``docs/build/html/index.html`` in your browser to preview the result. + +When you open a pull request, a ``docs`` CI job automatically builds the documentation and +uploads the result as a GitHub Actions artifact. To verify the rendered docs from a PR: + +1. Go to the PR on GitHub and click on the **Checks** tab. +2. Open the **Build documentation and upload as artifact to GitHub Actions** workflow run. +3. Click **Summary** in the left sidebar, then scroll down to the **Artifacts** section. +4. Download the ``docs-artifact`` zip file and open ``index.html`` in your browser. + Questions ---------