Skip to content

Commit e91fb24

Browse files
committed
build docs dynamically
1 parent ad663cb commit e91fb24

File tree

8 files changed

+227
-169
lines changed

8 files changed

+227
-169
lines changed

.github/workflows/build.yml

Lines changed: 71 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
test:
1717
runs-on: ubuntu-20.04
1818
outputs:
19+
docs-build: ${{ steps.set-matrix.outputs.docs-build }}
1920
arm-boards: ${{ steps.set-matrix.outputs.arm-boards }}
2021
riscv-boards: ${{ steps.set-matrix.outputs.riscv-boards }}
2122
espressif-boards: ${{ steps.set-matrix.outputs.espressif-boards }}
@@ -41,37 +42,14 @@ jobs:
4142
run: |
4243
sudo apt-get update
4344
sudo apt-get install -y eatmydata
44-
sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64 latexmk texlive-fonts-recommended texlive-latex-recommended texlive-latex-extra gcc-aarch64-linux-gnu
45-
pip install -r requirements-dev.txt
45+
sudo eatmydata apt-get install -y gettext gcc-aarch64-linux-gnu mingw-w64
46+
pip install -r requirements-ci.txt -r requirements-dev.txt
4647
- name: Versions
4748
run: |
4849
gcc --version
4950
python3 --version
5051
- name: Duplicate USB VID/PID Check
5152
run: python3 -u -m tools.ci_check_duplicate_usb_vid_pid
52-
- name: Build and Validate Stubs
53-
run: make check-stubs -j2
54-
- uses: actions/upload-artifact@v2
55-
with:
56-
name: stubs
57-
path: circuitpython-stubs/dist/*
58-
- name: Install pypi dependencies
59-
run: |
60-
python -m pip install --upgrade pip
61-
pip install setuptools wheel twine
62-
- name: Test Documentation Build (HTML)
63-
run: sphinx-build -E -W -b html -D version=${{ env.CP_VERSION }} -D release=${{ env.CP_VERSION }} . _build/html
64-
- uses: actions/upload-artifact@v2
65-
with:
66-
name: docs
67-
path: _build/html
68-
- name: Test Documentation Build (LaTeX/PDF)
69-
run: |
70-
make latexpdf
71-
- uses: actions/upload-artifact@v2
72-
with:
73-
name: docs
74-
path: _build/latex
7553
- name: Build mpy-cross
7654
run: make -C mpy-cross -j2
7755
- name: Build unix port
@@ -130,39 +108,22 @@ jobs:
130108
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static.exe s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-x64-windows-${{ env.CP_VERSION }}.exe --no-progress --region us-east-1
131109
zip -9r circuitpython-stubs.zip circuitpython-stubs
132110
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp circuitpython-stubs/dist/*.tar.gz s3://adafruit-circuit-python/bin/stubs/circuitpython-stubs-${{ env.CP_VERSION }}.zip --no-progress --region us-east-1
133-
134-
- name: Upload stubs to PyPi
135-
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner == 'adafruit'
136-
env:
137-
TWINE_USERNAME: ${{ secrets.pypi_username }}
138-
TWINE_PASSWORD: ${{ secrets.pypi_password }}
139-
run: |
140-
# setup.py sdist was run by 'make stubs'
141-
[ -z "$TWINE_USERNAME" ] || echo "Uploading dev release to PyPi"
142-
[ -z "$TWINE_USERNAME" ] || twine upload circuitpython-stubs/dist/*
143-
- uses: dorny/paths-filter@v2
111+
- name: "Get changes"
112+
uses: dorny/paths-filter@v2
144113
id: filter
145114
with:
146-
# Enable listing of files matching each filter.
147-
# Paths to files will be available in `${FILTER_NAME}_files` output variable.
148-
# Paths will be formatted as JSON array
149115
list-files: json
150-
151-
# Compare against this branch. (Ignored for PRs.)
152116
base: ${{ github.ref }}
153-
154-
# In this example all changed files are passed to the following action to do
155-
# some custom processing.
156117
filters: |
157118
changed:
158119
- '**'
159-
- name: "Set boards to build"
120+
- name: "Set matrix"
160121
id: set-matrix
161122
working-directory: tools
162123
env:
163124
CHANGED_FILES: ${{ steps.filter.outputs.changed_files }}
164-
run: |
165-
python3 -u ci_changed_board_list.py
125+
run: python3 -u ci_set_matrix.py
126+
166127

167128
mpy-cross-mac:
168129
runs-on: macos-10.15
@@ -221,6 +182,62 @@ jobs:
221182
if: (github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner == 'adafruit') || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested'))
222183

223184

185+
build-doc:
186+
runs-on: ubuntu-20.04
187+
needs: test
188+
if: ${{ needs.test.outputs.docs-build == 'True' }}
189+
steps:
190+
- uses: actions/[email protected]
191+
with:
192+
submodules: false
193+
fetch-depth: 0
194+
- name: Populate selected submodules
195+
run: git submodule update --init extmod/ulab
196+
- run: git fetch --recurse-submodules=no https://github.com/adafruit/circuitpython refs/tags/*:refs/tags/*
197+
- name: CircuitPython version
198+
run: |
199+
git describe --dirty --tags
200+
echo >>$GITHUB_ENV CP_VERSION=$(git describe --dirty --tags)
201+
- name: Set up Python 3.8
202+
uses: actions/setup-python@v1
203+
with:
204+
python-version: 3.8
205+
- name: Install deps
206+
run: |
207+
sudo apt-get update
208+
sudo apt-get install -y eatmydata
209+
sudo eatmydata apt-get install -y latexmk librsvg2-bin texlive-fonts-recommended texlive-latex-recommended texlive-latex-extra
210+
pip install -r requirements-ci.txt -r requirements-doc.txt
211+
- name: Build and Validate Stubs
212+
run: make check-stubs -j2
213+
- uses: actions/upload-artifact@v2
214+
with:
215+
name: stubs
216+
path: circuitpython-stubs/dist/*
217+
- name: Test Documentation Build (HTML)
218+
run: sphinx-build -E -W -b html -D version=${{ env.CP_VERSION }} -D release=${{ env.CP_VERSION }} . _build/html
219+
- uses: actions/upload-artifact@v2
220+
with:
221+
name: docs
222+
path: _build/html
223+
- name: Test Documentation Build (LaTeX/PDF)
224+
run: |
225+
make latexpdf
226+
- uses: actions/upload-artifact@v2
227+
with:
228+
name: docs
229+
path: _build/latex
230+
- name: Upload stubs to PyPi
231+
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner == 'adafruit'
232+
env:
233+
TWINE_USERNAME: ${{ secrets.pypi_username }}
234+
TWINE_PASSWORD: ${{ secrets.pypi_password }}
235+
run: |
236+
# setup.py sdist was run by 'make stubs'
237+
[ -z "$TWINE_USERNAME" ] || echo "Uploading dev release to PyPi"
238+
[ -z "$TWINE_USERNAME" ] || twine upload circuitpython-stubs/dist/*
239+
240+
224241
build-arm:
225242
runs-on: ubuntu-20.04
226243
needs: test
@@ -229,7 +246,6 @@ jobs:
229246
matrix:
230247
board: ${{ fromJSON(needs.test.outputs.arm-boards) }}
231248
if: ${{ needs.test.outputs.arm-boards != '[]' }}
232-
233249
steps:
234250
- name: Set up Python 3.8
235251
uses: actions/setup-python@v1
@@ -243,7 +259,7 @@ jobs:
243259
- name: Install deps
244260
run: |
245261
sudo apt-get install -y gettext
246-
pip install -r requirements-dev.txt
262+
pip install -r requirements-ci.txt -r requirements-dev.txt
247263
wget --no-verbose https://adafruit-circuit-python.s3.amazonaws.com/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2
248264
sudo tar -C /usr --strip-components=1 -xaf gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2
249265
- name: Versions
@@ -272,6 +288,7 @@ jobs:
272288
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
273289
if: (github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner == 'adafruit') || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested'))
274290

291+
275292
build-riscv:
276293
runs-on: ubuntu-20.04
277294
needs: test
@@ -280,7 +297,6 @@ jobs:
280297
matrix:
281298
board: ${{ fromJSON(needs.test.outputs.riscv-boards) }}
282299
if: ${{ needs.test.outputs.riscv-boards != '[]' }}
283-
284300
steps:
285301
- name: Set up Python 3.8
286302
uses: actions/setup-python@v1
@@ -294,7 +310,7 @@ jobs:
294310
- name: Install deps
295311
run: |
296312
sudo apt-get install -y gettext
297-
pip install -r requirements-dev.txt
313+
pip install -r requirements-ci.txt -r requirements-dev.txt
298314
wget https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-centos6.tar.gz
299315
sudo tar -C /usr --strip-components=1 -xaf riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-centos6.tar.gz
300316
- name: Versions
@@ -322,6 +338,8 @@ jobs:
322338
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
323339
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
324340
if: (github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner == 'adafruit') || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested'))
341+
342+
325343
build-espressif:
326344
runs-on: ubuntu-20.04
327345
needs: test
@@ -330,7 +348,6 @@ jobs:
330348
matrix:
331349
board: ${{ fromJSON(needs.test.outputs.espressif-boards) }}
332350
if: ${{ needs.test.outputs.espressif-boards != '[]' }}
333-
334351
steps:
335352
- name: Set up Python 3.8
336353
uses: actions/setup-python@v1
@@ -363,11 +380,11 @@ jobs:
363380
env:
364381
IDF_PATH: ${{ github.workspace }}/ports/espressif/esp-idf
365382
IDF_TOOLS_PATH: ${{ github.workspace }}/.idf_tools
366-
- name: Install CircuitPython deps
383+
- name: Install deps
367384
run: |
368385
source $IDF_PATH/export.sh
369-
pip install -r requirements-dev.txt
370386
sudo apt-get install -y gettext ninja-build
387+
pip install -r requirements-ci.txt -r requirements-dev.txt
371388
env:
372389
IDF_PATH: ${{ github.workspace }}/ports/espressif/esp-idf
373390
IDF_TOOLS_PATH: ${{ github.workspace }}/.idf_tools

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ stubs:
260260
@$(PYTHON) tools/extract_pyi.py shared-bindings/ $(STUBDIR)
261261
@$(PYTHON) tools/extract_pyi.py extmod/ulab/code/ $(STUBDIR)/ulab
262262
@$(PYTHON) tools/extract_pyi.py ports/atmel-samd/bindings $(STUBDIR)
263+
@$(PYTHON) tools/extract_pyi.py ports/espressif/bindings $(STUBDIR)
263264
@$(PYTHON) tools/extract_pyi.py ports/raspberrypi/bindings $(STUBDIR)
264265
@cp setup.py-stubs circuitpython-stubs/setup.py
265266
@cp README.rst-stubs circuitpython-stubs/README.rst

ports/espressif/bindings/espidf/__init__.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,10 @@ const mp_obj_type_t mp_type_espidf_IDFError = {
110110
};
111111

112112

113-
//| class MemoryError(MemoryError):
114-
//| """Raised when an ESP IDF memory allocation fails."""
115-
//| ...
116-
//|
113+
// class MemoryError(MemoryError):
114+
// """Raised when an ESP IDF memory allocation fails."""
115+
// ...
116+
//
117117
NORETURN void mp_raise_espidf_MemoryError(void) {
118118
nlr_raise(mp_obj_new_exception(&mp_type_espidf_MemoryError));
119119
}

requirements-ci.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# For uploading artifacts
2+
awscli

requirements-dev.txt

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,18 @@ cascadetoml
66
jinja2
77
typer
88

9-
requests
10-
requests-cache
119
sh
1210
click
13-
setuptools
1411
cpp-coveralls
15-
16-
# For docs
17-
Sphinx<4
18-
sphinx-rtd-theme
19-
myst-parser
20-
sphinx-autoapi
21-
sphinxcontrib-svg2pdfconverter
22-
readthedocs-sphinx-search
12+
requests
13+
requests-cache
2314

2415
# For translate check
2516
polib
2617

2718
# For pre-commit
2819
pyyaml
29-
astroid
30-
isort
3120
black
32-
mypy
33-
34-
# For uploading artifacts
35-
awscli
3621

3722
# for combining the Nordic SoftDevice with CircuitPython
3823
intelhex

requirements-doc.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# For docs
2+
mypy
3+
black
4+
isort
5+
twine
6+
wheel
7+
astroid
8+
setuptools
9+
10+
# For sphinx
11+
Sphinx<4
12+
sphinx-autoapi
13+
sphinx-rtd-theme
14+
sphinxcontrib-svg2pdfconverter
15+
readthedocs-sphinx-search
16+
myst-parser

0 commit comments

Comments
 (0)