Skip to content

Commit fe0230d

Browse files
committed
ci: automated deployment of demo documentation
fix cppalliance#402, cppalliance#405
1 parent cbc7d55 commit fe0230d

File tree

153 files changed

+98564
-215
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+98564
-215
lines changed

.github/workflows/ci.yml

+134-7
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,25 @@ jobs:
7676
substring="C:/Program Files/Microsoft Visual Studio/2022/Community/DIA SDK/lib/amd64/diaguids.lib;"
7777
sed -i "s|$substring||g" "$llvm_dir/RelWithDebInfo/lib/cmake/llvm/LLVMExports.cmake"
7878
echo "llvm_dir=$llvm_dir"
79-
find "$llvm_dir" -type f
79+
# find "$llvm_dir" -type f
80+
81+
- name: Install Duktape
82+
id: duktape-install
83+
shell: bash
84+
run: |
85+
set -xe
86+
curl -L -o "duktape-2.7.0.tar.xz" "https://github.com/svaarala/duktape/releases/download/v2.7.0/duktape-2.7.0.tar.xz"
87+
duktape_dir="${{runner.tool_cache}}/duktape"
88+
duktape_dir=$(echo "$duktape_dir" | sed 's/\\/\//g')
89+
mkdir -p "$duktape_dir"
90+
tar -xvf "duktape-2.7.0.tar.xz" -C "$duktape_dir"
91+
echo "duktape-dir=$duktape_dir/duktape-2.7.0" >> $GITHUB_OUTPUT
92+
echo "duktape_dir=$duktape_dir/duktape-2.7.0"
93+
94+
- name: Install Node.js
95+
uses: actions/setup-node@v3
96+
with:
97+
node-version: '18'
8098

8199
- name: Setup C++
82100
uses: alandefreitas/cpp-actions/[email protected]
@@ -110,7 +128,7 @@ jobs:
110128
cxx: ${{ steps.setup-cpp.outputs.cxx || matrix.cxx }}
111129
cxxflags: ${{ matrix.cxxflags }}${{ ( matrix.compiler == 'gcc' && ' -static-libstdc++') || '' }}${{ ( matrix.asan && ' -static-libasan') || '' }}${{ ( matrix.tsan && ' -static-libtsan') || '' }}
112130
install-prefix: .local
113-
extra-args: ${{ format('-D LLVM_ROOT="{0}" -D Clang_ROOT="{0}" -D CMAKE_EXPORT_COMPILE_COMMANDS=ON', steps.llvm-install.outputs.llvm-dir || '/usr/local') }}
131+
extra-args: ${{ format('-D LLVM_ROOT="{0}" -D Clang_ROOT="{0}" -D DUKTAPE_SOURCE_ROOT="{1}" -D CMAKE_EXPORT_COMPILE_COMMANDS=ON', steps.llvm-install.outputs.llvm-dir || '/usr/local', steps.duktape-install.outputs.duktape-dir) }}
114132
export-compile-commands: ${{ matrix.time-trace }}
115133
package: ${{ matrix.is-main }}
116134
package-dir: packages
@@ -157,12 +175,11 @@ jobs:
157175
158176
docs:
159177
needs: build
160-
if: ${{ github.event_name == 'push' && (contains(fromJSON('["master", "develop"]'), github.ref_name) || startsWith(github.ref, 'refs/tags/')) }}
161178
defaults:
162179
run:
163180
shell: bash
164181

165-
name: Publish docs
182+
name: Documentation
166183
timeout-minutes: 30
167184
runs-on: ubuntu-22.04
168185
permissions:
@@ -193,20 +210,130 @@ jobs:
193210
fi
194211
195212
- name: Publish to GitHub Pages
213+
if: ${{ github.event_name == 'push' && (contains(fromJSON('["master", "develop"]'), github.ref_name) || startsWith(github.ref, 'refs/tags/')) }}
196214
uses: peaceiris/actions-gh-pages@v3
197215
with:
198216
github_token: ${{ secrets.GITHUB_TOKEN }}
199217
publish_dir: docs/build/site
200218
force_orphan: true
201219

220+
- name: Update website
221+
if: ${{ github.event_name == 'push' && (contains(fromJSON('["master", "develop"]'), github.ref_name) || startsWith(github.ref, 'refs/tags/')) }}
222+
env:
223+
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
224+
run: |
225+
# Add SSH key
226+
mkdir -p /home/runner/.ssh
227+
ssh-keyscan dev-websites.cpp.al >> /home/runner/.ssh/known_hosts
228+
echo "${{ secrets.DEV_WEBSITES_SSH_KEY }}" > /home/runner/.ssh/github_actions
229+
chmod 600 /home/runner/.ssh/github_actions
230+
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
231+
ssh-add /home/runner/.ssh/github_actions
232+
233+
# Copy files
234+
scp -r $(pwd)/docs/build/site/* [email protected]:/var/www/mrdox.com/
235+
236+
demos:
237+
needs: build
238+
defaults:
239+
run:
240+
shell: bash
241+
242+
name: Demos
243+
timeout-minutes: 120
244+
runs-on: ubuntu-22.04
245+
permissions:
246+
contents: write
247+
248+
steps:
249+
- name: Clone mrdox
250+
uses: actions/checkout@v3
251+
252+
- uses: actions/download-artifact@v3
253+
with:
254+
name: release-packages-Linux
255+
path: packages
256+
257+
- name: List artifacts
258+
run: ls -R
259+
working-directory: packages
260+
261+
- name: Install mrdox from release package
262+
run: |
263+
set -x
264+
sudo find packages -name 'MrDox-*-Linux.tar.gz' -exec tar -xzf {} -C /usr/local --strip-components=1 \;
265+
mrdox --version
266+
267+
- name: Clone Boost.URL
268+
uses: alandefreitas/cpp-actions/[email protected]
269+
id: boost-url-clone
270+
with:
271+
branch: master
272+
modules: url
273+
boost-dir: boost
274+
trace-commands: true
275+
276+
- name: Configure Boost.URL
277+
working-directory: boost/libs/url
278+
run: |
279+
mkdir __build__
280+
cd __build__
281+
mkdir __include_dirs__
282+
cd __include_dirs__
283+
output_file="include_dirs.txt"
284+
echo "cmake_minimum_required(VERSION 3.22)" > CMakeLists.txt
285+
echo "project(get_implicit_dirs)" >> CMakeLists.txt
286+
echo "file(WRITE \"${output_file}\" \"\${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}\")" >> CMakeLists.txt
287+
mkdir __build__
288+
cd __build__
289+
cmake ..
290+
cd ..
291+
default_includes=$(cat "$output_file")
292+
cd ..
293+
cmake -D BOOST_URL_BUILD_TESTS=OFF -D BOOST_URL_BUILD_EXAMPLES=OFF -D BOOST_URL_EXAMPLE_LIBRARIES="" -D BOOST_URL_UNIT_TEST_LIBRARIES="" -D CMAKE_EXPORT_COMPILE_COMMANDS=ON -D CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES="$default_includes" ..
294+
295+
- name: Generate reference
296+
run: |
297+
echo "verbose: true" > $(pwd)/boost/libs/url/mrdox-single.yml
298+
echo "source-root: ." >> $(pwd)/boost/libs/url/mrdox-single.yml
299+
echo "multipage: false" >> $(pwd)/boost/libs/url/mrdox-single.yml
300+
301+
echo "verbose: true" > $(pwd)/boost/libs/url/mrdox-multi.yml
302+
echo "source-root: ." >> $(pwd)/boost/libs/url/mrdox-multi.yml
303+
echo "multipage: true" >> $(pwd)/boost/libs/url/mrdox-multi.yml
304+
305+
set -x
306+
for variant in single multi; do
307+
for format in adoc html xml; do
308+
mkdir -p "demos/boost-url/$variant/$format"
309+
mrdox --config="$(pwd)/boost/libs/url/mrdox-$variant.yml" "$(pwd)/boost/libs/url/__build__/compile_commands.json" --addons="$(pwd)/share/mrdox/addons" --format="$format" --output="$(pwd)/demos/boost-url/$format"
310+
done
311+
done
312+
313+
- name: Update website demos
314+
if: ${{ github.event_name == 'push' && (contains(fromJSON('["master", "develop"]'), github.ref_name) || startsWith(github.ref, 'refs/tags/')) }}
315+
env:
316+
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
317+
run: |
318+
# Add SSH key
319+
mkdir -p /home/runner/.ssh
320+
ssh-keyscan dev-websites.cpp.al >> /home/runner/.ssh/known_hosts
321+
echo "${{ secrets.DEV_WEBSITES_SSH_KEY }}" > /home/runner/.ssh/github_actions
322+
chmod 600 /home/runner/.ssh/github_actions
323+
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
324+
ssh-add /home/runner/.ssh/github_actions
325+
326+
# Copy files
327+
ssh [email protected] "mkdir -p /var/www/mrdox.com/demos/${{ github.ref_name }}"
328+
scp -r $(pwd)/demos/* [email protected]:/var/www/mrdox.com/demos/${{ github.ref_name }}/
329+
202330
releases:
203331
needs: build
204-
if: ${{ github.event_name == 'push' && (contains(fromJSON('["master", "develop"]'), github.ref_name) || startsWith(github.ref, 'refs/tags/')) }}
205332
defaults:
206333
run:
207334
shell: bash
208335

209-
name: Create Release Packages
336+
name: Releases
210337
timeout-minutes: 120
211338
runs-on: ubuntu-22.04
212339
permissions:
@@ -239,7 +366,7 @@ jobs:
239366
limit: 150
240367

241368
- name: Remove branch release
242-
if: ${{ github.event_name == 'push' && contains(fromJSON('["master", "develop"]'), github.ref_name) }}
369+
if: ${{ github.event_name == 'push' && (contains(fromJSON('["master", "develop"]'), github.ref_name)) }}
243370
uses: dev-drprasad/[email protected]
244371
with:
245372
tag_name: ${{ github.ref_name }}-release

0 commit comments

Comments
 (0)