diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 307669a..a977ea9 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -7,15 +7,34 @@ formats: build: os: ubuntu-22.04 tools: - python: "3.11" - apt_packages: - - imagemagick - - inkscape - - graphviz + python: "3.12" + commands: + # Skip docs build if the commit message contains "skip ci" + - (git --no-pager log --pretty="tformat:%s -- %b" -1 | grep -viq "skip ci") || exit 183 + # Skip docs build if there are no changes related to docs + - | + if [ "$READTHEDOCS_VERSION_TYPE" = "external" ] && git diff --quiet origin/main -- docs/ .readthedocs.yaml src/mqt/ src/python include/*/python .github/contributing* .github/support*; + then + exit 183; + fi + # Set up uv and a virtual environment + - asdf plugin add uv + - asdf install uv latest + - asdf global uv latest + - uv venv + # Install the project dependencies + - uv pip install -r docs/requirements.txt readthedocs-sphinx-ext + # Run the html builder + - .venv/bin/python -m sphinx -T -b html -d docs/_build/doctrees -D language=en docs $READTHEDOCS_OUTPUT/html + # Run the htmlzip builder and create a zip file + - .venv/bin/python -m sphinx -T -b dirhtml -d docs/_build/doctrees -D language=en docs docs/_build/dirhtml + - mkdir -p $READTHEDOCS_OUTPUT/htmlzip + - zip -r $READTHEDOCS_OUTPUT/htmlzip/html.zip docs/_build/dirhtml/* + # Run the latex builder and create a pdf file + - .venv/bin/python -m sphinx -T -b latex -d docs/_build/doctrees -D language=en docs docs/_build/latex + - cd docs/_build/latex && latexmk -pdf -f -dvi- -ps- -interaction=nonstopmode -jobname=mqt_handbook + - mkdir -p $READTHEDOCS_OUTPUT/pdf + - cp docs/_build/latex/mqt_handbook.pdf $READTHEDOCS_OUTPUT/pdf/mqt_handbook.pdf sphinx: configuration: docs/conf.py - -python: - install: - - requirements: docs/requirements.txt diff --git a/docs/conf.py b/docs/conf.py index c1606d0..01893c6 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -27,7 +27,7 @@ "myst_nb", "sphinx.ext.intersphinx", "sphinxcontrib.bibtex", - "sphinxcontrib.inkscapeconverter", + "sphinxcontrib.cairosvgconverter", "sphinx_design", "sphinx_copybutton", "sphinxext.opengraph", diff --git a/docs/requirements.txt b/docs/requirements.txt index b683ab9..9d7f4a5 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -15,5 +15,5 @@ sphinx>=5 sphinx-copybutton sphinx_design sphinxcontrib-bibtex>=2.4.2 -sphinxcontrib-svg2pdfconverter +sphinxcontrib-svg2pdfconverter[CairoSVG] sphinxext-opengraph