2023-12-01 17:32:19 +00:00
|
|
|
# Copyright 2022 Google LLC
|
|
|
|
#
|
|
|
|
# Use of this source code is governed by a BSD-style
|
|
|
|
# license that can be found in the LICENSE file or at
|
|
|
|
# https://developers.google.com/open-source/licenses/bsd
|
|
|
|
|
|
|
|
# A reusable workflow to build Packager docs. Leaves docs output in the
|
|
|
|
# "gh-pages" folder. Only runs in Linux due to the dependency on doxygen,
|
|
|
|
# which we install with apt.
|
|
|
|
name: Build Docs
|
|
|
|
|
|
|
|
# Runs when called from another workflow.
|
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
ref:
|
|
|
|
required: true
|
|
|
|
type: string
|
|
|
|
|
|
|
|
# If true, start a debug SSH server on failures.
|
|
|
|
debug:
|
|
|
|
required: false
|
|
|
|
type: boolean
|
|
|
|
default: false
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
docs:
|
|
|
|
name: Build docs
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
2024-05-01 21:20:35 +00:00
|
|
|
sudo apt install -y doxygen graphviz
|
2023-12-01 17:32:19 +00:00
|
|
|
python3 -m pip install \
|
|
|
|
sphinx==7.1.2 \
|
|
|
|
sphinxcontrib.plantuml \
|
|
|
|
recommonmark \
|
|
|
|
cloud_sptheme \
|
|
|
|
breathe
|
|
|
|
|
|
|
|
- name: Checkout code
|
2024-03-05 17:28:51 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-12-01 17:32:19 +00:00
|
|
|
with:
|
|
|
|
ref: ${{ inputs.ref }}
|
|
|
|
|
|
|
|
- name: Generate docs
|
|
|
|
run: |
|
|
|
|
mkdir -p gh-pages
|
|
|
|
mkdir -p build
|
|
|
|
|
|
|
|
# Doxygen must run before Sphinx. Sphinx will refer to
|
|
|
|
# Doxygen-generated output when it builds its own docs.
|
|
|
|
doxygen docs/Doxyfile
|
|
|
|
|
|
|
|
# Now build the Sphinx-based docs.
|
|
|
|
make -C docs/ html
|
|
|
|
|
|
|
|
# Now move the generated outputs.
|
|
|
|
cp -a build/sphinx/html gh-pages/html
|
|
|
|
cp -a build/doxygen/html gh-pages/docs
|
|
|
|
cp docs/index.html gh-pages/index.html
|
|
|
|
|
|
|
|
# Now set permissions on the generated docs.
|
|
|
|
# https://github.com/actions/upload-pages-artifact#file-permissions
|
|
|
|
chmod -R +rX gh-pages/
|
|
|
|
|
|
|
|
- name: Upload docs artifacts
|
2024-03-05 17:28:51 +00:00
|
|
|
uses: actions/upload-pages-artifact@v3
|
2023-12-01 17:32:19 +00:00
|
|
|
with:
|
|
|
|
path: gh-pages
|
|
|
|
|
|
|
|
- name: Debug
|
2024-03-05 17:28:51 +00:00
|
|
|
uses: mxschmitt/action-tmate@v3.17
|
2023-12-01 17:32:19 +00:00
|
|
|
with:
|
|
|
|
limit-access-to-actor: true
|
|
|
|
if: failure() && inputs.debug
|