Split docs targets for faster builds (#194)

* Split docs targets for faster builds

* Kill copypasta

* Try using uv's Python
This commit is contained in:
Hynek Schlawack 2025-02-22 09:43:10 +01:00 committed by GitHub
parent c4633ca2c2
commit 6c2264e203
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 21 additions and 29 deletions

View File

@ -201,7 +201,7 @@ jobs:
docs: docs:
name: Build docs & run doctests name: Run doctests
needs: build-package needs: build-package
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -211,15 +211,11 @@ jobs:
name: Packages name: Packages
path: dist path: dist
- run: tar xf dist/*.tar.gz --strip-components=1 - run: tar xf dist/*.tar.gz --strip-components=1
- uses: actions/setup-python@v5
with:
# Keep in sync with tox.ini/docs & .readthedocs.yaml
python-version: "3.13"
- uses: hynek/setup-cached-uv@v2 - uses: hynek/setup-cached-uv@v2
- run: > - run: >
uvx --with tox-uv uvx --with tox-uv
tox run -e docs tox run -e docs-doctests
install-dev: install-dev:

View File

@ -4,22 +4,17 @@ version: 2
build: build:
os: ubuntu-lts-latest os: ubuntu-lts-latest
tools: tools:
# Keep version in sync with tox.ini/docs and ci.yml/docs. # Keep version in sync with tox.ini/docs.
python: "3.13" python: "3.13"
jobs: jobs:
# Need the tags to calculate the version. create_environment:
post_checkout: # Need the tags to calculate the version (sometimes).
- git fetch --tags - git fetch --tags
python: - asdf plugin add uv
install: - asdf install uv latest
- method: pip - asdf global uv latest
path: .
extra_requirements:
- docs
submodules: build:
include: all html:
- uvx --with tox-uv tox run -e docs-build -- $READTHEDOCS_OUTPUT
sphinx:
configuration: docs/conf.py

19
tox.ini
View File

@ -7,7 +7,7 @@ env_list =
py312-bindings-main, py312-bindings-main,
pypy3-tests, pypy3-tests,
system-argon2, system-argon2,
docs, docs-doctests,
coverage-report coverage-report
@ -81,20 +81,21 @@ deps = mypy
commands = mypy src commands = mypy src
[testenv:docs] [testenv:docs-{build,doctests,linkcheck}]
description = Build docs and run doctests. # Keep base_python in sync with .readthedocs.yaml.
# Keep base_python in-sync with .readthedocs.yaml and ci.yml/docs.
base_python = py313 base_python = py313
extras = docs extras = docs
commands = commands =
python -m doctest README.md build: sphinx-build -n -T -W -b html -d {envtmpdir}/doctrees docs {posargs:docs/_build/}html
sphinx-build -W -n -b html -d {envtmpdir}/doctrees docs docs/_build/html doctests: python -m doctest README.md
sphinx-build -W -n -b doctest -d {envtmpdir}/doctrees docs docs/_build/html doctests: sphinx-build -n -T -W -b doctest -d {envtmpdir}/doctrees docs {posargs:docs/_build/}html
linkcheck: sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees docs docs/_build/html
[testenv:docs-watch] [testenv:docs-watch]
package = editable package = editable
base_python = {[testenv:docs]base_python} base_python = {[testenv:docs-build]base_python}
extras = {[testenv:docs]extras} extras = {[testenv:docs-build]extras}
deps = watchfiles deps = watchfiles
commands = commands =
watchfiles \ watchfiles \