Skip to content

Commit

Permalink
Merge pull request #7 from emrekovanci/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
emrekovanci committed Apr 27, 2024
2 parents a5a29c1 + ec7dc64 commit 1bbfd38
Show file tree
Hide file tree
Showing 20 changed files with 870 additions and 446 deletions.
3 changes: 1 addition & 2 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ IncludeCategories:
# C++ standard headers
- Priority: 4
Regex: '<[[:alnum:]_-]+>'
SortIncludes: Never
SortIncludes: CaseSensitive
SortUsingDeclarations: true

# Pointer & Reference Alignment
Expand Down Expand Up @@ -131,5 +131,4 @@ InsertNewlineAtEOF: true
# Qualifiers (const, volatile, static, etc)
QualifierAlignment: Custom
QualifierOrder: ['static', 'inline', 'constexpr', 'const', 'volatile', 'type']

...
26 changes: 15 additions & 11 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
---
Checks: >
-*,
bugprone-*,
clang-analyzer-*,
misc-*,
modernize-*,
performance-*,
portability-*,
readability-*,
-bugprone-narrowing-conversions,
*,
-altera-*,
-cppcoreguidelines-avoid-magic-numbers,
-fuchsia-*,
fuchsia-multiple-inheritance,
-hicpp-uppercase-literal-suffix,
-llvmlibc-*,
-misc-non-private-member-variables-in-classes,
-modernize-use-nodiscard,
-modernize-use-trailing-return-type,
-readability-identifier-length,
-readability-implicit-bool-conversion,
-readability-magic-numbers,
-readability-redundant-access-specifiers,
-readability-uppercase-literal-suffix,
CheckOptions:
- { key: bugprone-misplaced-widening-cast.CheckImplicitCasts, value: true }
- { key: bugprone-sizeof-expression.WarnOnSizeOfIntegerExpression, value: true }
- { key: bugprone-suspicious-string-compare.WarnOnLogicalNotComparison, value: true }
- { key: readability-uniqueptr-delete-release.PreferResetCall, value: true }
- { key: cppcoreguidelines-narrowing-conversions.PedanticMode, value: true }
# Identifier styles
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
- { key: readability-identifier-naming.FunctionCase, value: camelBack }
- { key: readability-identifier-naming.VariableCase, value: camelBack }
Expand All @@ -28,3 +31,4 @@ CheckOptions:
HeaderFilterRegex: '^.*/(app|library)/.*(h|hpp)$'
WarningsAsErrors: '*'
UseColor: true
...
2 changes: 1 addition & 1 deletion .clangd
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Diagnostics:

# Ignore packages that installed by vcpkg
If:
PathMatch: out/.*
PathMatch: (out|build).*
Diagnostics:
Suppress: '*'
UnusedIncludes: None
Expand Down
6 changes: 6 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[codespell]
builtin = clear,rare,en-GB_to_en-US,names,informal,code
check-filenames =
check-hidden =
skip = */.git,*/build,*/.vscode
quiet-level = 2
9 changes: 5 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,24 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*{c,cpp,cxx,h,hpp,hxx,cmake}]
charset = utf-8
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[CMakeLists.txt]
charset = utf-8
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.yml]
indent_size = 2

[*.json]
indent_size = 4

[{.clangd,.clang-format,.clang-tidy}]
indent_size = 2
161 changes: 70 additions & 91 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: ci

permissions:
contents: write

on:
push:
branches:
Expand All @@ -10,53 +13,76 @@ on:
types: [published]
workflow_dispatch:

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VCPKG_FEATURE_FLAGS: dependencygraph

jobs:
build:
name: ${{ matrix.os }} ${{ matrix.compiler }} ${{ matrix.build_type }} ${{ matrix.config.name }}
lint:
runs-on: ubuntu-22.04

env:
CLANG_FORMAT_VERSION: 17

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Install Clang-Format
uses: aminya/setup-cpp@v1
with:
clangformat: ${{ env.CLANG_FORMAT_VERSION }}

- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.8"

- name: Install codespell
run: pip3 install codespell

- name: Format Code
run: cmake -DCLANG_FORMAT_EXECUTABLE=clang-format-${{ env.CLANG_FORMAT_VERSION }} -P cmake/Format.cmake

- name: Check Formatting
run: git diff --color --exit-code

- name: Spell Check
if: always()
run: cmake -P cmake/CodeSpell.cmake

- name: Format Vcpkg.json
if: always()
run: vcpkg format-manifest ./vcpkg.json

test:
needs: [lint]

name: ${{ matrix.platform.os }} ${{ matrix.platform.generator }} ${{ matrix.platform.compiler }} ${{ matrix.config.name }} ${{ matrix.type.name }}
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.platform.os }}
timeout-minutes: 120

strategy:
fail-fast: false

# https://github.com/actions/runner-images
matrix:
os:
- ubuntu-22.04
- macos-13
- windows-2022
compiler:
- llvm
- gcc
build_type:
- Debug
- Release
platform:
- { os: windows-2022, generator: vs2022, compiler: msvc, preset: windows-vs2022 }
- { os: windows-2022, generator: vs2022, compiler: llvm, preset: windows-vs2022-clangcl }
- { os: windows-2022, generator: ninja, compiler: msvc, preset: windows-ninja }
- { os: windows-2022, generator: ninja, compiler: llvm, preset: windows-ninja-clangcl }
- { os: ubuntu-22.04, generator: ninja, compiler: gcc, preset: linux-ninja-gcc }
- { os: ubuntu-22.04, generator: ninja, compiler: llvm, preset: linux-ninja-clang }
- { os: macos-13, generator: ninja, compiler: llvm, preset: mac-ninja-clang }
- { os: macos-13, generator: xcode, compiler: llvm, preset: mac-xcode-clang }
config:
- { name: Shared, flags: -DBUILD_SHARED_LIBS=TRUE }
- { name: Static, flags: -DBUILD_SHARED_LIBS=FALSE }

exclude:
- os: windows-2022
compiler: gcc
- os: macos-13
compiler: gcc

include:
- os: windows-2022
compiler: msvc
build_type: Debug
config: { name: Shared, flags: -DBUILD_SHARED_LIBS=TRUE }
- os: windows-2022
compiler: msvc
build_type: Debug
config: { name: Static, flags: -DBUILD_SHARED_LIBS=FALSE }
- os: windows-2022
compiler: msvc
build_type: Release
config: { name: Shared, flags: -DBUILD_SHARED_LIBS=TRUE }
- os: windows-2022
compiler: msvc
build_type: Release
config: { name: Static, flags: -DBUILD_SHARED_LIBS=FALSE }
type:
- { name: Debug, flags: -DCMAKE_BUILD_TYPE=Debug }
- { name: Release, flags: -DCMAKE_BUILD_TYPE=Release }

steps:
- name: Checkout Code
Expand All @@ -65,71 +91,24 @@ jobs:
- name: Install Cpp Environment
uses: aminya/setup-cpp@v1
with:
compiler: ${{ matrix.compiler }}
vcvarsall: ${{ contains(matrix.os, 'windows') }}
compiler: ${{ matrix.platform.compiler }}
vcvarsall: ${{ contains(matrix.platform.os, 'windows') }}
cmake: true
ninja: true
vcpkg: true
clangtidy: true
cppcheck: true

- name: CMake Configure
env:
VCPKG_ROOT: '~/vcpkg'
shell: bash
run: |
if [ "${{ runner.os }}" == "Windows" ]; then
cmake --preset=Windows-${{ matrix.compiler }}-${{ matrix.build_type }} ${{ matrix.config.flags }}
else
cmake --preset=${{ matrix.compiler }}-${{ matrix.build_type }} ${{ matrix.config.flags }}
fi
run: cmake --preset=${{ matrix.platform.preset }} ${{ matrix.config.flags }} ${{ matrix.type.flags }} -DVCPKG_MANIFEST_FEATURES=tests -DFEATURE_TESTS=ON

- name: CMake Build
shell: bash
run: |
if [ "${{ runner.os }}" == "Windows" ]; then
cmake --build --preset=Windows-${{ matrix.compiler }}-${{ matrix.build_type }}
else
cmake --build --preset=${{ matrix.compiler }}-${{ matrix.build_type }}
fi
- name: Install
shell: bash
run: |
if [ "${{ runner.os }}" == "Windows" ]; then
cmake --install out/build/Windows-${{ matrix.compiler }}-${{ matrix.build_type }} --prefix prefix
else
cmake --install out/build/${{ matrix.compiler }}-${{ matrix.build_type }} --prefix prefix
fi
run: cmake --build --preset=${{ matrix.platform.preset }} --config ${{ matrix.type.name }}

- name: Test
if: ${{ matrix.build_type == 'Debug' }}
shell: bash
run: |
if [ "${{ runner.os }}" == "Windows" ]; then
ctest --preset=test-Windows-${{ matrix.compiler }}-${{ matrix.build_type }}
else
ctest --preset=test-${{ matrix.compiler }}-${{ matrix.build_type }}
fi
format:
name: Formatting
runs-on: ubuntu-22.04
env:
CLANG_FORMAT_VERSION: 17

strategy:
fail-fast: false

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Install Clang-Format
uses: aminya/setup-cpp@v1
with:
clangformat: ${{ env.CLANG_FORMAT_VERSION }}

- name: Format Code
run: cmake -DCLANG_FORMAT_EXECUTABLE=clang-format-${{ env.CLANG_FORMAT_VERSION }} -P cmake/Format.cmake

- name: Check Formatting
run: git diff --color --exit-code
run: ctest --preset=${{ matrix.platform.preset }} -C ${{ matrix.type.name }}
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@ out/

# ide folders
.vs/
.vscode/
.idea/

# vscode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace

# cmake
compile_commands.json

Expand Down
10 changes: 10 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"recommendations": [
"ms-vscode.cmake-tools",
"twxs.cmake",
"ms-vscode.cpptools",
"llvm-vs-code-extensions.vscode-clangd",
"EditorConfig.EditorConfig",
"IBM.output-colorizer",
]
}
Loading

0 comments on commit 1bbfd38

Please sign in to comment.