-
Notifications
You must be signed in to change notification settings - Fork 579
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into async_flash
- Loading branch information
Showing
67 changed files
with
5,749 additions
and
777 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,45 @@ | ||
# Doc: https://wiki.sc-corp.net/display/TOOL/ci.yaml+User+Guide | ||
version: 1 | ||
on: | ||
# https://wiki.sc-corp.net/display/TOOL/Onboard+Machamp+Build+By+ci.yaml+Configuration | ||
# on pull_request is used for any pr build | ||
pull_request: | ||
- workflows: | ||
# All builds that use machamp should use the defined `backend_workflow` | ||
- workflow_type: backend_workflow | ||
# references a build defined in build.yaml | ||
build_name: keydb-build | ||
arch_types: ["amd64", "arm64"] | ||
- branches: ['!!main', '*'] # this branch pattern means any branch but not main branch will trigger this pr build | ||
workflows: | ||
# All builds that use machamp should use the defined `backend_workflow` | ||
- workflow_type: backend_workflow | ||
# references a build defined in build.yaml | ||
build_name: keydb-build | ||
arch_types: ["amd64", "arm64"] | ||
- workflow_type: backend_workflow | ||
# references a build defined in build.yaml | ||
build_name: keydb-docker-build | ||
arch_types: ["amd64", "arm64"] | ||
# on push is used for release branch, meaning: trigger this build when there is commit pushed to this branch | ||
push: | ||
- branches: [main] | ||
workflows: | ||
- workflow_type: backend_workflow | ||
build_name: keydb-build | ||
arch_types: ["amd64", "arm64"] | ||
- workflow_type: backend_workflow | ||
# references a build defined in build.yaml | ||
build_name: keydb-docker-build | ||
arch_types: ["amd64", "arm64"] | ||
# Doc: go/cool-guide | ||
cool: | ||
workflows: | ||
- workflow_type: backend_workflow | ||
build_name: keydb-build | ||
arch_types: ["amd64", "arm64"] | ||
- workflow_type: backend_workflow | ||
# references a build defined in build.yaml | ||
build_name: keydb-docker-build | ||
arch_types: ["amd64", "arm64"] | ||
|
||
# below defines which branch is release branch / release tag | ||
machamp: | ||
releases: | ||
# Note: machamp will only respect the ci.yaml file from default branch for "release branch" definition (most repositories using master/main as default branch) | ||
# https://wiki.sc-corp.net/display/TOOL/Onboard+Machamp+Build+By+ci.yaml+Configuration | ||
- branch_name: ^main$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
AccessModifierOffset: -4 | ||
AllowAllParametersOfDeclarationOnNextLine: false | ||
AllowShortFunctionsOnASingleLine: Empty | ||
BinPackArguments: false | ||
BinPackParameters: false | ||
ColumnLimit: 120 | ||
IndentCaseLabels: false | ||
IndentWidth: 4 | ||
|
||
--- | ||
Language: Cpp | ||
# BasedOnStyle: Google | ||
#AccessModifierOffset: -1 | ||
AlignAfterOpenBracket: Align | ||
AlignConsecutiveAssignments: false | ||
AlignConsecutiveDeclarations: false | ||
AlignEscapedNewlinesLeft: true | ||
AlignOperands: true | ||
AlignTrailingComments: true | ||
#AllowAllParametersOfDeclarationOnNextLine: true | ||
AllowShortBlocksOnASingleLine: false | ||
AllowShortCaseLabelsOnASingleLine: false | ||
#AllowShortFunctionsOnASingleLine: All | ||
AllowShortIfStatementsOnASingleLine: true | ||
AllowShortLoopsOnASingleLine: true | ||
AlwaysBreakAfterDefinitionReturnType: None | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakBeforeMultilineStrings: true | ||
AlwaysBreakTemplateDeclarations: true | ||
#BinPackArguments: true | ||
#BinPackParameters: true | ||
BraceWrapping: | ||
AfterClass: false | ||
AfterControlStatement: false | ||
AfterEnum: false | ||
AfterFunction: false | ||
AfterNamespace: false | ||
AfterObjCDeclaration: false | ||
AfterStruct: false | ||
AfterUnion: false | ||
BeforeCatch: false | ||
BeforeElse: false | ||
IndentBraces: false | ||
BreakBeforeBinaryOperators: None | ||
BreakBeforeBraces: Attach | ||
BreakBeforeTernaryOperators: true | ||
BreakConstructorInitializersBeforeComma: false | ||
BreakAfterJavaFieldAnnotations: false | ||
BreakStringLiterals: true | ||
#ColumnLimit: 80 | ||
CommentPragmas: '^ IWYU pragma:' | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: true | ||
ConstructorInitializerIndentWidth: 4 | ||
ContinuationIndentWidth: 4 | ||
Cpp11BracedListStyle: true | ||
DerivePointerAlignment: true | ||
DisableFormat: false | ||
ExperimentalAutoDetectBinPacking: false | ||
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] | ||
IncludeCategories: | ||
- Regex: '^<.*\.h>' | ||
Priority: 1 | ||
- Regex: '^<.*' | ||
Priority: 2 | ||
- Regex: '.*' | ||
Priority: 3 | ||
IncludeIsMainRegex: '([-_](test|unittest))?$' | ||
#IndentCaseLabels: true | ||
#IndentWidth: 2 | ||
IndentWrappedFunctionNames: false | ||
JavaScriptQuotes: Leave | ||
JavaScriptWrapImports: true | ||
KeepEmptyLinesAtTheStartOfBlocks: false | ||
MacroBlockBegin: '' | ||
MacroBlockEnd: '' | ||
MaxEmptyLinesToKeep: 1 | ||
NamespaceIndentation: None | ||
ObjCBlockIndentWidth: 2 | ||
ObjCSpaceAfterProperty: false | ||
ObjCSpaceBeforeProtocolList: false | ||
PenaltyBreakBeforeFirstCallParameter: 1 | ||
PenaltyBreakComment: 300 | ||
PenaltyBreakFirstLessLess: 120 | ||
PenaltyBreakString: 1000 | ||
PenaltyExcessCharacter: 1000000 | ||
PenaltyReturnTypeOnItsOwnLine: 200 | ||
PointerAlignment: Left | ||
ReflowComments: true | ||
SortIncludes: true | ||
SpaceAfterCStyleCast: false | ||
SpaceAfterTemplateKeyword: true | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeParens: ControlStatements | ||
SpaceInEmptyParentheses: false | ||
SpacesBeforeTrailingComments: 2 | ||
SpacesInAngles: false | ||
SpacesInContainerLiterals: true | ||
SpacesInCStyleCastParentheses: false | ||
SpacesInParentheses: false | ||
SpacesInSquareBrackets: false | ||
Standard: Auto | ||
TabWidth: 8 | ||
UseTab: Never | ||
... | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Coverage | ||
|
||
on: [push, pull_request] | ||
jobs: | ||
coverage: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: dependencies | ||
shell: bash | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y -qq make cmake gcc g++ lcov bc | ||
- name: build | ||
shell: bash | ||
run: | | ||
export LD_LIBRARY_PATH=.:$(cat /etc/ld.so.conf.d/* | grep -vF "#" | tr "\\n" ":" | sed -e "s/:$//g") | ||
cmake . -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=On | ||
make all -j$(nproc) | ||
- name: coverage | ||
shell: bash | ||
run: | | ||
make coverage | ||
lines=$(lcov --summary coverage.info | grep -F lines | awk '{print $2}' | sed -e "s/%//g") | ||
if (( $(echo "${lines} < ${COVERAGE_THRESHOLD}" | bc -l) )); then | ||
echo "Line coverage dropped below ${COVERAGE_THRESHOLD}% to ${lines}%" | ||
exit 1 | ||
fi | ||
env: | ||
COVERAGE_THRESHOLD: 85.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: Lint | ||
|
||
on: [push, pull_request] | ||
jobs: | ||
lint: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: lint | ||
uses: DoozyX/clang-format-lint-action@v0.12 | ||
with: | ||
clangFormatVersion: 12 | ||
source: './include/cpp-statsd-client ./tests' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Linux | ||
|
||
on: [push, pull_request] | ||
jobs: | ||
linux: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: dependencies | ||
shell: bash | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y -qq make cmake gcc g++ | ||
- name: build | ||
shell: bash | ||
run: | | ||
export LD_LIBRARY_PATH=.:$(cat /etc/ld.so.conf.d/* | grep -vF "#" | tr "\\n" ":" | sed -e "s/:$//g") | ||
cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_SANITIZERS=On | ||
make all -j$(nproc) | ||
- name: test | ||
shell: bash | ||
run: | | ||
make test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Windows | ||
|
||
on: [push, pull_request] | ||
jobs: | ||
windows: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: dependencies | ||
run: | | ||
choco install cmake | ||
- name: build | ||
run: | | ||
cmake -S . -B build -G "Visual Studio 16 2019" -A x64 | ||
cmake --build build --target ALL_BUILD --config Release | ||
- name: test | ||
run: | | ||
cmake --build build --target RUN_TESTS --config Release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# Basic project setup | ||
cmake_minimum_required(VERSION 3.5) | ||
project(cpp-statsd-client | ||
VERSION 1.0.2 | ||
LANGUAGES CXX | ||
DESCRIPTION "A header-only StatsD client implemented in C++" | ||
HOMEPAGE_URL "https://github.com/vthiery/cpp-statsd-client") | ||
|
||
option(CPP_STATSD_STANDALONE "Allows configuration of targets for verifying library functionality" ON) | ||
option(ENABLE_TESTS "Build tests" ON) | ||
option(ENABLE_COVERAGE "Build with coverage instrumentalisation" OFF) | ||
|
||
if(NOT CPP_STATSD_STANDALONE) | ||
set(ENABLE_TESTS OFF) | ||
set(ENABLE_COVERAGE OFF) | ||
endif() | ||
|
||
include(GNUInstallDirs) | ||
include(CMakePackageConfigHelpers) | ||
find_package(Threads) | ||
|
||
# Optional code coverage targets | ||
if(ENABLE_COVERAGE) | ||
set(COVERAGE_EXCLUDES /usr/*) | ||
include(${PROJECT_SOURCE_DIR}/cmake/CodeCoverage.cmake) | ||
APPEND_COVERAGE_COMPILER_FLAGS() | ||
SETUP_TARGET_FOR_COVERAGE_LCOV(NAME coverage | ||
EXECUTABLE testStatsdClient | ||
DEPENDENCIES ${PROJECT_NAME} | ||
) | ||
endif() | ||
|
||
# The library target | ||
add_library(${PROJECT_NAME} INTERFACE) | ||
target_include_directories( | ||
${PROJECT_NAME} | ||
INTERFACE $<BUILD_INTERFACE:${${PROJECT_NAME}_SOURCE_DIR}/include> | ||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) | ||
target_link_libraries(${PROJECT_NAME} INTERFACE Threads::Threads) | ||
if(WIN32) | ||
target_link_libraries(${PROJECT_NAME} INTERFACE ws2_32) | ||
endif() | ||
|
||
# The installation and pkg-config-like cmake config | ||
install(TARGETS ${PROJECT_NAME} | ||
EXPORT ${PROJECT_NAME}_Targets | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) | ||
write_basic_package_version_file("${PROJECT_NAME}ConfigVersion.cmake" | ||
VERSION ${PROJECT_VERSION} | ||
COMPATIBILITY SameMajorVersion) | ||
configure_package_config_file( | ||
"${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}Config.cmake.in" | ||
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" | ||
INSTALL_DESTINATION | ||
${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/cmake) | ||
install(EXPORT ${PROJECT_NAME}_Targets | ||
FILE ${PROJECT_NAME}Targets.cmake | ||
NAMESPACE ${PROJECT_NAME}:: | ||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/cmake) | ||
install(FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" | ||
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" | ||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/cmake) | ||
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include DESTINATION include) | ||
|
||
if(ENABLE_TESTS) | ||
# The test targets | ||
add_executable(testStatsdClient ${CMAKE_CURRENT_SOURCE_DIR}/tests/testStatsdClient.cpp) | ||
if(WIN32) | ||
target_compile_options(testStatsdClient PRIVATE -W4 -WX /external:W0) | ||
else() | ||
target_compile_options(testStatsdClient PRIVATE -Wall -Wextra -pedantic -Werror) | ||
endif() | ||
target_include_directories(testStatsdClient PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/tests) | ||
target_link_libraries(testStatsdClient ${PROJECT_NAME}) | ||
|
||
set_property(TARGET testStatsdClient PROPERTY CXX_STANDARD 11) | ||
set_property(TARGET testStatsdClient PROPERTY CXX_EXTENSIONS OFF) | ||
|
||
# The test suite | ||
enable_testing() | ||
add_test(ctestTestStatsdClient testStatsdClient) | ||
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} DEPENDS testStatsdClient) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
MIT License | ||
|
||
Copyright (c) 2017 Vincent Thiery | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
Oops, something went wrong.