Skip to content

Commit 686587e

Browse files
committed
[Github] Validate documentation
1 parent 1a65cd3 commit 686587e

File tree

10 files changed

+117
-98
lines changed

10 files changed

+117
-98
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: validate-sphinx-docs
2+
3+
inputs:
4+
path:
5+
required: true
6+
7+
runs:
8+
using: "composite"
9+
steps:
10+
- name: Validate Sphinx documentation in ${{ inputs.path }}
11+
uses: cor3ntin/sphinx-action@main
12+
with:
13+
docs-folder: ${{ inputs.path }}
14+
# We exclude references errors so that we do not have to build the table gen documentation
15+
build-command: "sphinx-build -b html . _build -Dsuppress_warnings=toc.not_readable,ref.*"
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Checking Documentation
2+
3+
on:
4+
pull_request:
5+
path: '**/docs/**/*.rst'
6+
7+
jobs:
8+
verify-sphinx-documentation:
9+
runs-on: ubuntu-latest
10+
env:
11+
SPHINX_ACTION: "./.github/templates/validate-sphinx-docs"
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Check Bolt documentation
17+
uses: "./.github/templates/validate-sphinx-docs"
18+
with:
19+
path: ./bolt/docs
20+
21+
- name: Check Clang documentation
22+
uses: "./.github/templates/validate-sphinx-docs"
23+
with:
24+
path: ./clang/docs
25+
26+
- name: Check Clang Tools documentation
27+
uses: "./.github/templates/validate-sphinx-docs"
28+
with:
29+
path: ./clang-tools-extra/docs
30+
31+
- name: Check Flang documentation
32+
uses: "./.github/templates/validate-sphinx-docs"
33+
with:
34+
path: ./flang/docs
35+
36+
- name: Check libc documentation
37+
uses: "./.github/templates/validate-sphinx-docs"
38+
with:
39+
path: ./libc/docs
40+
41+
- name: Check libcxx documentation
42+
uses: "./.github/templates/validate-sphinx-docs"
43+
with:
44+
path: ./libcxx/docs
45+
46+
- name: Check libunwind documentation
47+
uses: "./.github/templates/validate-sphinx-docs"
48+
with:
49+
path: ./libunwind/docs
50+
51+
#- name: Check lldb documentation
52+
# uses: "./.github/templates/validate-sphinx-docs"
53+
# with:
54+
# path: ./lldb/docs
55+
56+
- name: Check lld documentation
57+
uses: "./.github/templates/validate-sphinx-docs"
58+
with:
59+
path: ./lld/docs
60+
61+
- name: Check llvm documentation
62+
uses: "./.github/templates/validate-sphinx-docs"
63+
with:
64+
path: ./llvm/docs
65+
66+
- name: Check openmp documentation
67+
uses: "./.github/templates/validate-sphinx-docs"
68+
with:
69+
path: ./openmp/docs
70+
71+
- name: Check polly documentation
72+
uses: "./.github/templates/validate-sphinx-docs"
73+
with:
74+
path: ./polly/docs

.github/workflows/release-tasks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
doxygen \
3232
graphviz \
3333
python3-github \
34-
python3-recommonmark \
34+
python3-myst-parser \
3535
python3-sphinx \
3636
ninja-build \
3737
texlive-font-utils

clang/docs/conf.py

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,11 @@
3232
# Add any paths that contain templates here, relative to this directory.
3333
templates_path = ["_templates"]
3434

35-
# The suffix of source filenames.
36-
source_suffix = {
37-
".rst": "restructuredtext",
38-
}
3935

40-
try:
41-
import recommonmark
42-
except ImportError:
43-
# manpages do not use any .md sources
44-
if not tags.has("builder-man"):
45-
raise
46-
else:
47-
import sphinx
48-
49-
if sphinx.version_info >= (3, 0):
50-
# This requires 0.5 or later.
51-
extensions.append("recommonmark")
52-
else:
53-
source_parsers = {".md": "recommonmark.parser.CommonMarkParser"}
54-
source_suffix[".md"] = "markdown"
36+
import sphinx
37+
38+
if sphinx.version_info >= (3, 0):
39+
extensions.append("myst_parser")
5540

5641
# The encoding of source files.
5742
# source_encoding = 'utf-8-sig'

flang/docs/conf.py

Lines changed: 4 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,14 @@
99
# All configuration values have a default; values that are commented out
1010
# serve to show the default.
1111

12-
import sys, os
1312
from datetime import date
14-
from recommonmark.parser import CommonMarkParser
15-
1613
# If extensions (or modules to document with autodoc) are in another directory,
1714
# add these directories to sys.path here. If the directory is relative to the
1815
# documentation root, use os.path.abspath to make it absolute, like shown here.
1916
# sys.path.insert(0, os.path.abspath('.'))
2017

2118
# -- General configuration -----------------------------------------------------
2219

23-
# https://github.com/readthedocs/recommonmark/issues/177
24-
# Method used to remove the warning message.
25-
class CustomCommonMarkParser(CommonMarkParser):
26-
def visit_document(self, node):
27-
pass
28-
29-
3020
# If your documentation needs a minimal Sphinx version, state it here.
3121
# needs_sphinx = '1.0'
3222
# Add any Sphinx extension module names here, as strings. They can be extensions
@@ -36,49 +26,11 @@ def visit_document(self, node):
3626
# Add any paths that contain templates here, relative to this directory.
3727
templates_path = ["_templates"]
3828

39-
# The suffix of source filenames.
40-
source_suffix = {
41-
".rst": "restructuredtext",
42-
}
43-
try:
44-
import recommonmark
45-
except ImportError:
46-
# manpages do not use any .md sources
47-
if not tags.has("builder-man"):
48-
raise
49-
else:
50-
import sphinx
51-
52-
if sphinx.version_info >= (3, 0):
53-
# This requires 0.5 or later.
54-
extensions.append("recommonmark")
55-
else:
56-
source_parsers = {".md": CustomCommonMarkParser}
57-
source_suffix[".md"] = "markdown"
58-
extensions.append("sphinx_markdown_tables")
59-
60-
# Setup AutoStructify for inline .rst toctrees in index.md
61-
from recommonmark.transform import AutoStructify
62-
63-
# Stolen from https://github.com/readthedocs/recommonmark/issues/93
64-
# Monkey patch to fix recommonmark 0.4 doc reference issues.
65-
from recommonmark.states import DummyStateMachine
66-
67-
orig_run_role = DummyStateMachine.run_role
68-
69-
def run_role(self, name, options=None, content=None):
70-
if name == "doc":
71-
name = "any"
72-
return orig_run_role(self, name, options, content)
73-
74-
DummyStateMachine.run_role = run_role
75-
76-
def setup(app):
77-
# Disable inline math to avoid
78-
# https://github.com/readthedocs/recommonmark/issues/120 in Extensions.md
79-
app.add_config_value("recommonmark_config", {"enable_inline_math": False}, True)
80-
app.add_transform(AutoStructify)
29+
import sphinx
8130

31+
if sphinx.version_info >= (3, 0):
32+
extensions.append("myst_parser")
33+
extensions.append("sphinx_markdown_tables")
8234

8335
# The encoding of source files.
8436
# source_encoding = 'utf-8-sig'

lldb/docs/conf.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010
#
1111
# All configuration values have a default; values that are commented out
1212
# serve to show the default.
13+
import pathlib
1314
import sys, os, re, shutil
1415
from datetime import date
1516

1617
building_man_page = tags.has("builder-man")
18+
SWIG_MODULE = os.getenv("LLDB_SWIG_MODULE")
1719

1820
# For the website we need to setup the path to the generated LLDB module that
1921
# we can generate documentation for its API.
@@ -24,10 +26,11 @@
2426

2527
# Add the current directory that contains the mock _lldb native module which
2628
# is imported by the `lldb` module.
27-
sys.path.insert(0, os.path.abspath("."))
29+
sys.path.insert(0, pathlib.Path(__file__).parent.resolve())
2830
# Add the build directory that contains the `lldb` module. LLDB_SWIG_MODULE is
2931
# set by CMake.
30-
sys.path.insert(0, os.getenv("LLDB_SWIG_MODULE"))
32+
if SWIG_MODULE:
33+
sys.path.insert(0, SWIG_MODULE)
3134

3235
# Put the generated Python API documentation in the 'python_api' folder. This
3336
# also defines the URL these files will have in the generated website.
@@ -113,7 +116,7 @@
113116
# Without this we will get a lot of warnings about doc pages that aren't
114117
# included by any doctree (as the manpage ignores those pages but they are
115118
# potentially still around from a previous website generation).
116-
if building_man_page:
119+
if not SWIG_MODULE or building_man_page :
117120
exclude_patterns.append(automodapi_toctreedirnm)
118121
# Use the recommended 'any' rule so that referencing SB API classes is possible
119122
# by just writing `SBData`.
@@ -176,7 +179,7 @@
176179

177180
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
178181
# using the given strftime format.
179-
html_last_updated_fmt = "%b %d, %Y"
182+
# html_last_updated_fmt = "%b %d, %Y"
180183

181184
# If true, SmartyPants will be used to convert quotes and dashes to
182185
# typographically correct entities.

llvm/docs/MarkdownQuickstartTemplate.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,10 @@ without any syntax highlighting like this:
151151

152152
If you need to do fancier things than what has been shown in this document,
153153
you can mail the list or check the [Common Mark spec]. Sphinx specific
154-
integration documentation can be found in the [recommonmark docs].
154+
integration documentation can be found in the [myst-parser docs].
155155

156156
[Common Mark spec]: http://spec.commonmark.org/0.28/
157-
[recommonmark docs]: http://recommonmark.readthedocs.io/en/latest/index.html
157+
[myst-parser docs]: https://myst-parser.readthedocs.io/en/latest/
158158

159159
## Generating the documentation
160160

llvm/docs/SphinxQuickstartTemplate.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,19 +172,19 @@ You can generate the HTML documentation from the sources locally if you want to
172172
see what they would look like. In addition to the normal
173173
`build tools <docs/GettingStarted.html>`_
174174
you need to install `Sphinx`_ and the
175-
`recommonmark <https://recommonmark.readthedocs.io/en/latest/>`_ extension.
175+
`myst-parser <https://myst-parser.readthedocs.io/en/latest/>`_ extension.
176176

177177
On Debian you can install these with:
178178

179179
.. code-block:: console
180180
181-
sudo apt install -y sphinx-doc python-recommonmark-doc
181+
sudo apt install -y sphinx-doc python3-myst-parser
182182
183-
On Ubuntu use pip to get an up-to-date version of recommonmark:
183+
On Ubuntu use pip to get an up-to-date version of python3-myst-parser:
184184

185185
.. code-block:: console
186186
187-
sudo pip install sphinx recommonmark
187+
sudo pip install sphinx myst-parser
188188
189189
Then run cmake to build the documentation inside the ``llvm-project`` checkout:
190190

llvm/docs/conf.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,11 @@
3636
".rst": "restructuredtext",
3737
}
3838

39-
try:
40-
import recommonmark
41-
except ImportError:
42-
# manpages do not use any .md sources
43-
if not tags.has("builder-man"):
44-
raise
45-
else:
46-
import sphinx
47-
48-
if sphinx.version_info >= (3, 0):
49-
# This requires 0.5 or later.
50-
extensions.append("recommonmark")
51-
else:
52-
source_parsers = {".md": "recommonmark.parser.CommonMarkParser"}
53-
source_suffix[".md"] = "markdown"
39+
import sphinx
40+
41+
if sphinx.version_info >= (3, 0):
42+
extensions.append("myst_parser")
43+
extensions.append("sphinx_markdown_tables")
5444

5545
# The encoding of source files.
5646
# source_encoding = 'utf-8-sig'

llvm/utils/release/build-docs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# ninja-build gcc-c++
1616
# * pip install sphinx-markdown-tables
1717
# * Ubuntu:
18-
# * apt-get install doxygen sphinx-common python3-recommonmark \
18+
# * apt-get install doxygen sphinx-common python3-myst-parser \
1919
# ninja-build graphviz texlive-font-utils
2020
# * pip install sphinx-markdown-tables
2121
#===------------------------------------------------------------------------===#

0 commit comments

Comments
 (0)