Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/build_PR.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Build Docs (Self)

on:
pull_request:
paths:
- '.github/workflows/build_docs.yml'
- '.github/workflows/build_PR.yml'


jobs:
build-docs:
uses: ./.github/workflows/build_docs.yml
with:
main-repo: napari/napari
main-ref: main
docs-repo: napari/docs
docs-ref: main
87 changes: 87 additions & 0 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Build PR Docs

on:
workflow_call:
inputs:
main-repo:
required: true
type: string
description: 'The main code repository (e.g. napari/napari or napari/docs)'
main-ref:
required: true
type: string
description: 'The ref (branch/sha) to use for the main repo (e.g. PR branch or main)'
docs-repo:
required: true
type: string
description: 'The docs repository (e.g. napari/docs)'
docs-ref:
required: true
type: string
description: 'The ref (branch/sha) to use for the docs repo (e.g. PR branch or main)'
make_target:
description: "Enter make target: html html-noplot docs slimfast slimgallery"
type: string
default: "slimfast"
workflow_dispatch:

jobs:
build-and-upload:
name: Build & Upload Docs Artifact
runs-on: ubuntu-latest
env:
XDG_CACHE_HOME: ${{ github.workspace }}/.cache
steps:
- name: Checkout docs repo
uses: actions/checkout@v5
with:
repository: ${{ inputs.docs-repo }}
ref: ${{ inputs.docs-ref }}
path: docs
- name: Checkout main repo
uses: actions/checkout@v5
with:
repository: ${{ inputs.main-repo }}
ref: ${{ inputs.main-ref }}
path: napari
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v6
with:
version: "latest"
python-version: '3.12'
activate-environment: true
- name: Cache pooch downloads
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/.cache/scikit-image
${{ github.workspace }}/.cache/napari-*
${{ github.workspace }}/.cache/pooch
key: pooch
- name: Setup headless display
uses: pyvista/setup-headless-display-action@v4.2
with:
qt: true
wm: herbstluftwm
- name: Install dependencies

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use uv in these builds?

run: |
uv pip install --upgrade pip
uv pip install "napari/[pyqt5]" --group napari/pyproject.toml:docs
env:
UV_CONSTRAINT: ${{ github.workspace }}/napari/resources/constraints/constraints_py3.12_docs.txt
- name: Test import
run: |
python -c 'import napari; print(napari.__version__)'
python -c 'import napari.layers; print(napari.layers.__doc__)'
- name: Build docs
run: make -C docs ${{ inputs.make_target }}
env:
GOOGLE_CALENDAR_ID: ${{ secrets.GOOGLE_CALENDAR_ID }}
GOOGLE_CALENDAR_API_KEY: ${{ secrets.GOOGLE_CALENDAR_API_KEY }}
PIP_CONSTRAINT: ${{ github.workspace }}/napari/resources/constraints/constraints_py3.12_docs.txt
UV_CONSTRAINT: ${{ github.workspace }}/napari/resources/constraints/constraints_py3.12_docs.txt
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: html
path: docs/docs/_build/html