Skip to content

Commit

Permalink
Merge branch '3.0' into attempt_to_fix_test_failures_on_CICD
Browse files Browse the repository at this point in the history
  • Loading branch information
Enmk authored Feb 28, 2024
2 parents 4a86deb + 1d12a3b commit 856fa38
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 45 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ on:
schedule:
- cron: '0 0 * * 1'
push:
branches: [ master ]
branches: [ master, '[1-9].*' ]
pull_request:
branches: [ master ]
branches: [ master, '[1-9].*' ]

release:
types:
Expand Down Expand Up @@ -99,7 +99,7 @@ jobs:
-D CMAKE_C_COMPILER=${{matrix.C_COMPILER}} \
-D CMAKE_CXX_COMPILER=${{matrix.CXX_COMPILER}} \
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-D BUILD_TESTS=ON \
-D CLICKHOUSE_CPP_BUILD_TESTS=ON \
${{matrix.SSL_CMAKE_OPTION}} \
${{matrix.DEPENDENCIES_CMAKE_OPTIONS}} \
-S ${{github.workspace}} \
Expand Down
15 changes: 12 additions & 3 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,18 @@ on:
schedule:
- cron: '0 0 * * 1'
push:
branches: [ master ]
branches:
- master
- '[1-9].*'
pull_request:
branches: [ master ]
types:
- synchronize
- reopened
- opened
branches:
- master
- '[1-9].*'

release:
types:
- published
Expand Down Expand Up @@ -47,7 +56,7 @@ jobs:
run: |
cmake \
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-D BUILD_TESTS=ON \
-D CLICKHOUSE_CPP_BUILD_TESTS=ON \
${{matrix.SSL_CMAKE_OPTION}} \
-S ${{github.workspace}} \
-B ${{github.workspace}}/build
Expand Down
18 changes: 13 additions & 5 deletions .github/workflows/windows_mingw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@ on:
schedule:
- cron: '0 0 * * 1'
push:
branches: [ master ]
branches:
- master
- '[1-9].*'
pull_request:
branches: [ master ]
types:
- synchronize
- reopened
- opened
branches:
- master
- '[1-9].*'

release:
types:
Expand Down Expand Up @@ -73,9 +81,9 @@ jobs:
tar
- name: Configure CMake
run: cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_TESTS=ON -DCHECK_VERSION=OFF
# -DWITH_OPENSSL=ON was not able to make it work (some strange issues with CA paths, need debug)
# -DCHECK_VERSION=OFF since it requires git, which can't be found from within cmake for some reason.
run: cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCLICKHOUSE_CPP_BUILD_TESTS=ON -DCLICKHOUSE_CPP_CHECK_VERSION=OFF
# -DCLICKHOUSE_CPP_WITH_OPENSSL=ON was not able to make it work (some strange issues with CA paths, need debug)
# -DCLICKHOUSE_CPP_CHECK_VERSION=OFF since it requires git, which can't be found from within cmake for some reason.

- name: Build
run: cmake --build build --config ${{env.BUILD_TYPE}} --target all
Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/windows_msvc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@ on:
schedule:
- cron: '0 0 * * 1'
push:
branches: [ master ]
branches:
- master
- '[1-9].*'
pull_request:
branches: [ master ]
types:
- synchronize
- reopened
- opened
branches:
- master
- '[1-9].*'

release:
types:
Expand Down Expand Up @@ -48,7 +56,7 @@ jobs:
- uses: ilammy/msvc-dev-cmd@v1

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_TESTS=ON
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCLICKHOUSE_CPP_BUILD_TESTS=ON

- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ script: |
eval "${MATRIX_EVAL}"
mkdir build
cd build
cmake .. -DBUILD_TESTS=ON && make
cmake .. -DCLICKHOUSE_CPP_BUILD_TESTS=ON && make
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./ut/clickhouse-cpp-ut ; fi
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./ut/clickhouse-cpp-ut --gtest_filter=-"Client/*:*Performance*" ; fi
40 changes: 21 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ INCLUDE (subdirs)
INCLUDE (openssl)
INCLUDE (version)

OPTION (BUILD_BENCHMARK "Build benchmark" OFF)
OPTION (BUILD_TESTS "Build tests" OFF)
OPTION (BUILD_SHARED_LIBS "Build shared libs" OFF)
OPTION (WITH_OPENSSL "Use OpenSSL for TLS connections" OFF)
OPTION (WITH_SYSTEM_ABSEIL "Use system ABSEIL" OFF)
OPTION (WITH_SYSTEM_LZ4 "Use system LZ4" OFF)
OPTION (WITH_SYSTEM_CITYHASH "Use system cityhash" OFF)
OPTION (DEBUG_DEPENDENCIES "Print debug info about dependencies duting build" ON)
OPTION (CHECK_VERSION "Check that version number corresponds to git tag, usefull in CI/CD to validate that new version published on GitHub has same version in sources" OFF)

OPTION (CLICKHOUSE_CPP_BUILD_BENCHMARK "Build benchmark" OFF)
OPTION (CLICKHOUSE_CPP_BUILD_TESTS "Build tests" OFF)
OPTION (CLICKHOUSE_CPP_BUILD_SHARED_LIBS "Build shared libs" OFF)
OPTION (CLICKHOUSE_CPP_WITH_OPENSSL "Use OpenSSL for TLS connections" OFF)
OPTION (CLICKHOUSE_CPP_WITH_SYSTEM_ABSEIL "Use system ABSEIL" OFF)
OPTION (CLICKHOUSE_CPP_WITH_SYSTEM_LZ4 "Use system LZ4" OFF)
OPTION (CLICKHOUSE_CPP_WITH_SYSTEM_CITYHASH "Use system cityhash" OFF)
OPTION (CLICKHOUSE_CPP_DEBUG_DEPENDENCIES "Print debug info about dependencies duting build" ON)
OPTION (CLICKHOUSE_CPP_CHECK_VERSION "Check that version number corresponds to git tag, usefull in CI/CD to validate that new version published on GitHub has same version in sources" OFF)


PROJECT (CLICKHOUSE-CLIENT
VERSION "${CLICKHOUSE_CPP_VERSION}"
Expand All @@ -25,7 +27,7 @@ PROJECT (CLICKHOUSE-CLIENT
USE_CXX17 ()
USE_OPENSSL ()

IF (CHECK_VERSION)
IF (CLICKHOUSE_CPP_CHECK_VERSION)
clickhouse_cpp_check_library_version(FATAL_ERROR)
ENDIF ()

Expand All @@ -44,7 +46,7 @@ IF (UNIX)
ENDIF ()

IF (APPLE OR MSVC)
IF(BUILD_SHARED_LIBS)
IF(CLICKHOUSE_CPP_BUILD_SHARED_LIBS)
MESSAGE(FATAL "Does not support shared on this platform")
ENDIF()
ENDIF()
Expand Down Expand Up @@ -72,21 +74,21 @@ IF (CLANG_WITH_LIB_STDCXX)
SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcc_s")
ENDIF ()

IF (WITH_SYSTEM_ABSEIL)
IF (CLICKHOUSE_CPP_WITH_SYSTEM_ABSEIL)
FIND_PACKAGE(absl REQUIRED)
ELSE ()
INCLUDE_DIRECTORIES (contrib/absl)
SUBDIRS (contrib/absl/absl)
ENDIF ()

IF (WITH_SYSTEM_LZ4)
IF (CLICKHOUSE_CPP_WITH_SYSTEM_LZ4)
FIND_PACKAGE(lz4 REQUIRED)
ELSE ()
INCLUDE_DIRECTORIES (contrib/lz4/lz4)
SUBDIRS (contrib/lz4/lz4)
ENDIF ()

IF (WITH_SYSTEM_CITYHASH)
IF (CLICKHOUSE_CPP_WITH_SYSTEM_CITYHASH)
FIND_PACKAGE(cityhash REQUIRED)
ELSE ()
INCLUDE_DIRECTORIES (contrib/cityhash/cityhash)
Expand All @@ -97,20 +99,20 @@ SUBDIRS (
clickhouse
)

IF (BUILD_BENCHMARK)
IF (CLICKHOUSE_CPP_BUILD_BENCHMARK)
SUBDIRS (bench)
ENDIF (BUILD_BENCHMARK)
ENDIF (CLICKHOUSE_CPP_BUILD_BENCHMARK)

IF (BUILD_TESTS)
IF (CLICKHOUSE_CPP_BUILD_TESTS)
INCLUDE_DIRECTORIES (contrib/gtest/include contrib/gtest)
SUBDIRS (
contrib/gtest
tests/simple
ut
)
ENDIF (BUILD_TESTS)
ENDIF (CLICKHOUSE_CPP_BUILD_TESTS)

if(DEBUG_DEPENDENCIES)
if(CLICKHOUSE_CPP_DEBUG_DEPENDENCIES)
function(print_target_properties target)
MESSAGE("${target} properties:")
set(properties "${ARGN}")
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Optional dependencies:
```sh
$ mkdir build .
$ cd build
$ cmake .. [-DBUILD_TESTS=ON]
$ cmake .. [-DCLICKHOUSE_CPP_BUILD_TESTS=ON]
$ make
```

Expand Down
6 changes: 3 additions & 3 deletions clickhouse/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ else()
endif()
endif()

IF (WITH_OPENSSL)
IF (CLICKHOUSE_CPP_WITH_OPENSSL)
LIST(APPEND clickhouse-cpp-lib-src base/sslsocket.cpp)
ENDIF ()

Expand All @@ -118,7 +118,7 @@ TARGET_INCLUDE_DIRECTORIES (clickhouse-cpp-lib
PUBLIC ${PROJECT_SOURCE_DIR}
)

IF (NOT BUILD_SHARED_LIBS)
IF (NOT CLICKHOUSE_CPP_BUILD_SHARED_LIBS)
ADD_LIBRARY (clickhouse-cpp-lib-static ALIAS clickhouse-cpp-lib)
ELSE ()
SET_TARGET_PROPERTIES (clickhouse-cpp-lib
Expand Down Expand Up @@ -206,7 +206,7 @@ INSTALL(FILES columns/uuid.h DESTINATION include/clickhouse/columns/)
INSTALL(FILES types/type_parser.h DESTINATION include/clickhouse/types/)
INSTALL(FILES types/types.h DESTINATION include/clickhouse/types/)

IF (WITH_OPENSSL)
IF (CLICKHOUSE_CPP_WITH_OPENSSL)
TARGET_LINK_LIBRARIES (clickhouse-cpp-lib OpenSSL::SSL)
ENDIF ()

Expand Down
8 changes: 4 additions & 4 deletions clickhouse/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <vector>
#include <sstream>

#if defined(WITH_OPENSSL)
#if defined(CLICKHOUSE_CPP_WITH_OPENSSL)
#include "base/sslsocket.h"
#endif

Expand Down Expand Up @@ -87,7 +87,7 @@ std::ostream& operator<<(std::ostream& os, const ClientOptions& opt) {
<< " retry_timeout:" << opt.retry_timeout.count()
<< " compression_method:"
<< (opt.compression_method == CompressionMethod::LZ4 ? "LZ4" : "None");
#if defined(WITH_OPENSSL)
#if defined(CLICKHOUSE_CPP_WITH_OPENSSL)
if (opt.ssl_options) {
const auto & ssl_options = *opt.ssl_options;
os << " SSL ("
Expand All @@ -107,7 +107,7 @@ std::ostream& operator<<(std::ostream& os, const ClientOptions& opt) {

ClientOptions& ClientOptions::SetSSLOptions(ClientOptions::SSLOptions options)
{
#ifdef WITH_OPENSSL
#ifdef CLICKHOUSE_CPP_WITH_OPENSSL
ssl_options = options;
return *this;
#else
Expand All @@ -120,7 +120,7 @@ namespace {

std::unique_ptr<SocketFactory> GetSocketFactory(const ClientOptions& opts) {
(void)opts;
#if defined(WITH_OPENSSL)
#if defined(CLICKHOUSE_CPP_WITH_OPENSSL)
if (opts.ssl_options)
return std::make_unique<SSLSocketFactory>(opts);
else
Expand Down
4 changes: 2 additions & 2 deletions cmake/openssl.cmake
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
MACRO (USE_OPENSSL)

IF (WITH_OPENSSL)
IF (CLICKHOUSE_CPP_WITH_OPENSSL)
FIND_PACKAGE (OpenSSL REQUIRED)
ADD_COMPILE_DEFINITIONS (WITH_OPENSSL=1)
ADD_COMPILE_DEFINITIONS (CLICKHOUSE_CPP_WITH_OPENSSL=1)
ENDIF ()

ENDMACRO ()
2 changes: 1 addition & 1 deletion ut/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ SET ( clickhouse-cpp-ut-src
low_cardinality_nullable_tests.cpp
)

IF (WITH_OPENSSL)
IF (CLICKHOUSE_CPP_WITH_OPENSSL)
LIST (APPEND clickhouse-cpp-ut-src ssl_ut.cpp)
ENDIF ()

Expand Down

0 comments on commit 856fa38

Please sign in to comment.