# Copyright (c) 2022-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# See LICENSE for license information.

# A workflow to trigger the build of TE documentation on GitHub
name: 'Documentation'
on:
  pull_request:
  workflow_dispatch:
  workflow_call:
jobs:
  build_docs:
    name: 'Build'
    runs-on: ubuntu-latest
    steps:
      - name: 'Checkout'
        uses: actions/checkout@v3
      - name: 'Install dependencies'
        run: |
          pip install sphinx==8.1.3 sphinx_rtd_theme==3.0.1 nbsphinx==0.9.5 IPython ipython_genutils==0.2.0 ipywidgets==8.0.2 astroid==3.3.2
          pip install breathe==4.35.0 sphinx-autoapi==3.3.2
          sudo apt-get install -y pandoc graphviz doxygen
          export GIT_SHA=$(git show-ref --hash HEAD)
      - name: 'Build docs'
        run: | # SPHINXOPTS="-W" errors out on warnings
          doxygen docs/Doxyfile
          cd docs
          make html SPHINXOPTS="-W"
      - name: 'Upload docs'
        uses: actions/upload-artifact@v4
        with:
          name: te_docs
          path: docs/_build/html
          retention-days: 7
