|
| 1 | +name: build docs (linux) |
| 2 | + |
| 3 | +defaults: |
| 4 | + run: |
| 5 | + shell: bash -l -exo pipefail {0} |
| 6 | + |
| 7 | +on: |
| 8 | + workflow_dispatch: |
| 9 | + pull_request: |
| 10 | + paths: |
| 11 | + - "docs/**" |
| 12 | + - "python/**" |
| 13 | + - "CMakeLists.txt" |
| 14 | + - "cmake/**" |
| 15 | + - ".github/workflows/build-docs-linux.yml" |
| 16 | + push: |
| 17 | + branches: |
| 18 | + - main |
| 19 | + |
| 20 | +permissions: |
| 21 | + contents: read |
| 22 | + |
| 23 | +jobs: |
| 24 | + build-docs: |
| 25 | + if: github.repository == 'oleksandr-pavlyk/nvbench' |
| 26 | + runs-on: ubuntu-latest |
| 27 | + steps: |
| 28 | + - name: Checkout |
| 29 | + uses: actions/checkout@v4 |
| 30 | + |
| 31 | + - name: Setup Miniconda |
| 32 | + uses: conda-incubator/setup-miniconda@v3 |
| 33 | + with: |
| 34 | + miniforge-version: "latest" |
| 35 | + channels: conda-forge |
| 36 | + auto-activate-base: false |
| 37 | + |
| 38 | + - name: Create docs environment |
| 39 | + 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 |
| 40 | + |
| 41 | + - name: Install Python dependencies |
| 42 | + run: | |
| 43 | + conda activate nvbench-docs |
| 44 | + pip install breathe sphinx nvidia-sphinx-theme myst-parser docutils |
| 45 | + pip install cython scikit-build-core setuptools-scm typing-extensions cuda-bindings |
| 46 | +
|
| 47 | + - name: Build/Install cuda.bench |
| 48 | + run: | |
| 49 | + conda activate nvbench-docs |
| 50 | + cd python |
| 51 | + rm -rf build |
| 52 | + python -m pip install --no-build-isolation --no-deps --verbose . |
| 53 | +
|
| 54 | + - name: Build documentation |
| 55 | + run: | |
| 56 | + conda activate nvbench-docs |
| 57 | + cd docs |
| 58 | + ./build_combined_docs.sh |
| 59 | +
|
| 60 | + - name: Upload documentation artifact |
| 61 | + uses: actions/upload-artifact@v4 |
| 62 | + with: |
| 63 | + name: docs-html |
| 64 | + path: docs/sphinx-combined/_build |
| 65 | + |
| 66 | + comment-docs: |
| 67 | + if: github.repository == 'oleksandr-pavlyk/nvbench' && github.event_name == 'pull_request' |
| 68 | + needs: build-docs |
| 69 | + runs-on: ubuntu-latest |
| 70 | + permissions: |
| 71 | + pull-requests: write |
| 72 | + steps: |
| 73 | + - name: Comment on pull request with artifact link |
| 74 | + uses: actions/github-script@v7 |
| 75 | + with: |
| 76 | + script: | |
| 77 | + const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`; |
| 78 | + const body = `Documentation artifact "docs-html" is available for this run: ${runUrl}`; |
| 79 | + await github.rest.issues.createComment({ |
| 80 | + owner: context.repo.owner, |
| 81 | + repo: context.repo.repo, |
| 82 | + issue_number: context.issue.number, |
| 83 | + body, |
| 84 | + }); |
0 commit comments