Skip to content

Docs

Docs #18

Workflow file for this run

name: Docs
on:
workflow_dispatch:
inputs:
publish:
default: false
type: boolean
version:
description: 'Version of ScippNeutron to use for building the docs. Requires this version to be available on conda-forge! If not set, the current version will be used.'
default: ''
required: false
type: string
branch:
description: 'Branch/tag with documentation source. If not set, the current branch will be used.'
default: ''
required: false
type: string
workflow_call:
inputs:
publish:
default: false
type: boolean
version:
description: 'Version of ScippNeutron to use for building the docs. Requires this version to be available on conda-forge! If not set, the current version will be used.'
default: ''
required: false
type: string
branch:
description: 'Branch/tag with documentation source. If not set, the current branch will be used.'
default: ''
required: false
type: string
linkcheck:
description: 'Run the link checker. If not set the link checker will not be run.'
default: false
required: false
type: boolean
env:
VERSION: ${{ inputs.version }}
jobs:
docs:
name: Build documentation
runs-on: 'ubuntu-24.04'
defaults:
run:
shell: bash -l {0} # required for conda env
env:
ESS_PROTECTED_FILESTORE_USERNAME: ${{ secrets.ESS_PROTECTED_FILESTORE_USERNAME }}
ESS_PROTECTED_FILESTORE_PASSWORD: ${{ secrets.ESS_PROTECTED_FILESTORE_PASSWORD }}
steps:
- run: sudo apt install --yes graphviz pandoc
- uses: actions/checkout@v4
with:
ref: ${{ inputs.branch == '' && github.ref_name || inputs.branch }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0 # history required so cmake can determine version
- uses: mamba-org/setup-micromamba@v2
if: ${{ inputs.version != '' }}
with:
environment-file: .buildconfig/ci-linux.yml
cache-environment: true
create-args: >-
python=3.11
scippneutron==${{ inputs.version }}
- uses: mamba-org/setup-micromamba@v2
if: ${{ inputs.version == '' }}
with:
environment-file: .buildconfig/ci-linux.yml
cache-environment: true
create-args: >-
python=3.11
conda-build
- run: pip install --no-build-isolation --no-deps -e .
if: ${{ inputs.version == '' }}
- run: python -m sphinx -W -v -b doctest -d doctrees docs html
- run: python -m sphinx -W -v -b html -d doctrees docs html
- run: python -m sphinx -W -v -b linkcheck -d doctrees docs html
if: ${{ inputs.linkcheck }}
- run: find html -type f -name "*.ipynb" -not -path "html/_sources/*" -delete
- uses: actions/upload-artifact@v4
id: artifact-upload-step
with:
name: docs_html
path: html/
- run: echo "::notice::https://remote-unzip.deno.dev/${{ github.repository }}/artifacts/${{ steps.artifact-upload-step.outputs.artifact-id }}"
- uses: JamesIves/[email protected]
if: ${{ inputs.publish }}
with:
branch: gh-pages
folder: html
single-commit: true