Skip to content

Commit

Permalink
adjust project and make C++11 compability
Browse files Browse the repository at this point in the history
  • Loading branch information
mguludag committed Jun 23, 2024
1 parent 1ec577a commit 4951f62
Show file tree
Hide file tree
Showing 20 changed files with 1,386 additions and 318 deletions.
79 changes: 79 additions & 0 deletions .github/actions/build-docs/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: 'build-docs'
description: 'Builds documentation using Doxygen'
inputs:
cmake_target:
description: 'CMake documentation target'
required: true
docs_dir:
description: 'Path to documentation dir, relative to build_dir'
required: true
github_token:
description: 'GitHub token'
required: true
build_dir:
description: 'Build directory'
required: false
default: 'build'
cmake_configure_args:
description: 'Additional CMake configure arguments'
required: false
default: ''
destination_dir:
description: 'Directory name for deployed docs'
required: false
default: ''
docs_branch:
description: 'Documentation branch'
required: false
default: 'gh-pages'

outputs:
version:
description: 'Version of the generated docs'
value: ${{ steps.get-docs-version.outputs.version }}

runs:
using: "composite"
steps:
- name: Install deps
shell: bash
run: |
sudo apt install -y cmake
sudo apt install -y wget
cd ~
wget -nv https://www.doxygen.nl/files/doxygen-1.10.0.linux.bin.tar.gz
tar -xzf doxygen-1.10.0.linux.bin.tar.gz
echo "$(pwd)/doxygen-1.10.0/bin" >> $GITHUB_PATH
- name: CMake configuration
shell: bash
run: cmake ${{ inputs.cmake_configure_args }} -B ${{ inputs.build_dir }} -DENUM_NAME_BUILD_DOCS=ON

- name: CMake build
shell: bash
run: cmake --build ${{ inputs.build_dir }} --target ${{ inputs.cmake_target }}

- name: Get docs version
id: get-docs-version
shell: bash
run: |
subdir=$(basename $(find ${{ inputs.build_dir }}/${{ inputs.docs_dir }} -mindepth 1 -maxdepth 1 -type d | head -n 1))
echo "version=$subdir" >> $GITHUB_OUTPUT
- name: Deploy docs
if: ${{ inputs.destination_dir != '' }}
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ inputs.github_token }}
publish_dir: ${{ inputs.build_dir }}/${{ inputs.docs_dir }}/${{ steps.get-docs-version.outputs.version }}
destination_dir: ${{ inputs.destination_dir }}
publish_branch: ${{ inputs.docs_branch }}

- name: Deploy docs
if: ${{ inputs.destination_dir == '' }}
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ inputs.github_token }}
publish_dir: ${{ inputs.build_dir }}/${{ inputs.docs_dir }}/${{ steps.get-docs-version.outputs.version }}
destination_dir: ${{ steps.get-docs-version.outputs.version }}
publish_branch: ${{ inputs.docs_branch }}
54 changes: 54 additions & 0 deletions .github/actions/update-redirect-page/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: 'update-redirect-page'
description: 'Updates redirect HTML page'
inputs:
github_token:
description: 'GitHub token'
required: true
target_url:
description: 'Redirect target URL'
temp_dir:
description: 'Directory where redirect file will be generated'
required: false
default: 'redirect-dir'
file_name:
description: 'Generated file name'
required: false
default: 'index.html'
destination_dir:
description: 'Redirect file destination directory'
required: false
default: ''
docs_branch:
description: 'Documentation branch'
required: false
default: 'gh-pages'

runs:
using: "composite"
steps:
- name: Generate redirect HTML
shell: bash
run: |
mkdir ${{ inputs.temp_dir }}
cat << EOF > ${{ inputs.temp_dir }}/${{ inputs.file_name }}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="refresh" content="0; url=${{ inputs.target_url }}">
<title>Redirecting...</title>
</head>
<body>
<p>If you are not redirected automatically, <a href="${{ inputs.target_url }}">click here</a>.</p>
</body>
</html>
EOF
- name: Deploy redirect page
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ inputs.github_token }}
publish_dir: ${{ inputs.temp_dir }}
destination_dir: ${{ inputs.destination_dir }}
publish_branch: ${{ inputs.docs_branch }}
keep_files: true
56 changes: 56 additions & 0 deletions .github/actions/update-version-selector/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: 'update-version-selector'
description: 'Updates version selector'
inputs:
github_token:
description: 'GitHub token'
required: true
temp_dir:
description: 'Directory where version selector file will be generated'
required: false
default: 'selector-dir'
file_name:
description: 'Selector file name'
required: false
default: 'version_selector.html'
selector_id:
description: 'select element id'
required: false
default: 'versionSelector'
docs_branch:
description: 'Documentation branch'
required: false
default: 'gh-pages'
outputs:
versions_counter:
description: "Number of existing versions"
value: ${{ steps.discover-versions.outputs.counter }}

runs:
using: "composite"
steps:
- name: Discover versions
id: discover-versions
shell: bash
run: |
git fetch origin ${{ inputs.docs_branch }}
dirs=$(git ls-tree --name-only -d origin/${{ inputs.docs_branch }} | sort -rV)
echo "counter=$(echo "$dirs" | wc -l | xargs)" >> $GITHUB_OUTPUT
mkdir ${{ inputs.temp_dir }}
# Create HTML
echo '<select id="${{ inputs.selector_id }}">' > ${{ inputs.temp_dir }}/${{ inputs.file_name }}
for dir in $dirs; do
if [[ "$(basename "$dir")" != .* ]]; then
version=$(basename "$dir")
echo " <option value=\"$version\">$version</option>" >> ${{ inputs.temp_dir }}/${{ inputs.file_name }}
fi
done
echo '</select>' >> ${{ inputs.temp_dir }}/${{ inputs.file_name }}
- name: Deploy version selector
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ inputs.github_token }}
publish_dir: ${{ inputs.temp_dir }}
publish_branch: ${{ inputs.docs_branch }}
keep_files: true
4 changes: 4 additions & 0 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ jobs:
fail-fast: false
matrix:
config:
- { compiler: gcc, version: 9, build_type: Release, cppstd: 11 }
- { compiler: gcc, version: 9, build_type: Release, cppstd: 14 }
- { compiler: gcc, version: 9, build_type: Release, cppstd: 17 }
- { compiler: gcc, version: 11, build_type: Debug, cppstd: 20 }
- { compiler: gcc, version: 12, build_type: Release, cppstd: 20 }
- { compiler: clang, version: 11, build_type: Release, cppstd: 11 }
- { compiler: clang, version: 11, build_type: Release, cppstd: 14 }
- { compiler: clang, version: 11, build_type: Release, cppstd: 17 }
- { compiler: clang, version: 11, build_type: Debug, cppstd: 17, asan: OFF }
- { compiler: clang, version: 12, build_type: Debug, cppstd: 17, asan: OFF }
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/create-git-main-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Create git-main docs

permissions:
contents: write

on:
push:
branches:
- main

jobs:
create-git-main-docs:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4

- name: Build docs
id: build-docs
uses: ./.github/actions/build-docs
with:
cmake_target: 'doc'
docs_dir: 'doc/docs'
destination_dir: git-main
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Update version selector
id: update-version-selector
uses: ./.github/actions/update-version-selector
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Create redirect page if there are no releases
if: ${{ steps.update-version-selector.outputs.versions_counter == 1}}
uses: ./.github/actions/update-redirect-page
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
target_url: git-main/index.html
54 changes: 54 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"files.associations": {
"charconv": "cpp",
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"*.tcc": "cpp",
"cctype": "cpp",
"chrono": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"unordered_map": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"ratio": "cpp",
"string": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"initializer_list": "cpp",
"iosfwd": "cpp",
"istream": "cpp",
"limits": "cpp",
"new": "cpp",
"ostream": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"cinttypes": "cpp",
"typeinfo": "cpp",
"iomanip": "cpp"
}
}
Loading

0 comments on commit 4951f62

Please sign in to comment.