Add scaffolding to build C++/Python docs #9
Workflow file for this run
This file contains hidden or 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: build docs (linux) | |
| defaults: | |
| run: | |
| shell: bash -l -exo pipefail {0} | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| paths: | |
| - "docs/**" | |
| - "python/**" | |
| - "CMakeLists.txt" | |
| - "cmake/**" | |
| - ".github/workflows/build-docs-linux.yml" | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| jobs: | |
| build-docs: | |
| if: github.repository == 'oleksandr-pavlyk/nvbench' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Miniconda | |
| uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| miniforge-version: "latest" | |
| channels: conda-forge | |
| conda-remove-defaults: true | |
| auto-activate: false | |
| - name: Create docs environment | |
| run: conda create -n nvbench-docs --yes python pip doxygen cuda-nvcc_linux-64 gcc_linux-64 gxx_linux-64 cuda-nvml-dev cuda-profiler-api cmake ninja | |
| - name: Install Python dependencies | |
| run: | | |
| conda activate nvbench-docs | |
| pip install breathe sphinx nvidia-sphinx-theme myst-parser docutils | |
| pip install cython scikit-build-core setuptools-scm typing-extensions cuda-bindings | |
| - name: Build/Install cuda.bench | |
| run: | | |
| conda activate nvbench-docs | |
| cd python | |
| rm -rf build | |
| python -m pip install --no-build-isolation --no-deps --verbose . | |
| - name: Build documentation | |
| run: | | |
| conda activate nvbench-docs | |
| cd docs | |
| ./build_combined_docs.sh | |
| - name: Upload documentation artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: docs-html | |
| path: docs/sphinx-combined/_build | |
| comment-docs: | |
| if: github.repository == 'oleksandr-pavlyk/nvbench' && github.event_name == 'pull_request' | |
| needs: build-docs | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: write | |
| steps: | |
| - name: Comment on pull request with artifact link | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`; | |
| const body = `Documentation artifact "docs-html" is available for this run: ${runUrl}`; | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body, | |
| }); |