Skip to content

Commit 4b5375f

Browse files
Add Github Actions workflow to build documentation
1 parent 3426631 commit 4b5375f

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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+
auto-activate-base: false
35+
36+
- name: Create docs environment
37+
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
38+
39+
- name: Install Python dependencies
40+
run: |
41+
conda activate nvbench-docs
42+
pip install breathe sphinx nvidia-sphinx-theme myst-parser docutils
43+
pip install cython scikit-build-core setuptools-scm typing-extensions cuda-bindings
44+
45+
- name: Build/Install cuda.bench
46+
run: |
47+
conda activate nvbench-docs
48+
cd python
49+
rm -rf build
50+
python -m pip install --no-build-isolation --no-deps --verbose .
51+
52+
- name: Build documentation
53+
run: |
54+
conda activate nvbench-docs
55+
cd docs
56+
./build_combined_docs.sh
57+
58+
- name: Upload documentation artifact
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: docs-html
62+
path: docs/sphinx-combined/_build
63+
64+
comment-docs:
65+
if: github.repository == 'oleksandr-pavlyk/nvbench' && github.event_name == 'pull_request'
66+
needs: build-docs
67+
runs-on: ubuntu-latest
68+
permissions:
69+
pull-requests: write
70+
steps:
71+
- name: Comment on pull request with artifact link
72+
uses: actions/github-script@v7
73+
with:
74+
script: |
75+
const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
76+
const body = `Documentation artifact "docs-html" is available for this run: ${runUrl}`;
77+
await github.rest.issues.createComment({
78+
owner: context.repo.owner,
79+
repo: context.repo.repo,
80+
issue_number: context.issue.number,
81+
body,
82+
});

0 commit comments

Comments
 (0)