Skip to content

Commit

Permalink
Add support for multiversion documentation build
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicoretti committed Dec 10, 2024
1 parent b07848c commit 35f6287
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 37 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/gh-pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ jobs:

- name: Build Documentation
run: |
poetry run python -m nox -s build-docs
touch doc/build/.nojekyll
poetry run python -m nox -s docs:multiversion
touch .html-documentation/.nojekyll
- name: Deploy
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: ./doc/build
folder: .html-documentation
git-config-name: Github Action
git-config-email: [email protected]

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.html-documentation
odbcconfig/odbcinst.ini

_build/
Expand Down
3 changes: 3 additions & 0 deletions doc/changes/unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@
- Remove testing against Exasol 7.0
- Relocked dependencies

## 📚 Documentation

* Added support for multiversion documentation

1 change: 1 addition & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"sphinx_copybutton",
"myst_parser",
"sphinx_design",
"exasol.toolbox.sphinx.multiversion",
]

intersphinx_mapping = {"python": ("https://docs.python.org/3", None)}
Expand Down
26 changes: 26 additions & 0 deletions noxconfig.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from __future__ import annotations

from dataclasses import dataclass
from pathlib import Path
from typing import (
Iterable,
)


@dataclass(frozen=True)
class Config:
root: Path = Path(__file__).parent
doc: Path = Path(__file__).parent / "doc"
version_file: Path = (
Path(__file__).parent / "sqlalchemy_exasol" / "version.py"
)
path_filters: Iterable[str] = (
"dist",
".eggs",
"venv",
)

plugins = []


PROJECT_CONFIG = Config()
48 changes: 14 additions & 34 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
from shutil import rmtree
from tempfile import TemporaryDirectory

# fmt: off
PROJECT_ROOT = Path(__file__).parent
# scripts path also contains administrative code/modules which are used by some nox targets
SCRIPTS = PROJECT_ROOT / "scripts"
DOC = PROJECT_ROOT / "doc"
DOC_BUILD = DOC / "build"
sys.path.append(f"{SCRIPTS}")
# fmt: on

from typing import Iterator

Expand Down Expand Up @@ -288,40 +290,6 @@ def parser() -> ArgumentParser:
session.notify(find_session_runner(session, "db-stop"))


@nox.session(python=False, name="clean-docs")
def clean(session: Session) -> None:
"""Remove all documentation artifacts"""
if DOC_BUILD.exists():
rmtree(DOC_BUILD.resolve())
session.log(f"Removed {DOC_BUILD}")


@nox.session(python=False, name="build-docs")
def build(session: Session) -> None:
"""Build the documentation"""
session.run(
"poetry",
"run",
"sphinx-build",
"-b",
"html",
"-W",
f"{DOC}",
f"{DOC_BUILD}",
external=True,
)


@nox.session(python=False, name="open-docs")
def open_docs(session: Session) -> None:
"""Open the documentation in the browser"""
index_page = DOC_BUILD / "index.html"
if not index_page.exists():
session.error(
f"File {index_page} does not exist." "Please run `nox -s build-docs` first"
)

webbrowser.open_new_tab(index_page.resolve().as_uri())


@nox.session(python=False)
Expand Down Expand Up @@ -482,3 +450,15 @@ def list_links(session: Session) -> None:
"""List all links within the documentation"""
for path, url in _urls(_documentation(PROJECT_ROOT)):
session.log(f"Url: {url}, File: {path}")



# fmt: off
from exasol.toolbox.nox._documentation import (
build_docs,
build_multiversion,
clean_docs,
open_docs,

)
# fmt: on

0 comments on commit 35f6287

Please sign in to comment.