-
Notifications
You must be signed in to change notification settings - Fork 311
Add docs build CI workflow #5418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| name: Build Documentation | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - "doc/**" | ||
| - ".github/workflows/docs.yaml" | ||
| - "pyproject.toml" | ||
| pull_request: | ||
| paths: | ||
| - "doc/**" | ||
| - ".github/workflows/docs.yaml" | ||
| workflow_dispatch: | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| build-docs: | ||
| name: Build Sphinx docs | ||
| runs-on: ubuntu-latest | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| env: | ||
| READTHEDOCS: "True" | ||
|
Comment on lines
+28
to
+29
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this reads like we're trying to impressionate RTD. Is there a reason for doing this that I'm missing ?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not trying to impersonate RTD. The https://github.com/yt-project/yt/blob/main/doc/Makefile#L49 checks that env var and skips sphinx-apidoc, which generates API stubs for every yt module. Those stubs cause autodoc to import the full package at build time, which can fail if compiled extensions or data aren't available. https://github.com/yt-project/yt/blob/main/doc/source/conf.py#L46 also uses it to skip autosummary and pythonscript_sphinxext (which executes inline Python scripts in the docs). It's saves time, and its avoiding build failures from operations that need a fully configured yt environment. Happy to use a different env var if you'd prefer
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks for the detailed explanation, I really had no idea this was the state of our setup |
||
|
|
||
| steps: | ||
| - name: Checkout repo | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Set up uv | ||
| uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6 | ||
| with: | ||
| python-version: "3.12" | ||
| enable-cache: false | ||
|
|
||
| - name: Install pandoc | ||
| run: sudo apt-get update && sudo apt-get install -y pandoc | ||
|
neutrinoceros marked this conversation as resolved.
|
||
|
|
||
| - name: Install dependencies | ||
| run: uv sync --group=docs | ||
|
|
||
| - name: Build HTML docs | ||
| run: | | ||
| cd doc | ||
| uv run make html | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't look right. Where is that
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. make is preinstalled on Ubuntu runners. The Makefile sets SPHINXBUILD = sphinx-build, so it needs sphinx-build on PATH. uv run handles that by prepending the venv's bin/ directory to PATH before executing the command, and child processes inherit it (https://docs.astral.sh/uv/concepts/projects/run/). Since we're setting READTHEDOCS=True (which skips sphinx-apidoc in the Makefile), we could also just call uv run sphinx-build -b html -d doc/build/doctrees doc/source doc/build/html directly if you'd prefer to skip make.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
oh, I was not aware |
||
|
|
||
| - name: Upload built docs | ||
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | ||
| with: | ||
| name: yt-docs-html | ||
| path: doc/build/html/ | ||
Uh oh!
There was an error while loading. Please reload this page.