-
Notifications
You must be signed in to change notification settings - Fork 14
180 lines (158 loc) · 6.11 KB
/
subdoc.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
name: docs
on:
push:
branches: [main]
jobs:
docs:
name: Generate documentation with subdoc
if: github.repository == 'chromium/subspace'
runs-on: ubuntu-latest
env:
clang_version: 17
installed_clang_version: 14
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.DOCS_SSH_PRIVATE_KEY }}
- name: Install LLVM+Clang
run: |
sudo apt-get remove clang-${installed_clang_version} \
lldb-${installed_clang_version} \
lld-${installed_clang_version} \
clangd-${installed_clang_version} \
clang-tidy-${installed_clang_version} \
clang-format-${installed_clang_version} \
clang-tools-${installed_clang_version} \
llvm-${installed_clang_version}-dev \
lld-${installed_clang_version} \
lldb-${installed_clang_version} \
llvm-${installed_clang_version}-tools \
libomp-${installed_clang_version}-dev \
libc++-${installed_clang_version}-dev \
libc++abi-${installed_clang_version}-dev \
libclang-common-${installed_clang_version}-dev \
libclang-${installed_clang_version}-dev \
libclang-cpp${installed_clang_version}-dev \
libunwind-${installed_clang_version}-dev
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh ${clang_version} all
- name: Download Ninja
id: ninja
shell: cmake -P {0}
run: |
set(ninja_version "1.11.1")
set(ninja_url "https://github.com/ninja-build/ninja/releases/download/v${ninja_version}/ninja-linux.zip")
file(DOWNLOAD "${ninja_url}" ./ninja.zip SHOW_PROGRESS)
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ./ninja.zip)
if (NOT "${{ runner.os }}" STREQUAL "Windows")
execute_process(
COMMAND chmod +x ninja
)
endif()
- name: Configure
shell: cmake -P {0}
run: |
set(ENV{CC} clang-$ENV{clang_version})
set(ENV{CXX} clang++-$ENV{clang_version})
# Path to LLVM+Clang nightly that we have installed.
set(ENV{LLVM_DIR} "/usr/lib/llvm-$ENV{clang_version}/lib/cmake/llvm")
set(ENV{Clang_DIR} "/usr/lib/llvm-$ENV{clang_version}/lib/cmake/clang")
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/ninja" ninja_program)
execute_process(
COMMAND cmake
-S .
-B out
-D CMAKE_BUILD_TYPE=Release
-D CMAKE_EXPORT_COMPILE_COMMANDS=1
-G Ninja
-D CMAKE_MAKE_PROGRAM=${ninja_program}
-D SUBSPACE_BUILD_TESTS=OFF
-D SUBSPACE_BUILD_SUBDOC=ON
-D SUBSPACE_BUILD_BENCHMARKS=OFF
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status")
endif()
- name: Build
shell: cmake -P {0}
run: |
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ")
execute_process(
COMMAND cmake --build out -j 10
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status")
endif()
# Reconfigure with tests enabled so that we generate docs through them
# to find all headers, and all static assertions.
- name: Reconfigure with tests
shell: cmake -P {0}
run: |
set(ENV{CC} clang-$ENV{clang_version})
set(ENV{CXX} clang++-$ENV{clang_version})
# Path to LLVM+Clang nightly that we have installed.
set(ENV{LLVM_DIR} "/usr/lib/llvm-$ENV{clang_version}/lib/cmake/llvm")
set(ENV{Clang_DIR} "/usr/lib/llvm-$ENV{clang_version}/lib/cmake/clang")
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/ninja" ninja_program)
execute_process(
COMMAND cmake
-S .
-B out
-D CMAKE_BUILD_TYPE=Release
-D CMAKE_EXPORT_COMPILE_COMMANDS=1
-G Ninja
-D CMAKE_MAKE_PROGRAM=${ninja_program}
-D SUBSPACE_BUILD_TESTS=ON
-D SUBSPACE_BUILD_SUBDOC=ON
-D SUBSPACE_BUILD_BENCHMARKS=OFF
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status")
endif()
- name: Checkout docs
run: |
git clone [email protected]:subspace-cpp/docs.git docs
cd docs
git rm -r *
# Generate for files in subspace. We execute the tool on all files in
# the subspace library dir, and we limit generation to things defined
# in that directory (there's no other /sus/ directory it may include).
- name: Generate
run: |
# For crash dumps.
export LLVM_SYMBOLIZER_PATH="/usr/lib/llvm-${clang_version}/bin/llvm-symbolizer"
out/subdoc/subdoc \
-p out \
--out docs \
--include-file-pattern /sus/ \
--exclude-file-pattern /third_party/ \
--exclude-file-pattern /test/ \
--exclude-file-pattern test.cc \
--copy-file subdoc/gen_tests/subdoc-test-style.css \
--copy-file web/logo.png \
--copy-file web/logo32.png \
--copy-file web/logo16.png \
--favicon "logo.png;image/png" \
--favicon "logo32.png;image/png" \
--favicon "logo16.png;image/png" \
--css subdoc-test-style.css \
--project-logo logo.png \
--project-md sus/project.md \
--project-name Subspace \
/home/runner/work/subspace/subspace/sus
- name: Deploy
run: |
SHA=`git rev-parse HEAD`
cd docs
git config user.email "[email protected]"
git config user.name "Subspace subdoc generator"
git add .
git commit -m "Update docs: $SHA" || true
git push origin || true