From 41c038a86b7a6a9977040b9f6edb82fce1c120fc Mon Sep 17 00:00:00 2001 From: Bulat Gayazov Date: Fri, 28 Mar 2025 17:50:56 +0000 Subject: [PATCH 01/12] Added gcc workflow --- .github/actions/build/action.yaml | 14 +++-- .github/workflows/examples.yaml | 9 ++- .github/workflows/tests.yaml | 23 +++++--- .github/workflows/warmup_cache.yaml | 9 ++- CMakePresets.json | 91 ++++++++++++++++++++++++++--- gcc.toolchain | 12 ++++ 6 files changed, 134 insertions(+), 24 deletions(-) create mode 100644 gcc.toolchain diff --git a/.github/actions/build/action.yaml b/.github/actions/build/action.yaml index 404fda1888..0afb3be787 100644 --- a/.github/actions/build/action.yaml +++ b/.github/actions/build/action.yaml @@ -1,20 +1,26 @@ name: Build description: Build YDB SDK +inputs: + compiler: + description: 'Compiler to use (clang or gcc)' + required: true + default: 'clang' + runs: using: "composite" steps: - name: Configure shell: bash run: | - mkdir -p ../build - rm -rf ../build/* - cmake --preset release-test-with-ccache-basedir + mkdir -p ../build${{ inputs.compiler == 'gcc' && '-gcc' || '' }} + rm -rf ../build${{ inputs.compiler == 'gcc' && '-gcc' || '' }}/* + cmake --preset release-test-with-ccache-basedir${{ inputs.compiler == 'gcc' && '-gcc' || '' }} - name: Build shell: bash run: | ccache -z export CCACHE_BASEDIR=`realpath ..` export CCACHE_DIR=~/.ccache - cmake --build --preset release -- -j32 + cmake --build --preset release${{ inputs.compiler == 'gcc' && '-gcc' || '' }} -- -j32 ccache -s diff --git a/.github/workflows/examples.yaml b/.github/workflows/examples.yaml index c53b2f1bb9..2520de0d78 100644 --- a/.github/workflows/examples.yaml +++ b/.github/workflows/examples.yaml @@ -18,6 +18,7 @@ jobs: fail-fast: false matrix: ydb-version: [24.1, trunk] + compiler: [clang, gcc] services: ydb: image: ydbplatform/local-ydb:${{ matrix.ydb-version }} @@ -56,15 +57,17 @@ jobs: uses: actions/cache/restore@v4 with: path: ~/.ccache - key: ubuntu-22.04-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}} + key: ubuntu-22.04-ccache-${{ matrix.compiler }}-${{steps.ccache_cache_timestamp.outputs.timestamp }} restore-keys: | - ubuntu-22.04-ccache- + ubuntu-22.04-ccache-${{ matrix.compiler }}- - name: Build uses: ./.github/actions/build + with: + compiler: ${{ matrix.compiler }} - name: Launch basic example shell: bash run: | - cd ../build + cd ../build${{ matrix.compiler == 'gcc' && '-gcc' || '' }} examples/basic_example/basic_example -e localhost:2136 -d /local examples/bulk_upsert_simple/bulk_upsert_simple -e localhost:2136 -d /local -p /local/bulk examples/pagination/pagination -e localhost:2136 -d /local -p /local/pagination diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index fe40c3407e..1b574511c4 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -13,10 +13,12 @@ concurrency: jobs: unit: concurrency: - group: unit-${{ github.ref }}-${{ matrix.os }} + group: unit-${{ github.ref }}-${{ matrix.os }}-${{ matrix.compiler }} cancel-in-progress: true strategy: fail-fast: false + matrix: + compiler: [clang, gcc] env: OS: ubuntu-22.04 runs-on: ubuntu-22.04 @@ -44,25 +46,28 @@ jobs: uses: actions/cache/restore@v4 with: path: ~/.ccache - key: ubuntu-22.04-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}} + key: ubuntu-22.04-ccache-${{ matrix.compiler }}-${{steps.ccache_cache_timestamp.outputs.timestamp }} restore-keys: | - ubuntu-22.04-ccache- + ubuntu-22.04-ccache-${{ matrix.compiler }}- - name: Build uses: ./.github/actions/build + with: + compiler: ${{ matrix.compiler }} - name: Test shell: bash run: | - ctest -j32 --preset release-unit + ctest -j32 --preset release-unit${{ matrix.compiler == 'gcc' && '-gcc' || '' }} integration: concurrency: - group: integration-${{ github.ref }}-${{ matrix.ydb-version }} + group: integration-${{ github.ref }}-${{ matrix.ydb-version }}-${{ matrix.compiler }} cancel-in-progress: true runs-on: ubuntu-22.04 strategy: fail-fast: false matrix: ydb-version: [23.3, 24.1, trunk] + compiler: [clang, gcc] services: ydb: image: ydbplatform/local-ydb:${{ matrix.ydb-version }} @@ -101,12 +106,14 @@ jobs: uses: actions/cache/restore@v4 with: path: ~/.ccache - key: ubuntu-22.04-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}} + key: ubuntu-22.04-ccache-${{ matrix.compiler }}-${{steps.ccache_cache_timestamp.outputs.timestamp }} restore-keys: | - ubuntu-22.04-ccache- + ubuntu-22.04-ccache-${{ matrix.compiler }}- - name: Build uses: ./.github/actions/build + with: + compiler: ${{ matrix.compiler }} - name: Test shell: bash run: | - ctest -j32 --preset release-integration + ctest -j32 --preset release-integration${{ matrix.compiler == 'gcc' && '-gcc' || '' }} diff --git a/.github/workflows/warmup_cache.yaml b/.github/workflows/warmup_cache.yaml index df6bcf1111..00a485187f 100644 --- a/.github/workflows/warmup_cache.yaml +++ b/.github/workflows/warmup_cache.yaml @@ -9,6 +9,9 @@ jobs: main: name: Build YDB C++ SDK and cache artifacts runs-on: ubuntu-22.04 + strategy: + matrix: + compiler: [clang, gcc] steps: - name: Checkout uses: actions/checkout@v3 @@ -27,8 +30,10 @@ jobs: uses: actions/cache@v4 with: path: ~/.ccache - key: ubuntu-22.04-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}} + key: ubuntu-22.04-ccache-${{ matrix.compiler }}-${{steps.ccache_cache_timestamp.outputs.timestamp }} restore-keys: | - ubuntu-22.04-ccache- + ubuntu-22.04-ccache-${{ matrix.compiler }}- - name: Build uses: ./.github/actions/build + with: + compiler: ${{ matrix.compiler }} diff --git a/CMakePresets.json b/CMakePresets.json index 7619864d8c..112ff5f34c 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -30,6 +30,11 @@ "hidden": true, "toolchainFile": "${sourceDir}/clang.toolchain" }, + { + "name": "gcc-toolchain", + "hidden": true, + "toolchainFile": "${sourceDir}/gcc.toolchain" + }, { "name": "release", "inherits": [ @@ -37,36 +42,72 @@ "release-build", "clang-toolchain" ], - "displayName": "Default Release Config", + "displayName": "Default Release Config (Clang)", "description": "Default release build configuration using Ninja generator and Clang compiler", "binaryDir": "${sourceDir}/../build" }, + { + "name": "release-gcc", + "inherits": [ + "ninja-generator", + "release-build", + "gcc-toolchain" + ], + "displayName": "Default Release Config (GCC)", + "description": "Default release build configuration using Ninja generator and GCC compiler", + "binaryDir": "${sourceDir}/../build-gcc" + }, { "name": "release-test", "inherits": "release", - "displayName": "Default Release Test Config", + "displayName": "Default Release Test Config (Clang)", "description": "Default release build configuration with all tests and examples", "cacheVariables": { "YDB_SDK_TESTS": "TRUE", "YDB_SDK_EXAMPLES": "TRUE" } }, + { + "name": "release-test-gcc", + "inherits": "release-gcc", + "displayName": "Default Release Test Config (GCC)", + "description": "Default release build configuration with all tests and examples using GCC", + "cacheVariables": { + "YDB_SDK_TESTS": "TRUE", + "YDB_SDK_EXAMPLES": "TRUE" + } + }, { "name": "release-test-with-ccache-basedir", "inherits": "release-test", - "displayName": "Release Test Config CCACHE_BASEDIR Case", + "displayName": "Release Test Config CCACHE_BASEDIR Case (Clang)", "description": "Only for the case when using CCACHE_BASEDIR", "cacheVariables": { "ARCADIA_ROOT": "../ydb-cpp-sdk", "ARCADIA_BUILD_ROOT": "." } + }, + { + "name": "release-test-with-ccache-basedir-gcc", + "inherits": "release-test-gcc", + "displayName": "Release Test Config CCACHE_BASEDIR Case (GCC)", + "description": "Only for the case when using CCACHE_BASEDIR with GCC", + "cacheVariables": { + "ARCADIA_ROOT": "../ydb-cpp-sdk", + "ARCADIA_BUILD_ROOT": "." + } } ], "buildPresets": [ { "name": "release", "configurePreset": "release", - "displayName": "Default Release Build" + "displayName": "Default Release Build (Clang)" + }, + { + "name": "release-gcc", + "configurePreset": "release-gcc", + "displayName": "Default Release Build (GCC)" } ], "testPresets": [ @@ -84,7 +125,17 @@ "name": "release", "inherits": "common", "configurePreset": "release-test", - "displayName": "Default Release Tests", + "displayName": "Default Release Tests (Clang)", + "environment": { + "YDB_ENDPOINT": "localhost:2136", + "YDB_DATABASE": "/local" + } + }, + { + "name": "release-gcc", + "inherits": "common", + "configurePreset": "release-test-gcc", + "displayName": "Default Release Tests (GCC)", "environment": { "YDB_ENDPOINT": "localhost:2136", "YDB_DATABASE": "/local" @@ -94,7 +145,18 @@ "name": "release-unit", "inherits": "common", "configurePreset": "release-test", - "displayName": "Default Unit Release Tests", + "displayName": "Default Unit Release Tests (Clang)", + "filter" : { + "include": { + "label": "unit" + } + } + }, + { + "name": "release-unit-gcc", + "inherits": "common", + "configurePreset": "release-test-gcc", + "displayName": "Default Unit Release Tests (GCC)", "filter" : { "include": { "label": "unit" @@ -105,7 +167,22 @@ "name": "release-integration", "inherits": "common", "configurePreset": "release-test", - "displayName": "Default Integration Release Tests", + "displayName": "Default Integration Release Tests (Clang)", + "filter" : { + "include": { + "label": "integration" + } + }, + "environment": { + "YDB_ENDPOINT": "localhost:2136", + "YDB_DATABASE": "/local" + } + }, + { + "name": "release-integration-gcc", + "inherits": "common", + "configurePreset": "release-test-gcc", + "displayName": "Default Integration Release Tests (GCC)", "filter" : { "include": { "label": "integration" diff --git a/gcc.toolchain b/gcc.toolchain new file mode 100644 index 0000000000..6711f1c094 --- /dev/null +++ b/gcc.toolchain @@ -0,0 +1,12 @@ +set(CMAKE_C_COMPILER gcc) +set(CMAKE_CXX_COMPILER g++) +set(CMAKE_EXE_LINKER_FLAGS "-rdynamic") +set(CMAKE_SHARED_LINKER_FLAGS "") +set(CMAKE_C_STANDARD_LIBRARIES "-lc -lm") +set(CMAKE_CXX_STANDARD_LIBRARIES "-lc -lm") + +set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -UNDEBUG" CACHE STRING "C compiler flags") +set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -UNDEBUG" CACHE STRING "C++ compiler flags") + +set(ENV{CC} gcc) +set(ENV{CXX} g++) \ No newline at end of file From 2b86b06922493912160e478d698c49f3bbbe8647 Mon Sep 17 00:00:00 2001 From: Bulat Gayazov Date: Wed, 2 Apr 2025 02:21:45 +0000 Subject: [PATCH 02/12] Added CI check for GCC --- .github/actions/build/action.yaml | 8 +- .github/actions/prepare_vm/action.yaml | 10 +- .github/workflows/tests.yaml | 4 +- .gitignore | 1 + CMakeLists.txt | 12 ++- CMakePresets.json | 102 +++++++----------- clang.toolchain | 12 --- gcc.toolchain | 12 --- include/ydb-cpp-sdk/client/CMakeLists.txt | 1 + .../client/rate_limiter/rate_limiter.h | 4 + .../ydb-cpp-sdk/client/topic/CMakeLists.txt | 27 +++++ src/client/topic/CMakeLists.txt | 20 +--- src/client/topic/impl/CMakeLists.txt | 2 + .../topic/{ => impl}/proto_accessor.cpp | 0 14 files changed, 94 insertions(+), 121 deletions(-) delete mode 100644 clang.toolchain delete mode 100644 gcc.toolchain create mode 100644 include/ydb-cpp-sdk/client/topic/CMakeLists.txt rename src/client/topic/{ => impl}/proto_accessor.cpp (100%) diff --git a/.github/actions/build/action.yaml b/.github/actions/build/action.yaml index 0afb3be787..69ce319f67 100644 --- a/.github/actions/build/action.yaml +++ b/.github/actions/build/action.yaml @@ -13,14 +13,14 @@ runs: - name: Configure shell: bash run: | - mkdir -p ../build${{ inputs.compiler == 'gcc' && '-gcc' || '' }} - rm -rf ../build${{ inputs.compiler == 'gcc' && '-gcc' || '' }}/* - cmake --preset release-test-with-ccache-basedir${{ inputs.compiler == 'gcc' && '-gcc' || '' }} + mkdir -p ../build + rm -rf ../build/* + cmake --preset release-test-with-ccache-basedir-${{ inputs.compiler }} - name: Build shell: bash run: | ccache -z export CCACHE_BASEDIR=`realpath ..` export CCACHE_DIR=~/.ccache - cmake --build --preset release${{ inputs.compiler == 'gcc' && '-gcc' || '' }} -- -j32 + cmake --build --preset release-${{ inputs.compiler }} -- -j32 ccache -s diff --git a/.github/actions/prepare_vm/action.yaml b/.github/actions/prepare_vm/action.yaml index cd515786fd..e2f37a5ed6 100644 --- a/.github/actions/prepare_vm/action.yaml +++ b/.github/actions/prepare_vm/action.yaml @@ -12,12 +12,16 @@ runs: sudo apt-get -y install git cmake ninja-build libidn11-dev ragel yasm protobuf-compiler \ protobuf-compiler-grpc libprotobuf-dev libgrpc++-dev libgrpc-dev libgrpc++1 libgrpc10 \ rapidjson-dev zlib1g-dev libxxhash-dev libzstd-dev libsnappy-dev libgtest-dev libgmock-dev \ - libbz2-dev libdouble-conversion-dev libstdc++-13-dev + libbz2-dev libdouble-conversion-dev libstdc++-13-dev gcc-13 g++-13 wget https://apt.llvm.org/llvm.sh chmod u+x llvm.sh sudo ./llvm.sh 16 - sudo ln -sf /usr/bin/clang-16 /usr/bin/clang - sudo ln -sf /usr/bin/clang++-16 /usr/bin/clang++ + sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-16 100 + sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-16 100 + + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 100 + sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 100 + wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz tar -xvzf libiconv-1.15.tar.gz cd libiconv-1.15 diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 1b574511c4..a62fc503cc 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -56,7 +56,7 @@ jobs: - name: Test shell: bash run: | - ctest -j32 --preset release-unit${{ matrix.compiler == 'gcc' && '-gcc' || '' }} + ctest -j32 --preset release-unit integration: concurrency: @@ -116,4 +116,4 @@ jobs: - name: Test shell: bash run: | - ctest -j32 --preset release-integration${{ matrix.compiler == 'gcc' && '-gcc' || '' }} + ctest -j32 --preset release-integration diff --git a/.gitignore b/.gitignore index 9529b57eca..4fe80a1acd 100644 --- a/.gitignore +++ b/.gitignore @@ -46,6 +46,7 @@ __pycache__/ /compile_commands.json +/build /build_* /build-* diff --git a/CMakeLists.txt b/CMakeLists.txt index a1e8a38f64..0639c2160a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,11 @@ cmake_minimum_required(VERSION 3.15) -project(YDB-CPP-SDK LANGUAGES C CXX ASM) + +file(READ "src/version.h" YDB_SDK_VERSION_FILE_RAW) +string(REGEX MATCH "YDB_SDK_VERSION = \"([0-9]+\\.[0-9]+\\.[0-9]+)\"" _ ${YDB_SDK_VERSION_FILE_RAW}) +set(YDB_SDK_VERSION ${CMAKE_MATCH_1}) +message(STATUS "YDB С++ SDK version: ${YDB_SDK_VERSION}") + +project(YDB-CPP-SDK VERSION ${YDB_SDK_VERSION} LANGUAGES C CXX ASM) option(YDB_SDK_INSTALL "Install YDB C++ SDK" Off) option(YDB_SDK_TESTS "Build YDB C++ SDK tests" Off) @@ -16,10 +22,6 @@ set(YDB_SDK_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(YDB_SDK_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) set(YDB-CPP-SDK_AVAILABLE_COMPONENTS "" CACHE INTERNAL "") set(YDB-CPP-SDK_COMPONENT_TARGETS "" CACHE INTERNAL "") -file(READ "src/version.h" YDB_SDK_VERSION_FILE_RAW) -string(REGEX MATCH "YDB_SDK_VERSION = \"([0-9]+\\.[0-9]+\\.[0-9]+)\"" _ ${YDB_SDK_VERSION_FILE_RAW}) -set(YDB_SDK_VERSION ${CMAKE_MATCH_1}) -message(STATUS "YDB С++ SDK version: ${YDB_SDK_VERSION}") #[=============================================================================[ NOTE: if `ccache` is used with the environment variable `CCACHE_BASEDIR`, diff --git a/CMakePresets.json b/CMakePresets.json index 112ff5f34c..163f1fabee 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -7,19 +7,25 @@ }, "configurePresets": [ { - "name": "ninja-generator", + "name": "base", "hidden": true, - "generator": "Ninja" + "cacheVariables": { + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON" + }, + "generator": "Ninja", + "binaryDir": "${sourceDir}/build" }, { - "name": "release-build", + "name": "release-base", + "inherits": "base", "hidden": true, "cacheVariables": { "CMAKE_BUILD_TYPE": "Release" } }, { - "name": "debug-build", + "name": "debug-base", + "inherits": "base", "hidden": true, "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug" @@ -28,38 +34,42 @@ { "name": "clang-toolchain", "hidden": true, - "toolchainFile": "${sourceDir}/clang.toolchain" + "cacheVariables": { + "CMAKE_CXX_COMPILER": "clang++", + "CMAKE_C_COMPILER": "clang", + "CMAKE_EXE_LINKER_FLAGS": "-fuse-ld=lld", + "CMAKE_SHARED_LINKER_FLAGS": "-fuse-ld=lld" + } }, { "name": "gcc-toolchain", "hidden": true, - "toolchainFile": "${sourceDir}/gcc.toolchain" + "cacheVariables": { + "CMAKE_CXX_COMPILER": "g++", + "CMAKE_C_COMPILER": "gcc" + } }, { - "name": "release", + "name": "release-clang", "inherits": [ - "ninja-generator", - "release-build", + "release-base", "clang-toolchain" ], "displayName": "Default Release Config (Clang)", - "description": "Default release build configuration using Ninja generator and Clang compiler", - "binaryDir": "${sourceDir}/../build" + "description": "Default release build configuration using Ninja generator and Clang compiler" }, { "name": "release-gcc", "inherits": [ - "ninja-generator", - "release-build", + "release-base", "gcc-toolchain" ], "displayName": "Default Release Config (GCC)", - "description": "Default release build configuration using Ninja generator and GCC compiler", - "binaryDir": "${sourceDir}/../build-gcc" + "description": "Default release build configuration using Ninja generator and GCC compiler" }, { - "name": "release-test", - "inherits": "release", + "name": "release-test-clang", + "inherits": "release-clang", "displayName": "Default Release Test Config (Clang)", "description": "Default release build configuration with all tests and examples", "cacheVariables": { @@ -78,10 +88,10 @@ } }, { - "name": "release-test-with-ccache-basedir", - "inherits": "release-test", + "name": "release-test-with-ccache-basedir-clang", + "inherits": "release-test-clang", "displayName": "Release Test Config CCACHE_BASEDIR Case (Clang)", - "description": "Only for the case when using CCACHE_BASEDIR", + "description": "Only for the case when using CCACHE_BASEDIR with Clang", "cacheVariables": { "ARCADIA_ROOT": "../ydb-cpp-sdk", "ARCADIA_BUILD_ROOT": "." @@ -100,8 +110,8 @@ ], "buildPresets": [ { - "name": "release", - "configurePreset": "release", + "name": "release-clang", + "configurePreset": "release-clang", "displayName": "Default Release Build (Clang)" }, { @@ -124,18 +134,8 @@ { "name": "release", "inherits": "common", - "configurePreset": "release-test", - "displayName": "Default Release Tests (Clang)", - "environment": { - "YDB_ENDPOINT": "localhost:2136", - "YDB_DATABASE": "/local" - } - }, - { - "name": "release-gcc", - "inherits": "common", - "configurePreset": "release-test-gcc", - "displayName": "Default Release Tests (GCC)", + "configurePreset": "release-base", + "displayName": "Default Release Tests", "environment": { "YDB_ENDPOINT": "localhost:2136", "YDB_DATABASE": "/local" @@ -144,19 +144,8 @@ { "name": "release-unit", "inherits": "common", - "configurePreset": "release-test", - "displayName": "Default Unit Release Tests (Clang)", - "filter" : { - "include": { - "label": "unit" - } - } - }, - { - "name": "release-unit-gcc", - "inherits": "common", - "configurePreset": "release-test-gcc", - "displayName": "Default Unit Release Tests (GCC)", + "configurePreset": "release-base", + "displayName": "Default Unit Release Tests", "filter" : { "include": { "label": "unit" @@ -166,23 +155,8 @@ { "name": "release-integration", "inherits": "common", - "configurePreset": "release-test", - "displayName": "Default Integration Release Tests (Clang)", - "filter" : { - "include": { - "label": "integration" - } - }, - "environment": { - "YDB_ENDPOINT": "localhost:2136", - "YDB_DATABASE": "/local" - } - }, - { - "name": "release-integration-gcc", - "inherits": "common", - "configurePreset": "release-test-gcc", - "displayName": "Default Integration Release Tests (GCC)", + "configurePreset": "release-base", + "displayName": "Default Integration Release Tests", "filter" : { "include": { "label": "integration" diff --git a/clang.toolchain b/clang.toolchain deleted file mode 100644 index f3c53e4bed..0000000000 --- a/clang.toolchain +++ /dev/null @@ -1,12 +0,0 @@ -set(CMAKE_C_COMPILER clang) -set(CMAKE_CXX_COMPILER clang++) -set(CMAKE_EXE_LINKER_FLAGS "-fuse-ld=lld -rdynamic") -set(CMAKE_SHARED_LINKER_FLAGS "-fuse-ld=lld") -set(CMAKE_C_STANDARD_LIBRARIES "-lc -lm") -set(CMAKE_CXX_STANDARD_LIBRARIES "-lc -lm") - -set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -UNDEBUG" CACHE STRING "C compiler flags") -set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -UNDEBUG" CACHE STRING "C++ compiler flags") - -set(ENV{CC} clang) -set(ENV{CXX} clang++) diff --git a/gcc.toolchain b/gcc.toolchain deleted file mode 100644 index 6711f1c094..0000000000 --- a/gcc.toolchain +++ /dev/null @@ -1,12 +0,0 @@ -set(CMAKE_C_COMPILER gcc) -set(CMAKE_CXX_COMPILER g++) -set(CMAKE_EXE_LINKER_FLAGS "-rdynamic") -set(CMAKE_SHARED_LINKER_FLAGS "") -set(CMAKE_C_STANDARD_LIBRARIES "-lc -lm") -set(CMAKE_CXX_STANDARD_LIBRARIES "-lc -lm") - -set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -UNDEBUG" CACHE STRING "C compiler flags") -set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -UNDEBUG" CACHE STRING "C++ compiler flags") - -set(ENV{CC} gcc) -set(ENV{CXX} g++) \ No newline at end of file diff --git a/include/ydb-cpp-sdk/client/CMakeLists.txt b/include/ydb-cpp-sdk/client/CMakeLists.txt index f4ba413366..ea630632fe 100644 --- a/include/ydb-cpp-sdk/client/CMakeLists.txt +++ b/include/ydb-cpp-sdk/client/CMakeLists.txt @@ -1,2 +1,3 @@ add_subdirectory(iam/common) add_subdirectory(iam_private/common) +add_subdirectory(topic) diff --git a/include/ydb-cpp-sdk/client/rate_limiter/rate_limiter.h b/include/ydb-cpp-sdk/client/rate_limiter/rate_limiter.h index ada271cf8f..5e370bcff0 100644 --- a/include/ydb-cpp-sdk/client/rate_limiter/rate_limiter.h +++ b/include/ydb-cpp-sdk/client/rate_limiter/rate_limiter.h @@ -176,6 +176,8 @@ struct TCreateResourceSettings : public TOperationRequestSettings , public THierarchicalDrrSettings { + using TSelf = TCreateResourceSettings; + TCreateResourceSettings() = default; TCreateResourceSettings(const Ydb::RateLimiter::CreateResourceRequest&); @@ -187,6 +189,8 @@ struct TAlterResourceSettings : public TOperationRequestSettings , public THierarchicalDrrSettings { + using TSelf = TAlterResourceSettings; + FLUENT_SETTING_OPTIONAL(TMeteringConfig, MeteringConfig); }; diff --git a/include/ydb-cpp-sdk/client/topic/CMakeLists.txt b/include/ydb-cpp-sdk/client/topic/CMakeLists.txt new file mode 100644 index 0000000000..d8cba6d702 --- /dev/null +++ b/include/ydb-cpp-sdk/client/topic/CMakeLists.txt @@ -0,0 +1,27 @@ +_ydb_sdk_add_library(client-ydb_topic-include) + +target_link_libraries(client-ydb_topic-include + PUBLIC + yutil + api-grpc + api-protos + streams-zstd +) + +generate_enum_serilization(client-ydb_topic-include + ${YDB_SDK_SOURCE_DIR}/include/ydb-cpp-sdk/client/topic/control_plane.h + INCLUDE_HEADERS + include/ydb-cpp-sdk/client/topic/control_plane.h +) + +generate_enum_serilization(client-ydb_topic-include + ${YDB_SDK_SOURCE_DIR}/include/ydb-cpp-sdk/client/topic/read_events.h + INCLUDE_HEADERS + include/ydb-cpp-sdk/client/topic/read_events.h +) + +generate_enum_serilization(client-ydb_topic-include + ${YDB_SDK_SOURCE_DIR}/include/ydb-cpp-sdk/client/topic/write_events.h + INCLUDE_HEADERS + include/ydb-cpp-sdk/client/topic/write_events.h +) diff --git a/src/client/topic/CMakeLists.txt b/src/client/topic/CMakeLists.txt index e18f83ff29..df4fb11ded 100644 --- a/src/client/topic/CMakeLists.txt +++ b/src/client/topic/CMakeLists.txt @@ -11,6 +11,7 @@ target_link_libraries(client-ydb_topic PUBLIC retry client-ydb_topic-common client-ydb_topic-impl + client-ydb_topic-include client-ydb_proto client-ydb_driver api-grpc @@ -20,26 +21,7 @@ target_link_libraries(client-ydb_topic PUBLIC ) target_sources(client-ydb_topic PRIVATE - proto_accessor.cpp out.cpp ) -generate_enum_serilization(client-ydb_topic - ${YDB_SDK_SOURCE_DIR}/include/ydb-cpp-sdk/client/topic/control_plane.h - INCLUDE_HEADERS - include/ydb-cpp-sdk/client/topic/control_plane.h -) - -generate_enum_serilization(client-ydb_topic - ${YDB_SDK_SOURCE_DIR}/include/ydb-cpp-sdk/client/topic/read_events.h - INCLUDE_HEADERS - include/ydb-cpp-sdk/client/topic/read_events.h -) - -generate_enum_serilization(client-ydb_topic - ${YDB_SDK_SOURCE_DIR}/include/ydb-cpp-sdk/client/topic/write_events.h - INCLUDE_HEADERS - include/ydb-cpp-sdk/client/topic/write_events.h -) - _ydb_sdk_make_client_component(Topic client-ydb_topic) diff --git a/src/client/topic/impl/CMakeLists.txt b/src/client/topic/impl/CMakeLists.txt index 415b39d780..227a889941 100644 --- a/src/client/topic/impl/CMakeLists.txt +++ b/src/client/topic/impl/CMakeLists.txt @@ -15,6 +15,7 @@ target_link_libraries(client-ydb_topic-impl PUBLIC client-ydb_topic-common client-ydb_proto client-ydb_topic-codecs + client-ydb_topic-include proto_output ) @@ -29,6 +30,7 @@ target_sources(client-ydb_topic-impl deferred_commit.cpp event_handlers.cpp offsets_collector.cpp + proto_accessor.cpp read_session_event.cpp read_session.cpp topic_impl.cpp diff --git a/src/client/topic/proto_accessor.cpp b/src/client/topic/impl/proto_accessor.cpp similarity index 100% rename from src/client/topic/proto_accessor.cpp rename to src/client/topic/impl/proto_accessor.cpp From 282f663c3f86bcc0264d0dca6b4d88ae8e3c7110 Mon Sep 17 00:00:00 2001 From: Bulat Gayazov Date: Wed, 2 Apr 2025 18:56:59 +0000 Subject: [PATCH 03/12] Fix --- .devcontainer/Dockerfile | 21 +++++++++++++++++---- .github/actions/prepare_vm/action.yaml | 4 +++- CMakeLists.txt | 2 +- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index a8970dee88..e99fc88569 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -3,12 +3,21 @@ FROM --platform=linux/amd64 mcr.microsoft.com/devcontainers/cpp:1-ubuntu-22.04 # Install software-properties-common for add-apt-repository RUN apt-get update && apt-get -y install software-properties-common +# Install CMake +ENV CMAKE_VERSION=3.27.7 +RUN add-apt-repository ppa:ubuntu-toolchain-r/test && apt-get -y update && apt-get -y install make && \ + wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}.tar.gz && \ + tar -xvzf cmake-${CMAKE_VERSION}.tar.gz && cd cmake-${CMAKE_VERSION} && \ + ./bootstrap && \ + make -j$(nproc) && \ + make install + # Install C++ tools and libraries -RUN add-apt-repository ppa:ubuntu-toolchain-r/test && apt-get -y update && apt-get -y install \ - git gdb cmake ninja-build libidn11-dev ragel yasm protobuf-compiler \ +RUN apt-get -y update && apt-get -y install \ + git gdb ninja-build libidn11-dev ragel yasm protobuf-compiler \ protobuf-compiler-grpc libprotobuf-dev libgrpc++-dev libgrpc-dev libgrpc++1 libgrpc10 \ rapidjson-dev zlib1g-dev libxxhash-dev libzstd-dev libsnappy-dev libgtest-dev libgmock-dev \ - libbz2-dev libdouble-conversion-dev libstdc++-13-dev liblz4-dev libssl-dev \ + libbz2-dev libdouble-conversion-dev libstdc++-13-dev gcc-13 g++-13 liblz4-dev libssl-dev \ && apt-get clean && rm -rf /var/lib/apt/lists/* # Install LLVM @@ -16,11 +25,15 @@ RUN wget https://apt.llvm.org/llvm.sh && \ chmod u+x llvm.sh && \ ./llvm.sh 16 -# Update alternatives to use clang-16 and clang++-16 by default +# Update alternatives to use clang-16 by default RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-16 100 && \ update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-16 100 && \ update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-16 100 +# Update alternatives to use gcc-13 by default +RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 100 && \ + update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 100 + # Install libiconv ENV LIBICONV_VERSION=1.15 RUN wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-${LIBICONV_VERSION}.tar.gz && \ diff --git a/.github/actions/prepare_vm/action.yaml b/.github/actions/prepare_vm/action.yaml index e2f37a5ed6..46ad564757 100644 --- a/.github/actions/prepare_vm/action.yaml +++ b/.github/actions/prepare_vm/action.yaml @@ -4,12 +4,14 @@ description: Install required packages runs: using: "composite" steps: + - name: Install CMake and Ninja + uses: lukka/get-cmake@v3.27.7 - name: Install dependencies shell: bash run: | sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get -y update - sudo apt-get -y install git cmake ninja-build libidn11-dev ragel yasm protobuf-compiler \ + sudo apt-get -y install git libidn11-dev ragel yasm protobuf-compiler \ protobuf-compiler-grpc libprotobuf-dev libgrpc++-dev libgrpc-dev libgrpc++1 libgrpc10 \ rapidjson-dev zlib1g-dev libxxhash-dev libzstd-dev libsnappy-dev libgtest-dev libgmock-dev \ libbz2-dev libdouble-conversion-dev libstdc++-13-dev gcc-13 g++-13 diff --git a/CMakeLists.txt b/CMakeLists.txt index 0639c2160a..9390cc97c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.15) +cmake_minimum_required(VERSION 3.5) file(READ "src/version.h" YDB_SDK_VERSION_FILE_RAW) string(REGEX MATCH "YDB_SDK_VERSION = \"([0-9]+\\.[0-9]+\\.[0-9]+)\"" _ ${YDB_SDK_VERSION_FILE_RAW}) From f005fa74e773e4eea45e0ad0b835fd54f91f1fe6 Mon Sep 17 00:00:00 2001 From: Bulat Gayazov Date: Wed, 2 Apr 2025 19:11:06 +0000 Subject: [PATCH 04/12] fix --- .github/actions/prepare_vm/action.yaml | 2 +- .github/workflows/examples.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/prepare_vm/action.yaml b/.github/actions/prepare_vm/action.yaml index 46ad564757..69c98a396d 100644 --- a/.github/actions/prepare_vm/action.yaml +++ b/.github/actions/prepare_vm/action.yaml @@ -11,7 +11,7 @@ runs: run: | sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get -y update - sudo apt-get -y install git libidn11-dev ragel yasm protobuf-compiler \ + sudo apt-get -y install git ninja-build libidn11-dev ragel yasm protobuf-compiler \ protobuf-compiler-grpc libprotobuf-dev libgrpc++-dev libgrpc-dev libgrpc++1 libgrpc10 \ rapidjson-dev zlib1g-dev libxxhash-dev libzstd-dev libsnappy-dev libgtest-dev libgmock-dev \ libbz2-dev libdouble-conversion-dev libstdc++-13-dev gcc-13 g++-13 diff --git a/.github/workflows/examples.yaml b/.github/workflows/examples.yaml index 2520de0d78..e1bb24f669 100644 --- a/.github/workflows/examples.yaml +++ b/.github/workflows/examples.yaml @@ -67,7 +67,7 @@ jobs: - name: Launch basic example shell: bash run: | - cd ../build${{ matrix.compiler == 'gcc' && '-gcc' || '' }} + cd build examples/basic_example/basic_example -e localhost:2136 -d /local examples/bulk_upsert_simple/bulk_upsert_simple -e localhost:2136 -d /local -p /local/bulk examples/pagination/pagination -e localhost:2136 -d /local -p /local/pagination From 3ef74daa4a80ea905fa9ca782a8b064cdc6483a3 Mon Sep 17 00:00:00 2001 From: Bulat Gayazov Date: Wed, 2 Apr 2025 19:45:53 +0000 Subject: [PATCH 05/12] fix --- .github/actions/build/action.yaml | 4 ++-- .github/workflows/examples.yaml | 2 +- .github/workflows/tests.yaml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/actions/build/action.yaml b/.github/actions/build/action.yaml index 69ce319f67..65ab23ad38 100644 --- a/.github/actions/build/action.yaml +++ b/.github/actions/build/action.yaml @@ -13,8 +13,8 @@ runs: - name: Configure shell: bash run: | - mkdir -p ../build - rm -rf ../build/* + mkdir -p build + rm -rf build/* cmake --preset release-test-with-ccache-basedir-${{ inputs.compiler }} - name: Build shell: bash diff --git a/.github/workflows/examples.yaml b/.github/workflows/examples.yaml index e1bb24f669..032bc008ad 100644 --- a/.github/workflows/examples.yaml +++ b/.github/workflows/examples.yaml @@ -57,7 +57,7 @@ jobs: uses: actions/cache/restore@v4 with: path: ~/.ccache - key: ubuntu-22.04-ccache-${{ matrix.compiler }}-${{steps.ccache_cache_timestamp.outputs.timestamp }} + key: ubuntu-22.04-ccache-${{ matrix.compiler }}-${{ steps.ccache_cache_timestamp.outputs.timestamp }} restore-keys: | ubuntu-22.04-ccache-${{ matrix.compiler }}- - name: Build diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index a62fc503cc..24fb98cb60 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -106,7 +106,7 @@ jobs: uses: actions/cache/restore@v4 with: path: ~/.ccache - key: ubuntu-22.04-ccache-${{ matrix.compiler }}-${{steps.ccache_cache_timestamp.outputs.timestamp }} + key: ubuntu-22.04-ccache-${{ matrix.compiler }}-${{ steps.ccache_cache_timestamp.outputs.timestamp }} restore-keys: | ubuntu-22.04-ccache-${{ matrix.compiler }}- - name: Build From 519ded8a536caab17ea35cae8d6640f0adf32c7e Mon Sep 17 00:00:00 2001 From: Bulat Gayazov Date: Wed, 2 Apr 2025 20:33:56 +0000 Subject: [PATCH 06/12] Fixed clang build --- .devcontainer/Dockerfile | 10 +++++----- .github/actions/prepare_vm/action.yaml | 8 ++++---- .github/workflows/tests.yaml | 2 +- .github/workflows/warmup_cache.yaml | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index e99fc88569..b7a2b1ef82 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -26,13 +26,13 @@ RUN wget https://apt.llvm.org/llvm.sh && \ ./llvm.sh 16 # Update alternatives to use clang-16 by default -RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-16 100 && \ - update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-16 100 && \ - update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-16 100 +RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-16 10000 && \ + update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-16 10000 && \ + update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-16 10000 # Update alternatives to use gcc-13 by default -RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 100 && \ - update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 100 +RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 10000 && \ + update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 10000 # Install libiconv ENV LIBICONV_VERSION=1.15 diff --git a/.github/actions/prepare_vm/action.yaml b/.github/actions/prepare_vm/action.yaml index 69c98a396d..7077f4a5ee 100644 --- a/.github/actions/prepare_vm/action.yaml +++ b/.github/actions/prepare_vm/action.yaml @@ -18,11 +18,11 @@ runs: wget https://apt.llvm.org/llvm.sh chmod u+x llvm.sh sudo ./llvm.sh 16 - sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-16 100 - sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-16 100 + sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-16 10000 + sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-16 10000 - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 100 - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 100 + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 10000 + sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 10000 wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz tar -xvzf libiconv-1.15.tar.gz diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 24fb98cb60..a355570199 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -46,7 +46,7 @@ jobs: uses: actions/cache/restore@v4 with: path: ~/.ccache - key: ubuntu-22.04-ccache-${{ matrix.compiler }}-${{steps.ccache_cache_timestamp.outputs.timestamp }} + key: ubuntu-22.04-ccache-${{ matrix.compiler }}-${{ steps.ccache_cache_timestamp.outputs.timestamp }} restore-keys: | ubuntu-22.04-ccache-${{ matrix.compiler }}- - name: Build diff --git a/.github/workflows/warmup_cache.yaml b/.github/workflows/warmup_cache.yaml index 00a485187f..04ed1d8ce4 100644 --- a/.github/workflows/warmup_cache.yaml +++ b/.github/workflows/warmup_cache.yaml @@ -30,7 +30,7 @@ jobs: uses: actions/cache@v4 with: path: ~/.ccache - key: ubuntu-22.04-ccache-${{ matrix.compiler }}-${{steps.ccache_cache_timestamp.outputs.timestamp }} + key: ubuntu-22.04-ccache-${{ matrix.compiler }}-${{ steps.ccache_cache_timestamp.outputs.timestamp }} restore-keys: | ubuntu-22.04-ccache-${{ matrix.compiler }}- - name: Build From 17f97b24a9b40fe0ba9913df45badcadf6902bb8 Mon Sep 17 00:00:00 2001 From: Bulat Gayazov Date: Wed, 2 Apr 2025 21:13:52 +0000 Subject: [PATCH 07/12] fix --- .devcontainer/configure.sh | 2 +- .github/actions/build/action.yaml | 2 +- .github/workflows/tests.yaml | 4 +- CMakePresets.json | 108 ++++++++++++++++-------------- 4 files changed, 60 insertions(+), 56 deletions(-) diff --git a/.devcontainer/configure.sh b/.devcontainer/configure.sh index 44eff912a8..2fb189822e 100755 --- a/.devcontainer/configure.sh +++ b/.devcontainer/configure.sh @@ -3,7 +3,7 @@ mkdir -p build git submodule update --init --recursive ccache -o cache_dir=/root/.ccache -cmake --preset release-test-with-ccache-basedir -DCMAKE_EXPORT_COMPILE_COMMANDS=1 +cmake --preset release-test-clang if which ydb > /dev/null 2>&1; then ENDPOINT=$(echo ${YDB_CONNECTION_STRING_SECURE:-$YDB_CONNECTION_STRING} | awk -F/ '{print $3}') diff --git a/.github/actions/build/action.yaml b/.github/actions/build/action.yaml index 65ab23ad38..5345f0ece4 100644 --- a/.github/actions/build/action.yaml +++ b/.github/actions/build/action.yaml @@ -15,7 +15,7 @@ runs: run: | mkdir -p build rm -rf build/* - cmake --preset release-test-with-ccache-basedir-${{ inputs.compiler }} + cmake --preset release-test-${{ inputs.compiler }} - name: Build shell: bash run: | diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index a355570199..7cc9e87fd1 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -56,7 +56,7 @@ jobs: - name: Test shell: bash run: | - ctest -j32 --preset release-unit + ctest -j32 --preset release-unit-${{ matrix.compiler }} integration: concurrency: @@ -116,4 +116,4 @@ jobs: - name: Test shell: bash run: | - ctest -j32 --preset release-integration + ctest -j32 --preset release-integration-${{ matrix.compiler }} diff --git a/CMakePresets.json b/CMakePresets.json index 163f1fabee..5758364c20 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -49,6 +49,16 @@ "CMAKE_C_COMPILER": "gcc" } }, + { + "name": "test", + "hidden": true, + "cacheVariables": { + "YDB_SDK_TESTS": "TRUE", + "YDB_SDK_EXAMPLES": "TRUE", + "ARCADIA_ROOT": "../ydb-cpp-sdk", + "ARCADIA_BUILD_ROOT": "." + } + }, { "name": "release-clang", "inherits": [ @@ -69,43 +79,15 @@ }, { "name": "release-test-clang", - "inherits": "release-clang", + "inherits": ["release-clang", "test"], "displayName": "Default Release Test Config (Clang)", - "description": "Default release build configuration with all tests and examples", - "cacheVariables": { - "YDB_SDK_TESTS": "TRUE", - "YDB_SDK_EXAMPLES": "TRUE" - } + "description": "Default release build configuration with all tests and examples" }, { "name": "release-test-gcc", - "inherits": "release-gcc", + "inherits": ["release-gcc", "test"], "displayName": "Default Release Test Config (GCC)", - "description": "Default release build configuration with all tests and examples using GCC", - "cacheVariables": { - "YDB_SDK_TESTS": "TRUE", - "YDB_SDK_EXAMPLES": "TRUE" - } - }, - { - "name": "release-test-with-ccache-basedir-clang", - "inherits": "release-test-clang", - "displayName": "Release Test Config CCACHE_BASEDIR Case (Clang)", - "description": "Only for the case when using CCACHE_BASEDIR with Clang", - "cacheVariables": { - "ARCADIA_ROOT": "../ydb-cpp-sdk", - "ARCADIA_BUILD_ROOT": "." - } - }, - { - "name": "release-test-with-ccache-basedir-gcc", - "inherits": "release-test-gcc", - "displayName": "Release Test Config CCACHE_BASEDIR Case (GCC)", - "description": "Only for the case when using CCACHE_BASEDIR with GCC", - "cacheVariables": { - "ARCADIA_ROOT": "../ydb-cpp-sdk", - "ARCADIA_BUILD_ROOT": "." - } + "description": "Default release build configuration with all tests and examples using GCC" } ], "buildPresets": [ @@ -132,32 +114,18 @@ } }, { - "name": "release", - "inherits": "common", - "configurePreset": "release-base", - "displayName": "Default Release Tests", - "environment": { - "YDB_ENDPOINT": "localhost:2136", - "YDB_DATABASE": "/local" - } - }, - { - "name": "release-unit", - "inherits": "common", - "configurePreset": "release-base", - "displayName": "Default Unit Release Tests", - "filter" : { + "name": "unit", + "hidden": true, + "filter": { "include": { "label": "unit" } } }, { - "name": "release-integration", - "inherits": "common", - "configurePreset": "release-base", - "displayName": "Default Integration Release Tests", - "filter" : { + "name": "integration", + "hidden": true, + "filter": { "include": { "label": "integration" } @@ -166,6 +134,42 @@ "YDB_ENDPOINT": "localhost:2136", "YDB_DATABASE": "/local" } + }, + { + "name": "release-clang", + "inherits": ["common", "unit", "integration"], + "configurePreset": "release-test-clang", + "displayName": "Default Release Tests (Clang)" + }, + { + "name": "release-unit-clang", + "inherits": ["common", "unit"], + "configurePreset": "release-test-clang", + "displayName": "Default Unit Release Tests (Clang)" + }, + { + "name": "release-integration-clang", + "inherits": ["common", "integration"], + "configurePreset": "release-test-clang", + "displayName": "Default Integration Release Tests (Clang)" + }, + { + "name": "release-gcc", + "inherits": ["common", "unit", "integration"], + "configurePreset": "release-gcc", + "displayName": "Default Release Tests (GCC)" + }, + { + "name": "release-unit-gcc", + "inherits": ["common", "unit"], + "configurePreset": "release-test-gcc", + "displayName": "Default Unit Release Tests (GCC)" + }, + { + "name": "release-integration-gcc", + "inherits": ["common", "integration"], + "configurePreset": "release-test-gcc", + "displayName": "Default Integration Release Tests (GCC)" } ] } From 349b652b7054ed47200c17040133a3335f8f85c6 Mon Sep 17 00:00:00 2001 From: Bulat Gayazov Date: Thu, 3 Apr 2025 10:43:19 +0000 Subject: [PATCH 08/12] Fix --- .github/actions/build/action.yaml | 2 +- .github/workflows/tests.yaml | 4 +- CMakePresets.json | 88 ++++++++----------------------- 3 files changed, 25 insertions(+), 69 deletions(-) diff --git a/.github/actions/build/action.yaml b/.github/actions/build/action.yaml index 5345f0ece4..a8c9e56f97 100644 --- a/.github/actions/build/action.yaml +++ b/.github/actions/build/action.yaml @@ -22,5 +22,5 @@ runs: ccache -z export CCACHE_BASEDIR=`realpath ..` export CCACHE_DIR=~/.ccache - cmake --build --preset release-${{ inputs.compiler }} -- -j32 + cmake --build --preset default -- -j$(nproc) ccache -s diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 7cc9e87fd1..ac6223c8b7 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -56,7 +56,7 @@ jobs: - name: Test shell: bash run: | - ctest -j32 --preset release-unit-${{ matrix.compiler }} + ctest -j$(nproc) --preset unit integration: concurrency: @@ -116,4 +116,4 @@ jobs: - name: Test shell: bash run: | - ctest -j32 --preset release-integration-${{ matrix.compiler }} + ctest -j$(nproc) --preset integration diff --git a/CMakePresets.json b/CMakePresets.json index 5758364c20..db22ab035b 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -8,7 +8,7 @@ "configurePresets": [ { "name": "base", - "hidden": true, + "displayName": "Generic Config", "cacheVariables": { "CMAKE_EXPORT_COMPILE_COMMANDS": "ON" }, @@ -55,51 +55,36 @@ "cacheVariables": { "YDB_SDK_TESTS": "TRUE", "YDB_SDK_EXAMPLES": "TRUE", - "ARCADIA_ROOT": "../ydb-cpp-sdk", + "ARCADIA_ROOT": "..", "ARCADIA_BUILD_ROOT": "." } }, { "name": "release-clang", - "inherits": [ - "release-base", - "clang-toolchain" - ], - "displayName": "Default Release Config (Clang)", - "description": "Default release build configuration using Ninja generator and Clang compiler" + "inherits": ["release-base", "clang-toolchain"], + "displayName": "Default Release Config (Clang)" }, { "name": "release-gcc", - "inherits": [ - "release-base", - "gcc-toolchain" - ], - "displayName": "Default Release Config (GCC)", - "description": "Default release build configuration using Ninja generator and GCC compiler" + "inherits": ["release-base", "gcc-toolchain"], + "displayName": "Default Release Config (GCC)" }, { "name": "release-test-clang", - "inherits": ["release-clang", "test"], - "displayName": "Default Release Test Config (Clang)", - "description": "Default release build configuration with all tests and examples" + "inherits": ["release-base", "clang-toolchain", "test"], + "displayName": "Default Release Test Config (Clang)" }, { "name": "release-test-gcc", - "inherits": ["release-gcc", "test"], - "displayName": "Default Release Test Config (GCC)", - "description": "Default release build configuration with all tests and examples using GCC" + "inherits": ["release-base", "gcc-toolchain", "test"], + "displayName": "Default Release Test Config (GCC)" } ], "buildPresets": [ { - "name": "release-clang", - "configurePreset": "release-clang", - "displayName": "Default Release Build (Clang)" - }, - { - "name": "release-gcc", - "configurePreset": "release-gcc", - "displayName": "Default Release Build (GCC)" + "name": "default", + "displayName": "Default Build", + "configurePreset": "base" } ], "testPresets": [ @@ -113,9 +98,15 @@ "timeout": 1200 } }, + { + "name": "all", + "displayName": "Run All Tests", + "configurePreset": "base" + }, { "name": "unit", - "hidden": true, + "displayName": "Run Unit Tests", + "configurePreset": "base", "filter": { "include": { "label": "unit" @@ -124,7 +115,8 @@ }, { "name": "integration", - "hidden": true, + "displayName": "Run Integration Tests", + "configurePreset": "base", "filter": { "include": { "label": "integration" @@ -134,42 +126,6 @@ "YDB_ENDPOINT": "localhost:2136", "YDB_DATABASE": "/local" } - }, - { - "name": "release-clang", - "inherits": ["common", "unit", "integration"], - "configurePreset": "release-test-clang", - "displayName": "Default Release Tests (Clang)" - }, - { - "name": "release-unit-clang", - "inherits": ["common", "unit"], - "configurePreset": "release-test-clang", - "displayName": "Default Unit Release Tests (Clang)" - }, - { - "name": "release-integration-clang", - "inherits": ["common", "integration"], - "configurePreset": "release-test-clang", - "displayName": "Default Integration Release Tests (Clang)" - }, - { - "name": "release-gcc", - "inherits": ["common", "unit", "integration"], - "configurePreset": "release-gcc", - "displayName": "Default Release Tests (GCC)" - }, - { - "name": "release-unit-gcc", - "inherits": ["common", "unit"], - "configurePreset": "release-test-gcc", - "displayName": "Default Unit Release Tests (GCC)" - }, - { - "name": "release-integration-gcc", - "inherits": ["common", "integration"], - "configurePreset": "release-test-gcc", - "displayName": "Default Integration Release Tests (GCC)" } ] } From 4098cc39b9a289928b6c031e8c200820465d29b9 Mon Sep 17 00:00:00 2001 From: Bulat Gayazov Date: Thu, 3 Apr 2025 17:32:05 +0000 Subject: [PATCH 09/12] fix --- CMakePresets.json | 3 +++ util/CMakeLists.txt | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/CMakePresets.json b/CMakePresets.json index db22ab035b..bd0c75cfb1 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -100,11 +100,13 @@ }, { "name": "all", + "inherits": "common", "displayName": "Run All Tests", "configurePreset": "base" }, { "name": "unit", + "inherits": "common", "displayName": "Run Unit Tests", "configurePreset": "base", "filter": { @@ -115,6 +117,7 @@ }, { "name": "integration", + "inherits": "common", "displayName": "Run Integration Tests", "configurePreset": "base", "filter": { diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt index 9220b75b74..d942885a04 100644 --- a/util/CMakeLists.txt +++ b/util/CMakeLists.txt @@ -316,6 +316,12 @@ if (YDB_SDK_TESTS) cpp-testing-unittest_main LABELS unit + TEST_ARG + --filter-file filter.txt + ) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/system/filter.txt + "-TBackTraceTest::TestPrintBackTrace\n" + "-TBackTraceTest::TestSetFormatBackTraceFn" ) add_ydb_test(NAME util-system-unaligned_mem_ut From 4b47d7e5a042a755e3d471915ab60213129cbe5c Mon Sep 17 00:00:00 2001 From: Bulat Gayazov Date: Thu, 3 Apr 2025 18:18:39 +0000 Subject: [PATCH 10/12] Updated YDB versions --- .github/workflows/tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index ac6223c8b7..93b3cb98fc 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -66,7 +66,7 @@ jobs: strategy: fail-fast: false matrix: - ydb-version: [23.3, 24.1, trunk] + ydb-version: [24.1, 24.2, 24.3, 24.4, 25.1, trunk] compiler: [clang, gcc] services: ydb: From 65e9865bae14e6637a64a96ef2d7ad24f64a5d06 Mon Sep 17 00:00:00 2001 From: Bulat Gayazov Date: Thu, 3 Apr 2025 18:22:25 +0000 Subject: [PATCH 11/12] Fixed examples version --- .github/workflows/examples.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/examples.yaml b/.github/workflows/examples.yaml index 032bc008ad..e5f3beba04 100644 --- a/.github/workflows/examples.yaml +++ b/.github/workflows/examples.yaml @@ -17,7 +17,7 @@ jobs: strategy: fail-fast: false matrix: - ydb-version: [24.1, trunk] + ydb-version: [24.1, 24.2, 24.3, 24.4, 25.1, trunk] compiler: [clang, gcc] services: ydb: From c066f03cf3fe189b45c05ccbe752cea23b5d3634 Mon Sep 17 00:00:00 2001 From: Bulat Gayazov Date: Thu, 3 Apr 2025 18:22:32 +0000 Subject: [PATCH 12/12] Fixed examples version --- .github/workflows/examples.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/examples.yaml b/.github/workflows/examples.yaml index e5f3beba04..41170adfb5 100644 --- a/.github/workflows/examples.yaml +++ b/.github/workflows/examples.yaml @@ -17,7 +17,7 @@ jobs: strategy: fail-fast: false matrix: - ydb-version: [24.1, 24.2, 24.3, 24.4, 25.1, trunk] + ydb-version: [25.1, trunk] compiler: [clang, gcc] services: ydb: