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
87 changes: 8 additions & 79 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,85 +27,14 @@ concurrency:
jobs:
build-and-upload:
name: Build & Upload Artifact
runs-on: ubuntu-latest
env:
XDG_CACHE_HOME: ${{ github.workspace }}/.cache
steps:
- name: Clone docs repo
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
# place in '/home/runner/work/docs/docs/docs'
path: docs # place in a named directory

- name: Clone main repo
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
# place in '/home/runner/work/docs/docs/napari'
path: napari # place in a named directory
repository: napari/napari
# ensure version metadata is proper
fetch-depth: 0

- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: "3.12"
cache-dependency-path: |
napari/pyproject.toml

- name: Cache pooch downloads
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # 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@7d84ae825e6d9297a8e99bdbbae20d1b919a0b19 # v4.2
with:
qt: true
wm: herbstluftwm

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install "napari/[pyqt5, docs]"
env:
PIP_CONSTRAINT: ${{ github.workspace }}/napari/resources/constraints/constraints_py3.12_docs.txt

- name: Testing
run: |
python -c 'import napari; print(napari.__version__)'
python -c 'import napari.layers; print(napari.layers.__doc__)'

- name: Create fallback videos
run: |
sudo apt-get update && sudo apt-get install -y ffmpeg
cd docs
make fallback-videos

- name: Build Docs
run: make -C docs html
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

- name: Upload artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: html
path: docs/docs/_build/html/

- name: Upload logs
if: failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2

with:
name: Upload Logs
path: |
/tmp/*.log
uses: napari/shared-workflows/.github/workflows/build_docs.yml@main
secrets: inherit
with:
main-repo: "napari/napari"
main-ref: "main"
docs-repo: ${{ github.repository }}
docs-ref: ${{ github.ref }}
make_target: "html"

deploy:
name: Download & Deploy Artifact
Expand Down
100 changes: 9 additions & 91 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# As much as possible, this file should be kept in sync with
# https://github.com/napari/docs/blob/main/.github/workflows/build_and_deploy_docs.yml
name: Build PR Docs

on:
Expand All @@ -12,98 +10,18 @@ on:
description: "Enter make target: html html-noplot docs slimfast slimgallery"
type: string
default: "slimfast"
workflow_call:
inputs:
make_target:
description: "Enter make target: html html-noplot docs slimfast slimgallery"
type: string
default: "slimfast"
pr_number:
description: "PR number"
type: string
required: false

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-and-upload:
name: Build & Upload Artifact
runs-on: ubuntu-latest
env:
XDG_CACHE_HOME: ${{ github.workspace }}/.cache
steps:
- name: Clone docs repo
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
# Check out to '/home/runner/work/docs/docs/docs'
path: docs
ref: ${{ inputs.pr_number && format('refs/pull/{0}/merge', inputs.pr_number) || github.ref }}


- name: Clone main repo
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
# Check out to '/home/runner/work/docs/docs/napari'
path: napari
repository: napari/napari
# fetch history ensure napari version metadata is read properly
fetch-depth: 0

- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: "3.12"
cache-dependency-path: |
napari/pyproject.toml

- name: Cache pooch downloads
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # 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@7d84ae825e6d9297a8e99bdbbae20d1b919a0b19 # v4.2
with:
qt: true
wm: herbstluftwm

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install "napari/[pyqt5, docs]"
env:
PIP_CONSTRAINT: ${{ github.workspace }}/napari/resources/constraints/constraints_py3.12_docs.txt

- name: Check napari can be imported
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 || 'slimfast' }}
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

- name: Upload artifact
id: upload
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: docs
path: docs/docs/_build/html

- name: Upload logs
if: failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2

with:
name: Upload Logs
path: |
/tmp/*.log
artifact-build:
uses: napari/shared-workflows/.github/workflows/build_docs.yml@main
secrets: inherit
with:
main-repo: "napari/napari"
main-ref: "main"
docs-repo: ${{ github.repository }}
docs-ref: ${{ github.ref }}
make_target: ${{ inputs.make_target || 'slimfast' }}
7 changes: 6 additions & 1 deletion .github/workflows/label_triggered_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ on:
jobs:
full-artifact-build:
if: contains(github.event.pull_request.labels.*.name, 'ready to merge')
uses: ./.github/workflows/build_docs.yml
uses: napari/shared-workflows/.github/workflows/build_docs.yml@main
secrets: inherit
with:
main-repo: "napari/napari"
main-ref: "main"
docs-repo: ${{ github.repository }}
docs-ref: ${{ github.ref }}
make_target: "html"

report-artifact-status:
Expand Down
20 changes: 17 additions & 3 deletions .github/workflows/triggered_target_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: Trigger target build of docs
# If started by a comment, the workflow runs on the PR branch and updates the PR status.
# Note: This workflow runs only once per trigger and does not execute on every push to the PR branch.
# This workflow triggers both the CircleCI doc build, using CircleCI-Public/trigger-circleci-pipeline-action.
# as well as an artifact build using the reusable workflow: .github/build_docs.yml
# as well as an artifact build using the reusable workflow from napari/shared-workflows.

on:
issue_comment:
Expand All @@ -30,6 +30,7 @@ jobs:
pr_ref: ${{ steps.get-pr-info.outputs.pr_ref }}
pr_sha: ${{ steps.get-pr-info.outputs.pr_sha }}
pr_number: ${{ steps.get-pr-info.outputs.pr_number }}
docs_ref: ${{ steps.set-docs-ref.outputs.docs_ref }}
if: |
(github.event_name == 'issue_comment' &&
github.event.issue.pull_request != '' &&
Expand Down Expand Up @@ -85,6 +86,15 @@ jobs:
core.setOutput('pr_ref', pr.data.head.ref);
core.setOutput('pr_sha', pr.data.head.sha);
core.setOutput('pr_number', context.issue.number);

- name: Set docs ref
id: set-docs-ref
run: |
if [ "${{ github.event_name }}" = "issue_comment" ]; then
echo "docs_ref=refs/pull/${{ github.event.issue.number }}/merge" >> "$GITHUB_OUTPUT"
else
echo "docs_ref=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
fi

trigger-circleci:
needs: determine-make-target
Expand All @@ -100,10 +110,14 @@ jobs:

trigger-artifact-build:
needs: determine-make-target
uses: ./.github/workflows/build_docs.yml
uses: napari/shared-workflows/.github/workflows/build_docs.yml@main
secrets: inherit
with:
main-repo: "napari/napari"
main-ref: "main"
docs-repo: ${{ github.repository }}
docs-ref: ${{ needs.determine-make-target.outputs.docs_ref }}
make_target: ${{ needs.determine-make-target.outputs.target }}
pr_number: ${{ needs.determine-make-target.outputs.pr_number }}

report-artifact-status:
# reusable workflows can't be a step in a job
Expand Down
Loading