Skip to content

Commit

Permalink
introduce bitmask support and std::format specialization
Browse files Browse the repository at this point in the history
  • Loading branch information
mguludag authored Nov 19, 2024
1 parent 0e5b19f commit 17ee731
Show file tree
Hide file tree
Showing 37 changed files with 2,762 additions and 833 deletions.
42 changes: 42 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
Checks: >-
bugprone-*,
cppcoreguidelines-*,
google-*,
misc-*,
modernize-*,
performance-*,
readability-*,
-bugprone-lambda-function-name,
-bugprone-reserved-identifier,
-cppcoreguidelines-avoid-goto,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-avoid-non-const-global-variables,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-cppcoreguidelines-pro-type-vararg,
-google-readability-braces-around-statements,
-google-readability-function-size,
-misc-no-recursion,
-modernize-return-braced-init-list,
-modernize-use-nodiscard,
-modernize-use-trailing-return-type,
-performance-unnecessary-value-param,
-readability-magic-numbers,
CheckOptions:
- key: readability-function-cognitive-complexity.Threshold
value: 100
- key: readability-function-cognitive-complexity.IgnoreMacros
value: true
# Set naming conventions for your style below (there are dozens of naming settings possible):
# See https://clang.llvm.org/extra/clang-tidy/checks/readability/identifier-naming.html
# - key: readability-identifier-naming.ClassCase
# value: CamelCase
# - key: readability-identifier-naming.NamespaceCase
# value: lower_case
# - key: readability-identifier-naming.PrivateMemberSuffix
# value: _
# - key: readability-identifier-naming.StructCase
# value: CamelCase

WarningsAsErrors: '*'
HeaderFilterRegex: '.*'
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
50 changes: 44 additions & 6 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,31 @@ name: C/C++ CI

on:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
branches: [ "main" ]
branches: ["main"]

jobs:
windows-build:
runs-on: windows-latest

strategy:
matrix:
cpp_standard: [11, 17, 20, 23]

steps:
- name: Checkout code
uses: actions/checkout@main

- name: Set up MSVC and build
run: |
set PATH="%PATH%;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSVC\14.29.30037\bin\Hostx64\x64"
mkdir build
cd build
cmake -DCMAKE_CXX_STANDARD=${{ matrix.cpp_standard }} ..
cmake --build . --config Release
ctest -j2 --output-on-failure -C Release
build_linux:
runs-on: ubuntu-latest
defaults:
Expand All @@ -19,14 +39,32 @@ jobs:
- { 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: 10, 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 }
- { compiler: clang, version: 15, build_type: Release, cppstd: 20, asan: OFF }
- {
compiler: clang,
version: 11,
build_type: Debug,
cppstd: 17,
asan: OFF,
}
- {
compiler: clang,
version: 12,
build_type: Debug,
cppstd: 17,
asan: OFF,
}
- {
compiler: clang,
version: 15,
build_type: Release,
cppstd: 20,
asan: OFF,
}
container:
image: ${{ matrix.config.compiler == 'clang' && 'teeks99/clang-ubuntu' || matrix.config.compiler }}:${{ matrix.config.version }}
name: "${{ matrix.config.compiler}} ${{ matrix.config.version }} (C++${{ matrix.config.cppstd }}, ${{ matrix.config.build_type }})"
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
24 changes: 24 additions & 0 deletions .github/workflows/trunk-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Push
on: [push, pull_request, workflow_dispatch]
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions: read-all

jobs:
trunk_check:
name: Trunk Check Runner
runs-on: ubuntu-latest
permissions:
checks: write # For trunk to post annotations
contents: read # For repo checkout

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Trunk Check
uses: trunk-io/trunk-action@v1
with:
check-mode: all
9 changes: 9 additions & 0 deletions .trunk/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*out
*logs
*actions
*notifications
*tools
plugins
user_trunk.yaml
user.yaml
tmp
Loading

0 comments on commit 17ee731

Please sign in to comment.