Skip to content

Commit 2a4e574

Browse files
build napari-docs on theme PR (#156)
* build napari-docs on theme PR * ensure we clone the theme repo * remove doctrees before uploading artifact * v4 of upload action * fix .doctrees path
1 parent ba199de commit 2a4e574

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed

.github/workflows/build_napari.yml

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Build napari Docs on PR
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
build-and-upload:
15+
name: Build & Upload Artifact
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Clone napari-sphinx-theme
19+
uses: actions/checkout@v4
20+
21+
- name: Clone napari docs repo
22+
uses: actions/checkout@v4
23+
with:
24+
repository: napari/docs
25+
path: napari-docs # place in a named directory
26+
27+
- name: Clone napari repo
28+
uses: actions/checkout@v4
29+
with:
30+
path: napari # place in a named directory
31+
repository: napari/napari
32+
# ensure version metadata is proper
33+
fetch-depth: 0
34+
35+
- uses: actions/setup-python@v5
36+
with:
37+
python-version: "3.10"
38+
cache-dependency-path: |
39+
napari/setup.cfg
40+
docs/requirements.txt
41+
42+
- uses: tlambert03/setup-qt-libs@v1
43+
44+
- name: Install napari Dependencies
45+
run: |
46+
python -m pip install --upgrade pip
47+
python -m pip install "napari/[all]"
48+
env:
49+
PIP_CONSTRAINT: ${{ github.workspace }}/napari/resources/constraints/constraints_py3.10_docs.txt
50+
51+
- name: Testing
52+
run: |
53+
python -c 'import napari; print(napari.__version__)'
54+
python -c 'import napari.layers; print(napari.layers.__doc__)'
55+
56+
- name: Install napari-docs Dependencies
57+
run: |
58+
python -m pip install -qr ${{ github.workspace }}/napari-docs/requirements.txt
59+
env:
60+
PIP_CONSTRAINT: ${{ github.workspace }}/napari/resources/constraints/constraints_py3.10_docs.txt
61+
62+
# Build and install the theme package.
63+
- name: Build and install theme
64+
env:
65+
ENV: prod
66+
run: |
67+
pip install --upgrade build ".[doc]"
68+
python -m build
69+
pip install dist/napari_sphinx_theme*.whl
70+
71+
- name: Build Docs
72+
uses: aganders3/headless-gui@v2
73+
env:
74+
GOOGLE_CALENDAR_ID: ${{ secrets.GOOGLE_CALENDAR_ID }}
75+
GOOGLE_CALENDAR_API_KEY: ${{ secrets.GOOGLE_CALENDAR_API_KEY }}
76+
PIP_CONSTRAINT: ${{ github.workspace }}/napari/resources/constraints/constraints_py3.10_docs.txt
77+
with:
78+
# using html instead of docs will skip installing requirements
79+
run: make -C napari-docs html
80+
# skipping setup stops the action from running the default (tiling) window manager
81+
# the window manager is not necessary for docs builds at this time and it was causing
82+
# problems with screenshots (https://github.com/napari/docs/issues/285)
83+
linux-setup: "echo 'skip setup'"
84+
linux-teardown: "echo 'skip teardown'"
85+
86+
- name: remove .doctrees folder (400Mb)
87+
run: rm -rf napari-docs/docs/_build/.doctrees
88+
89+
- name: Upload artifact
90+
uses: actions/upload-artifact@v4
91+
with:
92+
name: napari-docs
93+
path: napari-docs/docs/_build

0 commit comments

Comments
 (0)