Skip to content

Commit

Permalink
🔧 update docs pipeline
Browse files Browse the repository at this point in the history
Signed-off-by: burgholzer <[email protected]>
  • Loading branch information
burgholzer committed Oct 10, 2024
1 parent 24a327e commit 0a93d2b
Showing 1 changed file with 30 additions and 18 deletions.
48 changes: 30 additions & 18 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,36 @@ formats:
build:
os: ubuntu-22.04
tools:
python: "3.11"
jobs:
post_checkout:
# 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/workflows/support*;
then
exit 183;
fi
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
# Unshallow the git clone and fetch tags to get proper version information
- git fetch --unshallow --tags
# Install the project and its documentation dependencies
- uv pip install .[docs] readthedocs-sphinx-ext
# Run the html builder
- . .venv/bin/activate && .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/activate && .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/activate && .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=$READTHEDOCS_PROJECT
- mkdir -p $READTHEDOCS_OUTPUT/pdf
- cp docs/_build/latex/$READTHEDOCS_PROJECT.pdf $READTHEDOCS_OUTPUT/pdf/$READTHEDOCS_PROJECT.pdf

sphinx:
configuration: docs/conf.py

python:
install:
- method: pip
path: .
extra_requirements:
- docs

0 comments on commit 0a93d2b

Please sign in to comment.