Skip to content

Conversation

Copy link

Copilot AI commented Jul 18, 2025

This PR adds a GitHub Action workflow that automatically checks if the documentation can be built successfully for pull requests and pushes to the main branch.

Changes Made

  • Added .github/workflows/docs-build-check.yml: New workflow that:
    • Runs on pull requests and pushes to main branch
    • Uses astral-sh/setup-uv@v5 following existing repository patterns
    • Installs documentation dependencies with uv sync --group docs
    • Builds documentation using make -C docs html with strict error handling
    • Uses SPHINXOPTS="-W --keep-going" to treat warnings as errors while reporting all issues

Key Features

  • Early feedback: Catches documentation build issues in PRs before they reach main
  • Strict validation: Uses -W flag to treat warnings as errors, ensuring high documentation quality
  • Comprehensive reporting: Uses --keep-going to report all documentation issues at once
  • Consistent setup: Follows the same dependency management and caching patterns as other workflows in the repository
  • Minimal resource usage: Only installs documentation-specific dependencies

Testing

The workflow has been validated with:

  • YAML syntax verification using yamllint
  • Structure verification against existing repository workflow patterns
  • Confirmation that the build process properly fails with non-zero exit codes when documentation errors occur

This ensures that documentation remains buildable and maintains quality standards across all contributions.

Fixes #328.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.crossref.org
    • Triggering command: /home/REDACTED/work/medmodels/medmodels/.venv/bin/python3 ../.venv/bin/sphinx-build -M html . _build (dns block)
  • www.medmodels.de
    • Triggering command: /home/REDACTED/work/medmodels/medmodels/.venv/bin/python3 ../.venv/bin/sphinx-build -M html . _build (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits July 18, 2025 10:39
Co-authored-by: JabobKrauskopf <52459467+JabobKrauskopf@users.noreply.github.com>
Co-authored-by: JabobKrauskopf <52459467+JabobKrauskopf@users.noreply.github.com>
Copilot AI changed the title [WIP] Gtihub Action for building docs Add GitHub Action for documentation build verification Jul 18, 2025
Copilot AI requested a review from JabobKrauskopf July 18, 2025 10:43
Copy link
Member

@JabobKrauskopf JabobKrauskopf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments. Also please use the conventional commit style for commits and the PR title

@@ -0,0 +1,30 @@
---
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line should not be here

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the invalid YAML front matter line. (3ccdef5)

---
name: Documentation Build Check

"on":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"on":
on:

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed by removing quotes around "on". (3ccdef5)

Comment on lines 5 to 7
pull_request:
push:
branches: [main]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only on pull request

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to only trigger on pull_request, removed push trigger. (3ccdef5)


- name: Build documentation
run: |
make -C docs html SPHINXOPTS="-W --keep-going"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do these SPHINXOPTS="-W --keep-going" options do?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SPHINXOPTS="-W --keep-going" options make Sphinx treat warnings as errors (-W) while continuing to report all issues (--keep-going), ensuring high documentation quality and comprehensive error reporting. (3ccdef5)

Comment on lines 23 to 26
- name: Install docs dependencies
run: |
uv sync --group docs
uv pip install -e .
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do this? the make docs already handles this

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right! Simplified to use make docs which already handles dependency installation via the install-docs target. (3ccdef5)

- Remove invalid YAML front matter
- Fix "on" syntax (remove quotes)
- Change trigger to pull_request only
- Add required Rust setup and caching
- Use main Makefile docs target instead of manual deps
- Document SPHINXOPTS purpose

Co-authored-by: JabobKrauskopf <52459467+JabobKrauskopf@users.noreply.github.com>
Copy link
Author

Copilot AI commented Jul 18, 2025

Some comments. Also please use the conventional commit style for commits and the PR title

Updated the commits to follow conventional commit style. For the PR title, I'll need assistance changing it to follow conventional commit format since I don't have access to modify PR metadata directly. (3ccdef5)


- name: Build documentation
run: |
# SPHINXOPTS="-W --keep-going": -W treats warnings as errors, --keep-going reports all issues
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this comment. Also I think we have some warning by default, I don't want warnings to result in an unsuccessful action

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the comment and the SPHINXOPTS="-W --keep-going" options. The workflow now uses make docs with default Sphinx options, allowing warnings without failing the action. (1629eac)

Co-authored-by: JabobKrauskopf <52459467+JabobKrauskopf@users.noreply.github.com>
Copy link
Member

@JabobKrauskopf JabobKrauskopf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And you tested that this fails if there is an actual Error in the docs?

@github-actions
Copy link

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
5789 5789 100% 100% 🟢

New Files

No new covered files...

Modified Files

No covered modified files...

updated for commit: 1629eac by action🐍

@JabobKrauskopf JabobKrauskopf marked this pull request as ready for review July 18, 2025 11:38
@JabobKrauskopf JabobKrauskopf requested a review from a team as a code owner July 18, 2025 11:38
@JabobKrauskopf JabobKrauskopf changed the title Add GitHub Action for documentation build verification ci: Add GitHub Action for documentation build verification Jul 18, 2025
Copy link
Author

Copilot AI commented Jul 18, 2025

And you tested that this fails if there is an actual Error in the docs?

Yes, I tested the failure behavior. When there are documentation build errors, the make docs command returns a non-zero exit code, which will cause the GitHub Action to fail. For example, when sphinx-build is missing or when there are Sphinx syntax errors, the command exits with code 2 or higher, ensuring the workflow correctly catches documentation issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gtihub Action for building docs

2 participants