From f6bbe0d37abf31b9d5ca48bd7e9ebcf92d7083cb Mon Sep 17 00:00:00 2001 From: Hynek Schlawack Date: Thu, 16 Jan 2025 09:32:26 +0100 Subject: [PATCH] Only build docs in RTD and only run doctests in CI --- .github/workflows/ci.yml | 4 ++-- .readthedocs.yaml | 20 ++++++++++++-------- tox.ini | 9 ++++----- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 339569881..3b8524691 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -172,7 +172,7 @@ jobs: if: ${{ failure() }} docs: - name: Build docs & run doctests + name: Run doctests runs-on: ubuntu-latest needs: build-package steps: @@ -188,7 +188,7 @@ jobs: python-version: "3.13" - uses: hynek/setup-cached-uv@v2 - - run: uvx --with=tox-uv tox run -e docs,changelog + - run: uvx --with=tox-uv tox run -e docs-doctests,changelog pyright: name: Check types using pyright diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 89acd70f1..d58ce3386 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -6,12 +6,16 @@ build: tools: # Keep version in sync with tox.ini/docs and ci.yml/docs. python: "3.13" - commands: - # Need the tags to calculate the version (sometimes). - - git fetch --tags - - asdf plugin add uv - - asdf install uv latest - - asdf global uv latest + jobs: + create_environment: + # Need the tags to calculate the version (sometimes). + - git fetch --tags - - uvx --with tox-uv tox run -e docs-sponsors - - uvx --with tox-uv tox run -e docs -- $READTHEDOCS_OUTPUT + - asdf plugin add uv + - asdf install uv latest + - asdf global uv latest + + build: + html: + - uvx --with tox-uv tox run -e docs-sponsors + - uvx --with tox-uv tox run -e docs-build -- $READTHEDOCS_OUTPUT diff --git a/tox.ini b/tox.ini index 5d4425436..b01466737 100644 --- a/tox.ini +++ b/tox.ini @@ -6,7 +6,7 @@ env_list = py3{10,11,12,13}-mypy, pypy3-tests, pyright, - docs{,-sponsors}, + docs-{sponsors,doctests}, changelog, coverage-report @@ -40,7 +40,6 @@ set_env = PYTHONWARNINGS=d commands_pre = python -c 'import pathlib; pathlib.Path("{env_site_packages_dir}/cov.pth").write_text("import coverage; coverage.process_startup()")' commands = - uv pip list -p {envpython} coverage run -m pytest {posargs} [testenv:coverage-report] @@ -66,14 +65,14 @@ pass_env = commands = pytest --codspeed -n auto bench/test_benchmarks.py -[testenv:docs] +[testenv:docs-{build,doctests}] runner = uv-venv-lock-runner # Keep base_python in-sync with ci.yml/docs and .readthedocs.yaml. base_python = py313 dependency_groups = docs commands = - sphinx-build -n -T -W -b html -d {envtmpdir}/doctrees docs {posargs:docs/_build/}html - sphinx-build -n -T -W -b doctest -d {envtmpdir}/doctrees docs {posargs:docs/_build/}html + doctests: sphinx-build -n -T -W -b doctest -d {envtmpdir}/doctrees docs {posargs:docs/_build/}html + build: sphinx-build -n -T -W -b html -d {envtmpdir}/doctrees docs {posargs:docs/_build/}html [testenv:docs-watch]