Skip to content

Commit 4951f62

Browse files
committed
adjust project and make C++11 compability
1 parent 1ec577a commit 4951f62

20 files changed

+1386
-318
lines changed
+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: 'build-docs'
2+
description: 'Builds documentation using Doxygen'
3+
inputs:
4+
cmake_target:
5+
description: 'CMake documentation target'
6+
required: true
7+
docs_dir:
8+
description: 'Path to documentation dir, relative to build_dir'
9+
required: true
10+
github_token:
11+
description: 'GitHub token'
12+
required: true
13+
build_dir:
14+
description: 'Build directory'
15+
required: false
16+
default: 'build'
17+
cmake_configure_args:
18+
description: 'Additional CMake configure arguments'
19+
required: false
20+
default: ''
21+
destination_dir:
22+
description: 'Directory name for deployed docs'
23+
required: false
24+
default: ''
25+
docs_branch:
26+
description: 'Documentation branch'
27+
required: false
28+
default: 'gh-pages'
29+
30+
outputs:
31+
version:
32+
description: 'Version of the generated docs'
33+
value: ${{ steps.get-docs-version.outputs.version }}
34+
35+
runs:
36+
using: "composite"
37+
steps:
38+
- name: Install deps
39+
shell: bash
40+
run: |
41+
sudo apt install -y cmake
42+
sudo apt install -y wget
43+
cd ~
44+
wget -nv https://www.doxygen.nl/files/doxygen-1.10.0.linux.bin.tar.gz
45+
tar -xzf doxygen-1.10.0.linux.bin.tar.gz
46+
echo "$(pwd)/doxygen-1.10.0/bin" >> $GITHUB_PATH
47+
48+
- name: CMake configuration
49+
shell: bash
50+
run: cmake ${{ inputs.cmake_configure_args }} -B ${{ inputs.build_dir }} -DENUM_NAME_BUILD_DOCS=ON
51+
52+
- name: CMake build
53+
shell: bash
54+
run: cmake --build ${{ inputs.build_dir }} --target ${{ inputs.cmake_target }}
55+
56+
- name: Get docs version
57+
id: get-docs-version
58+
shell: bash
59+
run: |
60+
subdir=$(basename $(find ${{ inputs.build_dir }}/${{ inputs.docs_dir }} -mindepth 1 -maxdepth 1 -type d | head -n 1))
61+
echo "version=$subdir" >> $GITHUB_OUTPUT
62+
63+
- name: Deploy docs
64+
if: ${{ inputs.destination_dir != '' }}
65+
uses: peaceiris/actions-gh-pages@v4
66+
with:
67+
github_token: ${{ inputs.github_token }}
68+
publish_dir: ${{ inputs.build_dir }}/${{ inputs.docs_dir }}/${{ steps.get-docs-version.outputs.version }}
69+
destination_dir: ${{ inputs.destination_dir }}
70+
publish_branch: ${{ inputs.docs_branch }}
71+
72+
- name: Deploy docs
73+
if: ${{ inputs.destination_dir == '' }}
74+
uses: peaceiris/actions-gh-pages@v4
75+
with:
76+
github_token: ${{ inputs.github_token }}
77+
publish_dir: ${{ inputs.build_dir }}/${{ inputs.docs_dir }}/${{ steps.get-docs-version.outputs.version }}
78+
destination_dir: ${{ steps.get-docs-version.outputs.version }}
79+
publish_branch: ${{ inputs.docs_branch }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: 'update-redirect-page'
2+
description: 'Updates redirect HTML page'
3+
inputs:
4+
github_token:
5+
description: 'GitHub token'
6+
required: true
7+
target_url:
8+
description: 'Redirect target URL'
9+
temp_dir:
10+
description: 'Directory where redirect file will be generated'
11+
required: false
12+
default: 'redirect-dir'
13+
file_name:
14+
description: 'Generated file name'
15+
required: false
16+
default: 'index.html'
17+
destination_dir:
18+
description: 'Redirect file destination directory'
19+
required: false
20+
default: ''
21+
docs_branch:
22+
description: 'Documentation branch'
23+
required: false
24+
default: 'gh-pages'
25+
26+
runs:
27+
using: "composite"
28+
steps:
29+
- name: Generate redirect HTML
30+
shell: bash
31+
run: |
32+
mkdir ${{ inputs.temp_dir }}
33+
cat << EOF > ${{ inputs.temp_dir }}/${{ inputs.file_name }}
34+
<!DOCTYPE html>
35+
<html lang="en">
36+
<head>
37+
<meta charset="UTF-8">
38+
<meta http-equiv="refresh" content="0; url=${{ inputs.target_url }}">
39+
<title>Redirecting...</title>
40+
</head>
41+
<body>
42+
<p>If you are not redirected automatically, <a href="${{ inputs.target_url }}">click here</a>.</p>
43+
</body>
44+
</html>
45+
EOF
46+
47+
- name: Deploy redirect page
48+
uses: peaceiris/actions-gh-pages@v4
49+
with:
50+
github_token: ${{ inputs.github_token }}
51+
publish_dir: ${{ inputs.temp_dir }}
52+
destination_dir: ${{ inputs.destination_dir }}
53+
publish_branch: ${{ inputs.docs_branch }}
54+
keep_files: true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: 'update-version-selector'
2+
description: 'Updates version selector'
3+
inputs:
4+
github_token:
5+
description: 'GitHub token'
6+
required: true
7+
temp_dir:
8+
description: 'Directory where version selector file will be generated'
9+
required: false
10+
default: 'selector-dir'
11+
file_name:
12+
description: 'Selector file name'
13+
required: false
14+
default: 'version_selector.html'
15+
selector_id:
16+
description: 'select element id'
17+
required: false
18+
default: 'versionSelector'
19+
docs_branch:
20+
description: 'Documentation branch'
21+
required: false
22+
default: 'gh-pages'
23+
outputs:
24+
versions_counter:
25+
description: "Number of existing versions"
26+
value: ${{ steps.discover-versions.outputs.counter }}
27+
28+
runs:
29+
using: "composite"
30+
steps:
31+
- name: Discover versions
32+
id: discover-versions
33+
shell: bash
34+
run: |
35+
git fetch origin ${{ inputs.docs_branch }}
36+
dirs=$(git ls-tree --name-only -d origin/${{ inputs.docs_branch }} | sort -rV)
37+
echo "counter=$(echo "$dirs" | wc -l | xargs)" >> $GITHUB_OUTPUT
38+
39+
mkdir ${{ inputs.temp_dir }}
40+
# Create HTML
41+
echo '<select id="${{ inputs.selector_id }}">' > ${{ inputs.temp_dir }}/${{ inputs.file_name }}
42+
for dir in $dirs; do
43+
if [[ "$(basename "$dir")" != .* ]]; then
44+
version=$(basename "$dir")
45+
echo " <option value=\"$version\">$version</option>" >> ${{ inputs.temp_dir }}/${{ inputs.file_name }}
46+
fi
47+
done
48+
echo '</select>' >> ${{ inputs.temp_dir }}/${{ inputs.file_name }}
49+
50+
- name: Deploy version selector
51+
uses: peaceiris/actions-gh-pages@v4
52+
with:
53+
github_token: ${{ inputs.github_token }}
54+
publish_dir: ${{ inputs.temp_dir }}
55+
publish_branch: ${{ inputs.docs_branch }}
56+
keep_files: true

.github/workflows/c-cpp.yml

+4
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@ jobs:
1616
fail-fast: false
1717
matrix:
1818
config:
19+
- { compiler: gcc, version: 9, build_type: Release, cppstd: 11 }
20+
- { compiler: gcc, version: 9, build_type: Release, cppstd: 14 }
1921
- { compiler: gcc, version: 9, build_type: Release, cppstd: 17 }
2022
- { compiler: gcc, version: 11, build_type: Debug, cppstd: 20 }
2123
- { compiler: gcc, version: 12, build_type: Release, cppstd: 20 }
24+
- { compiler: clang, version: 11, build_type: Release, cppstd: 11 }
25+
- { compiler: clang, version: 11, build_type: Release, cppstd: 14 }
2226
- { compiler: clang, version: 11, build_type: Release, cppstd: 17 }
2327
- { compiler: clang, version: 11, build_type: Debug, cppstd: 17, asan: OFF }
2428
- { compiler: clang, version: 12, build_type: Debug, cppstd: 17, asan: OFF }
+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Create git-main docs
2+
3+
permissions:
4+
contents: write
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
11+
jobs:
12+
create-git-main-docs:
13+
runs-on: ubuntu-22.04
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Build docs
19+
id: build-docs
20+
uses: ./.github/actions/build-docs
21+
with:
22+
cmake_target: 'doc'
23+
docs_dir: 'doc/docs'
24+
destination_dir: git-main
25+
github_token: ${{ secrets.GITHUB_TOKEN }}
26+
27+
- name: Update version selector
28+
id: update-version-selector
29+
uses: ./.github/actions/update-version-selector
30+
with:
31+
github_token: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: Create redirect page if there are no releases
34+
if: ${{ steps.update-version-selector.outputs.versions_counter == 1}}
35+
uses: ./.github/actions/update-redirect-page
36+
with:
37+
github_token: ${{ secrets.GITHUB_TOKEN }}
38+
target_url: git-main/index.html

.vscode/settings.json

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"files.associations": {
3+
"charconv": "cpp",
4+
"array": "cpp",
5+
"atomic": "cpp",
6+
"bit": "cpp",
7+
"*.tcc": "cpp",
8+
"cctype": "cpp",
9+
"chrono": "cpp",
10+
"clocale": "cpp",
11+
"cmath": "cpp",
12+
"cstdarg": "cpp",
13+
"cstddef": "cpp",
14+
"cstdint": "cpp",
15+
"cstdio": "cpp",
16+
"cstdlib": "cpp",
17+
"cstring": "cpp",
18+
"ctime": "cpp",
19+
"cwchar": "cpp",
20+
"cwctype": "cpp",
21+
"deque": "cpp",
22+
"unordered_map": "cpp",
23+
"vector": "cpp",
24+
"exception": "cpp",
25+
"algorithm": "cpp",
26+
"functional": "cpp",
27+
"iterator": "cpp",
28+
"memory": "cpp",
29+
"memory_resource": "cpp",
30+
"numeric": "cpp",
31+
"optional": "cpp",
32+
"random": "cpp",
33+
"ratio": "cpp",
34+
"string": "cpp",
35+
"string_view": "cpp",
36+
"system_error": "cpp",
37+
"tuple": "cpp",
38+
"type_traits": "cpp",
39+
"utility": "cpp",
40+
"fstream": "cpp",
41+
"initializer_list": "cpp",
42+
"iosfwd": "cpp",
43+
"istream": "cpp",
44+
"limits": "cpp",
45+
"new": "cpp",
46+
"ostream": "cpp",
47+
"sstream": "cpp",
48+
"stdexcept": "cpp",
49+
"streambuf": "cpp",
50+
"cinttypes": "cpp",
51+
"typeinfo": "cpp",
52+
"iomanip": "cpp"
53+
}
54+
}

0 commit comments

Comments
 (0)