Skip to content

Commit f6edfa5

Browse files
committed
ci: build api docs workflow (cross-os)
1 parent adc7e02 commit f6edfa5

File tree

2 files changed

+143
-18
lines changed

2 files changed

+143
-18
lines changed

.github/workflows/python-api-docs.yaml

Lines changed: 142 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,51 +9,176 @@ on:
99
permissions: {}
1010

1111
jobs:
12-
build-docs:
13-
name: "Build and Upload API Documentation"
12+
build-manylinux_2_28-x86_64-api-docs:
13+
name: "Build and upload docs on Manylinux 2.28 x86_64"
1414
runs-on: ubuntu-24.04
1515
container:
1616
image: quay.io/pypa/manylinux_2_28_x86_64
1717
env:
1818
PLAT: manylinux_2_28_x86_64
19-
PYBIN: "/opt/python/cp310-cp310/bin"
19+
PYBIN: "/opt/python/${{ matrix.python }}/bin"
20+
strategy:
21+
matrix:
22+
python:
23+
- cp310-cp310
24+
- cp311-cp311
25+
- cp312-cp312
26+
- cp313-cp313
2027
steps:
2128
- name: "Checkout"
2229
uses: actions/checkout@v4
2330
with:
2431
submodules: recursive
2532
persist-credentials: false
2633
fetch-depth: 0
27-
34+
35+
- name: "Configure Git safe directory"
36+
run: git config --global --add safe.directory /__w/bdk-python/bdk-python
37+
2838
- name: "Install Rust 1.84.1"
2939
uses: actions-rs/toolchain@v1
3040
with:
3141
toolchain: 1.84.1
3242

33-
- name: "Configure Git safe directory"
34-
run: git config --global --add safe.directory /__w/bdk-python/bdk-python
35-
36-
- name: "Set up Python"
43+
- name: "Generate bdk.py"
44+
run: bash ./scripts/generate-linux.sh
45+
46+
- name: "Install Sphinx and Theme"
47+
run: ${PYBIN}/pip install sphinx sphinx_rtd_theme
48+
49+
- name: "Generate python API Documentation"
50+
run: |
51+
${PYBIN}/python ./docs/generate_docs.py
52+
53+
- name: "Build HTML Documentation"
54+
run: |
55+
${PYBIN}/python -m sphinx -b html -W --keep-going docs/source docs/_build/html
56+
- name: "Upload API Docs"
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: bdkpython-manylinux_2_28_x86_64-${{ matrix.python }}-api-docs
60+
path: /home/runner/work/bdk-python/bdk-python/docs/_build/html
61+
62+
build-macos-arm64-api-docs:
63+
name: "Build and upload docs on macOS arm64"
64+
runs-on: macos-14
65+
strategy:
66+
matrix:
67+
python:
68+
- "3.10"
69+
- "3.11"
70+
- "3.12"
71+
- "3.13"
72+
steps:
73+
- name: "Checkout"
74+
uses: actions/checkout@v4
75+
with:
76+
submodules: recursive
77+
persist-credentials: false
78+
fetch-depth: 0
79+
80+
- name: "Install Python"
3781
uses: actions/setup-python@v4
3882
with:
39-
python-version: '3.10'
83+
python-version: ${{ matrix.python }}
84+
85+
- name: "Generate bdk.py"
86+
run: bash ./scripts/generate-macos-arm64.sh
4087

4188
- name: "Install Sphinx and Theme"
42-
run: |
43-
${PYBIN}/python -m pip install --upgrade pip
44-
${PYBIN}/pip install sphinx sphinx_rtd_theme
89+
run: pip3 install sphinx sphinx_rtd_theme
4590

4691
- name: "Generate python API Documentation"
4792
run: |
48-
bash ./scripts/generate-linux.sh
49-
${PYBIN}/python docs/generate_docs.py
93+
python3 ./docs/generate_docs.py
5094
5195
- name: "Build HTML Documentation"
5296
run: |
53-
${PYBIN}/sphinx-build -b html -W --keep-going docs/source docs/_build/html
97+
python3 -c "import platform; print(platform.machine())"
98+
python3 -m sphinx -b html -W --keep-going -v docs/source docs/_build/html
99+
- name: "Upload API Docs"
100+
uses: actions/upload-artifact@v4
101+
with:
102+
name: bdkpython-macos-arm64-${{ matrix.python }}-api-docs
103+
path: /Users/runner/work/bdk-python/bdk-python/docs/_build/html
104+
105+
build-macos-x86_64-api-docs:
106+
name: "Build and upload docs on macOS x86_64"
107+
runs-on: macos-13
108+
strategy:
109+
matrix:
110+
python:
111+
- "3.10"
112+
- "3.11"
113+
- "3.12"
114+
- "3.13"
115+
steps:
116+
- name: "Checkout"
117+
uses: actions/checkout@v4
118+
with:
119+
submodules: recursive
120+
persist-credentials: false
121+
fetch-depth: 0
122+
123+
- uses: actions/setup-python@v4
124+
with:
125+
python-version: ${{ matrix.python }}
126+
127+
- name: "Generate bdk.py"
128+
run: bash ./scripts/generate-macos-x86_64.sh
129+
130+
- name: "Install Sphinx and Theme"
131+
run: pip3 install sphinx sphinx_rtd_theme
132+
133+
- name: "Generate python API Documentation"
134+
run: |
135+
python3 ./docs/generate_docs.py
136+
- name: "Build HTML Documentation"
137+
run: python3 -m sphinx -b html -W --keep-going docs/source docs/_build/html
138+
139+
- name: "Upload API Docs"
140+
uses: actions/upload-artifact@v4
141+
with:
142+
name: bdkpython-macos-x86_64-${{ matrix.python }}
143+
path: /Users/runner/work/bdk-python/bdk-python/docs/_build/html
144+
145+
build-windows-api-docs:
146+
name: "Build and upload docs on Windows"
147+
runs-on: windows-2022
148+
strategy:
149+
matrix:
150+
python:
151+
- "3.10"
152+
- "3.11"
153+
- "3.12"
154+
- "3.13"
155+
steps:
156+
- name: "Checkout"
157+
uses: actions/checkout@v4
158+
with:
159+
submodules: recursive
160+
persist-credentials: false
161+
fetch-depth: 0
162+
163+
- name: "Install Python"
164+
uses: actions/setup-python@v4
165+
with:
166+
python-version: ${{ matrix.python }}
167+
168+
- name: "Generate bdk.py"
169+
run: bash ./scripts/generate-windows.sh
170+
171+
- name: "Install Sphinx and Theme"
172+
run: pip install sphinx sphinx_rtd_theme
173+
174+
- name: "Generate python API Documentation"
175+
run: |
176+
python ./docs/generate_docs.py
177+
- name: "Build HTML Documentation"
178+
run: python -m sphinx -b html -W --keep-going docs/source docs/_build/html
54179

55180
- name: "Upload API Docs"
56181
uses: actions/upload-artifact@v4
57182
with:
58-
name: artifact-python-api-docs
59-
path: /home/runner/work/bdk-python/bdk-python/docs/_build/html
183+
name: bdkpython-windows-${{ matrix.python }}
184+
path: D:\a\bdk-python\bdk-python\docs/_build/html

docs/generate_docs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
module_path = os.path.relpath(os.path.join(root, file), src_dir)
2727
module_path = module_path.replace(os.sep, '.').removesuffix('.py')
2828
full_module = f'{package_root}.{module_path}'
29-
with open(os.path.join(root, file), 'r') as f:
29+
with open(os.path.join(root, file), 'r', encoding='utf-8') as f:
3030
for line in f:
3131
match = class_pattern.match(line)
3232
if match:

0 commit comments

Comments
 (0)