Check Docs Manually #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check Docs Manually | |
on: | |
workflow_dispatch: | |
inputs: | |
build_plugins: | |
description: 'Build API Docs with Plug-Ins' | |
required: true | |
default: true | |
type: boolean | |
build_examples: | |
description: 'Build API Docs with Examples' | |
required: true | |
default: true | |
type: boolean | |
jobs: | |
api: | |
name: Check API Documentation | |
runs-on: ubuntu-latest | |
env: | |
gh_root: https://github.com/CEA-COSMIC/ | |
tag_path: /archive/refs/tags/ | |
sphinx_opts: -t docs/_templates -feTMo docs/source | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Check Python Version | |
run: python --version | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install pandoc | |
python -m pip install -r docs/requirements.txt | |
python -m pip install . | |
- name: Download plug-ins | |
if: ${{ inputs.build_plugins }} | |
run: | | |
while read _plugin; do | |
plugin_name="$(echo ${_plugin} | awk -F== '{print $1}')" | |
plugin_version="$(echo ${_plugin} | awk -F== '{print $2}')" | |
wget ${gh_root}${plugin_name}${tag_path}${plugin_version}.tar.gz -O ${plugin_name}.tar.gz | |
done < plugins.txt | |
for file in *.tar.gz; do | |
tar xzf "$file"; | |
python -m pip install "$file" | |
done | |
rm *.tar.gz | |
- name: Extract plug-in examples | |
if: ${{ inputs.build_examples }} | |
run: | | |
while read _plugin; do | |
plugin_name="$(echo ${_plugin} | awk -F== '{print $1}')" | |
cp -r ${plugin_name}-*/examples examples/${plugin_name} || echo "Warning: no examples found for ${plugin_name}" | |
done < plugins.txt | |
- name: Build PySAP source files | |
run: sphinx-apidoc ${sphinx_opts} pysap | |
- name: Build plug-in source files | |
if: ${{ inputs.build_plugins }} | |
run: | | |
while read _plugin; do | |
plugin_name="$(echo ${_plugin} | awk -F== '{print $1}')" | |
package_name="$(echo ${plugin_name} | awk -F- '{print $2}')" | |
sphinx-apidoc ${sphinx_opts} ${plugin_name}-*/${package_name} | |
done < plugins.txt | |
- name: Build API documentation | |
run: sphinx-build -E docs/source docs/_build | |
- name: Archive API build | |
uses: actions/upload-artifact@v2 | |
with: | |
name: api-docs | |
retention-days: 14 | |
path: docs/_build |