Skip to content

Commit 5820a38

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

File tree

153 files changed

+98583
-216
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

+98583
-216
lines changed

.github/workflows/ci.yml

+149-8
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
uses: actions/checkout@v3
2929

3030
- name: Generate Test Matrix
31-
uses: alandefreitas/cpp-actions/cpp-matrix@v1.4.0
31+
uses: alandefreitas/cpp-actions/cpp-matrix@v1.5.0
3232
id: cpp-matrix
3333
with:
3434
compilers: |
@@ -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,144 @@ 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: Setup C++
262+
uses: alandefreitas/cpp-actions/[email protected]
263+
id: setup-cpp
264+
with:
265+
compiler: clang
266+
version: 16
267+
check-latest: true
268+
269+
- name: Install mrdox from release package
270+
run: |
271+
set -x
272+
sudo find packages -name 'MrDox-*-Linux.tar.gz' -exec tar -xzf {} -C /usr/local --strip-components=1 \;
273+
mrdox --version
274+
275+
- name: Clone Boost.URL
276+
uses: alandefreitas/cpp-actions/[email protected]
277+
id: boost-url-clone
278+
with:
279+
branch: master
280+
modules: url
281+
boost-dir: boost
282+
modules-scan-paths: 'test'
283+
modules-exclude-paths: ''
284+
trace-commands: true
285+
286+
- name: Configure Boost.URL
287+
working-directory: boost/libs/url
288+
run: |
289+
set -x
290+
if [ -d "__build__" ]; then
291+
rm -rf __build__
292+
fi
293+
mkdir __build__
294+
cd __build__
295+
mkdir __include_dirs__
296+
cd __include_dirs__
297+
output_file="include_dirs.txt"
298+
echo "cmake_minimum_required(VERSION 3.22)" > CMakeLists.txt
299+
echo "project(get_implicit_dirs)" >> CMakeLists.txt
300+
echo "file(WRITE \"${output_file}\" \"\${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}\")" >> CMakeLists.txt
301+
mkdir __build__
302+
cd __build__
303+
cmake ..
304+
cd ..
305+
default_includes=$(cat "$output_file")
306+
cd ..
307+
cmake -D BOOST_URL_BUILD_TESTS=OFF -D BOOST_URL_BUILD_EXAMPLES=OFF -D CMAKE_EXPORT_COMPILE_COMMANDS=ON -D CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES="$default_includes" -D CMAKE_CXX_COMPILER=${{ steps.setup-cpp.outputs.cxx }} -D CMAKE_C_COMPILER=${{ steps.setup-cpp.outputs.cc }} ..
308+
309+
- name: Generate reference
310+
run: |
311+
echo "verbose: true" > $(pwd)/boost/libs/url/mrdox-single.yml
312+
echo "source-root: ." >> $(pwd)/boost/libs/url/mrdox-single.yml
313+
echo "multipage: false" >> $(pwd)/boost/libs/url/mrdox-single.yml
314+
315+
echo "verbose: true" > $(pwd)/boost/libs/url/mrdox-multi.yml
316+
echo "source-root: ." >> $(pwd)/boost/libs/url/mrdox-multi.yml
317+
echo "multipage: true" >> $(pwd)/boost/libs/url/mrdox-multi.yml
318+
319+
set -x
320+
for variant in single multi; do
321+
for format in adoc html xml; do
322+
mkdir -p "demos/boost-url/$variant/$format"
323+
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/$variant/$format"
324+
done
325+
done
326+
327+
- name: Update website demos
328+
if: ${{ github.event_name == 'push' && (contains(fromJSON('["master", "develop"]'), github.ref_name) || startsWith(github.ref, 'refs/tags/')) }}
329+
env:
330+
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
331+
run: |
332+
# Add SSH key
333+
mkdir -p /home/runner/.ssh
334+
ssh-keyscan dev-websites.cpp.al >> /home/runner/.ssh/known_hosts
335+
echo "${{ secrets.DEV_WEBSITES_SSH_KEY }}" > /home/runner/.ssh/github_actions
336+
chmod 600 /home/runner/.ssh/github_actions
337+
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
338+
ssh-add /home/runner/.ssh/github_actions
339+
340+
# Copy files
341+
ssh [email protected] "mkdir -p /var/www/mrdox.com/demos/${{ github.ref_name }}"
342+
scp -r $(pwd)/demos/* [email protected]:/var/www/mrdox.com/demos/${{ github.ref_name }}/
343+
202344
releases:
203345
needs: build
204-
if: ${{ github.event_name == 'push' && (contains(fromJSON('["master", "develop"]'), github.ref_name) || startsWith(github.ref, 'refs/tags/')) }}
205346
defaults:
206347
run:
207348
shell: bash
208349

209-
name: Create Release Packages
350+
name: Releases
210351
timeout-minutes: 120
211352
runs-on: ubuntu-22.04
212353
permissions:
@@ -239,7 +380,7 @@ jobs:
239380
limit: 150
240381

241382
- name: Remove branch release
242-
if: ${{ github.event_name == 'push' && contains(fromJSON('["master", "develop"]'), github.ref_name) }}
383+
if: ${{ github.event_name == 'push' && (contains(fromJSON('["master", "develop"]'), github.ref_name)) }}
243384
uses: dev-drprasad/[email protected]
244385
with:
245386
tag_name: ${{ github.ref_name }}-release

0 commit comments

Comments
 (0)