Skip to content

Commit ee58af3

Browse files
committed
Copy documentation builder workflow from hpcflow
1 parent 410e103 commit ee58af3

File tree

2 files changed

+85
-0
lines changed

2 files changed

+85
-0
lines changed

.github/problem-matchers/sphinx.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "sphinx-problem-matcher",
5+
"pattern": [
6+
{
7+
"regexp": "^(.*):(\\d+):\\s+(\\w*):\\s+(.*)$",
8+
"file": 1,
9+
"line": 2,
10+
"severity": 3,
11+
"message": 4
12+
}
13+
]
14+
},
15+
{
16+
"owner": "sphinx-problem-matcher-loose",
17+
"pattern": [
18+
{
19+
"_comment": "A bit of a looser pattern, doesn't look for line numbers, just looks for file names relying on them to start with / and end with .rst",
20+
"regexp": "(\/.*\\.rst):\\s+(\\w*):\\s+(.*)$",
21+
"file": 1,
22+
"severity": 2,
23+
"message": 3
24+
}
25+
]
26+
},
27+
{
28+
"owner": "sphinx-problem-matcher-loose-no-severity",
29+
"pattern": [
30+
{
31+
"_comment": "Looks for file names ending with .rst and line numbers but without severity",
32+
"regexp": "^(.*\\.rst):(\\d+):(.*)$",
33+
"file": 1,
34+
"line": 2,
35+
"message": 3
36+
}
37+
]
38+
}
39+
]
40+
}

.github/workflows/doc-build.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Documentation
2+
run-name: doc
3+
env:
4+
PYTHON_VERSION: "3.12"
5+
POETRY_VERSION: "1.4"
6+
on: push
7+
jobs:
8+
sphinx:
9+
# Note that we only do this on one platform and with one Python version
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
- name: Init Python ${{ env.PYTHON_VERSION }}
15+
uses: actions/setup-python@v5
16+
with:
17+
python-version: ${{ env.PYTHON_VERSION }}
18+
- name: Init Poetry ${{ env.POETRY_VERSION }}
19+
run: |
20+
python -m pip install poetry==${{ env.POETRY_VERSION }}
21+
poetry config virtualenvs.in-project true
22+
poetry config installer.modern-installation false
23+
- name: Cache Virtual Environment
24+
uses: actions/cache@v4
25+
with:
26+
path: ./.venv
27+
key: ${{ runner.os }}-sphinx-${{ env.PYTHON_VERSION }}-venv-${{ hashFiles('**/poetry.lock') }}
28+
- name: Install Dependencies
29+
run: |
30+
poetry install --without dev,pyinstaller
31+
- name: Configure Problem Matcher
32+
run: echo "::add-matcher::.github/problem-matchers/sphinx.json"
33+
# See: https://github.com/actions/toolkit/blob/main/docs/problem-matchers.md
34+
# See: https://github.com/python/cpython/pull/20325
35+
- name: Run Sphinx
36+
run: |
37+
poetry run make clean html
38+
working-directory: docs
39+
- name: Upload documentation artifact
40+
uses: actions/upload-artifact@v4
41+
with:
42+
name: matflow-documentation (${{ github.sha }})
43+
path: docs/build/html
44+
if-no-files-found: error
45+
# TODO: Publish the docs to an internal site

0 commit comments

Comments
 (0)