Skip to content

Commit 07471c2

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

File tree

153 files changed

+98592
-217
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

+98592
-217
lines changed

.github/workflows/ci.yml

+158-9
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,13 +128,13 @@ 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
117135

118136
- name: Upload GitHub Release Artifacts
119-
if: ${{ matrix.is-main && github.event_name == 'push' && (contains(fromJSON('["master", "develop"]'), github.ref_name) || startsWith(github.ref, 'refs/tags/')) }}
137+
if: ${{ matrix.is-main && matrix.compiler != 'clang' }}
120138
uses: actions/upload-artifact@v3
121139
with:
122140
name: release-packages-${{ runner.os }}
@@ -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,152 @@ 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 packages
270+
uses: alandefreitas/cpp-actions/[email protected]
271+
id: package-install
272+
with:
273+
apt-get: libstdc++-12-dev
274+
cc: ${{ steps.setup-cpp.outputs.cc }}
275+
cxx: ${{ steps.setup-cpp.outputs.cxx }}
276+
277+
- name: Install mrdox from release package
278+
run: |
279+
set -x
280+
sudo find packages -name 'MrDox-*-Linux.tar.gz' -exec tar -xzf {} -C /usr/local --strip-components=1 \;
281+
mrdox --version
282+
283+
- name: Clone Boost.URL
284+
uses: alandefreitas/cpp-actions/[email protected]
285+
id: boost-url-clone
286+
with:
287+
branch: master
288+
modules: url
289+
boost-dir: boost
290+
modules-scan-paths: '"test example"'
291+
modules-exclude-paths: ''
292+
trace-commands: true
293+
294+
- name: Configure Boost.URL
295+
working-directory: boost/libs/url
296+
run: |
297+
set -x
298+
if [ -d "__build__" ]; then
299+
rm -rf __build__
300+
fi
301+
mkdir __build__
302+
cd __build__
303+
mkdir __include_dirs__
304+
cd __include_dirs__
305+
output_file="include_dirs.txt"
306+
echo "cmake_minimum_required(VERSION 3.22)" > CMakeLists.txt
307+
echo "project(get_implicit_dirs)" >> CMakeLists.txt
308+
echo "file(WRITE \"${output_file}\" \"\${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}\")" >> CMakeLists.txt
309+
mkdir __build__
310+
cd __build__
311+
cmake -D CMAKE_CXX_COMPILER=${{ steps.setup-cpp.outputs.cxx }} -D CMAKE_C_COMPILER=${{ steps.setup-cpp.outputs.cc }} ..
312+
cd ..
313+
default_includes=$(cat "$output_file")
314+
cd ..
315+
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 }} ..
316+
317+
- name: Generate reference
318+
run: |
319+
echo "verbose: true" > $(pwd)/boost/libs/url/mrdox-single.yml
320+
echo "source-root: ." >> $(pwd)/boost/libs/url/mrdox-single.yml
321+
echo "multipage: false" >> $(pwd)/boost/libs/url/mrdox-single.yml
322+
323+
echo "verbose: true" > $(pwd)/boost/libs/url/mrdox-multi.yml
324+
echo "source-root: ." >> $(pwd)/boost/libs/url/mrdox-multi.yml
325+
echo "multipage: true" >> $(pwd)/boost/libs/url/mrdox-multi.yml
326+
327+
set -x
328+
for variant in single multi; do
329+
for format in adoc html xml; do
330+
mkdir -p "demos/boost-url/$variant/$format"
331+
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"
332+
done
333+
done
334+
335+
- name: Update website demos
336+
if: ${{ github.event_name == 'push' && (contains(fromJSON('["master", "develop"]'), github.ref_name) || startsWith(github.ref, 'refs/tags/')) }}
337+
env:
338+
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
339+
run: |
340+
# Add SSH key
341+
mkdir -p /home/runner/.ssh
342+
ssh-keyscan dev-websites.cpp.al >> /home/runner/.ssh/known_hosts
343+
echo "${{ secrets.DEV_WEBSITES_SSH_KEY }}" > /home/runner/.ssh/github_actions
344+
chmod 600 /home/runner/.ssh/github_actions
345+
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
346+
ssh-add /home/runner/.ssh/github_actions
347+
348+
# Copy files
349+
ssh [email protected] "mkdir -p /var/www/mrdox.com/demos/${{ github.ref_name }}"
350+
scp -r $(pwd)/demos/* [email protected]:/var/www/mrdox.com/demos/${{ github.ref_name }}/
351+
202352
releases:
203353
needs: build
204-
if: ${{ github.event_name == 'push' && (contains(fromJSON('["master", "develop"]'), github.ref_name) || startsWith(github.ref, 'refs/tags/')) }}
205354
defaults:
206355
run:
207356
shell: bash
208357

209-
name: Create Release Packages
358+
name: Releases
210359
timeout-minutes: 120
211360
runs-on: ubuntu-22.04
212361
permissions:
@@ -239,7 +388,7 @@ jobs:
239388
limit: 150
240389

241390
- name: Remove branch release
242-
if: ${{ github.event_name == 'push' && contains(fromJSON('["master", "develop"]'), github.ref_name) }}
391+
if: ${{ github.event_name == 'push' && (contains(fromJSON('["master", "develop"]'), github.ref_name)) }}
243392
uses: dev-drprasad/[email protected]
244393
with:
245394
tag_name: ${{ github.ref_name }}-release

0 commit comments

Comments
 (0)