Skip to content

Commit 08437c3

Browse files
authored
Generate documentation from the code with hdoc (#80)
The documentation is going to https://docs.hdoc.io/danakj/subspace/ at this time. In the future, we could split the documentation generation into a separate CI action entirely. Since it only requires CMake configure, not the full compilation, it would not be too costly to do so. Then we can track doc-building success separately from compile/tests success.
1 parent cc4cf4d commit 08437c3

File tree

3 files changed

+41
-5
lines changed

3 files changed

+41
-5
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: CI
22

3-
on: [push]
3+
on:
4+
push:
5+
branches: [hdoc]
46

57
jobs:
68
build:
@@ -114,8 +116,9 @@ jobs:
114116
execute_process(
115117
COMMAND cmake
116118
-S .
117-
-B build
119+
-B out
118120
-D CMAKE_BUILD_TYPE=${{ matrix.config.build_type }}
121+
-D CMAKE_EXPORT_COMPILE_COMMANDS=1
119122
-G Ninja
120123
-D CMAKE_MAKE_PROGRAM=${ninja_program}
121124
RESULT_VARIABLE result
@@ -139,7 +142,7 @@ jobs:
139142
endif()
140143
141144
execute_process(
142-
COMMAND cmake --build build
145+
COMMAND cmake --build out
143146
RESULT_VARIABLE result
144147
)
145148
if (NOT result EQUAL 0)
@@ -154,15 +157,22 @@ jobs:
154157
155158
execute_process(
156159
COMMAND ctest -j ${N} --rerun-failed --output-on-failure
157-
WORKING_DIRECTORY build
160+
WORKING_DIRECTORY out
158161
RESULT_VARIABLE result
159162
)
160163
if (NOT result EQUAL 0)
161164
message(FATAL_ERROR "Running tests failed!")
162165
endif()
163166
167+
- name: Documentation
168+
if: startsWith(matrix.config.cxx, 'g++')
169+
uses: hdoc/hdoc-github-action@v2
170+
with:
171+
compile-commands-path: out/compile_commands.json
172+
hdoc-api-key: ${{ secrets.HDOC_PROJECT_API_KEY }}
173+
164174
- name: Install Strip
165-
run: cmake --install build --prefix instdir --strip
175+
run: cmake --install out --prefix instdir --strip
166176

167177
- name: Pack
168178
working-directory: instdir

.hdoc.toml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[project]
2+
name = "subspace"
3+
version = "0.0.1"
4+
5+
# Optional, adding this will enable direct links from the documentation
6+
# to your source code.
7+
git_repo_url = "https://github.com/chromium/subspace/"
8+
git_default_branch = "main"
9+
10+
[paths]
11+
compile_commands = "out/compile_commands.json"
12+
13+
[pages]
14+
#homepage = "README.md"
15+
paths = [
16+
"README.md",
17+
]
18+
19+
[ignore]
20+
paths = [
21+
"/third_party/",
22+
"_unittest.cc",
23+
"/__private/",
24+
]

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Please don't use this library. This is an experiment and we don't yet know where
77
it will take us. There will be breaking changes without warning, and there is no
88
stable version.
99

10+
Documentation: https://docs.hdoc.io/danakj/subspace/
11+
1012
# Copyright
1113

1214
All source files must include this header:

0 commit comments

Comments
 (0)