Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 16 additions & 24 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,6 @@ on:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_call:
inputs:
extra_cmake_flags:
required: false
type: string
extra_install:
required: false
type: string
gtest_filter:
required: false
type: string
default: "*"

env:
BUILD_TYPE: Release
Expand All @@ -26,37 +14,41 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
build: [clang-6, gcc-7, gcc-8, gcc-9]
compiler: [clang-6, gcc-7, gcc-8, gcc-9]
ssl: [ssl_ON, ssl_OFF]
include:
- build: clang-6
os: ubuntu-latest
- compiler: clang-6
INSTALL: clang-6.0
C_COMPILER: clang-6.0
CXX_COMPILER: clang++-6.0

- build: gcc-7
os: ubuntu-latest
- compiler: gcc-7
INSTALL: gcc-7 g++-7
C_COMPILER: gcc-7
CXX_COMPILER: g++-7

- build: gcc-8
os: ubuntu-latest
- compiler: gcc-8
INSTALL: gcc-8 g++-8
C_COMPILER: gcc-8
CXX_COMPILER: g++-8

- build: gcc-9
os: ubuntu-latest
- compiler: gcc-9
INSTALL: gcc-9 g++-9
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ups, it look like i didn't intall libssl-dev in every scenario, but somehow it works...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be already installed, but anyway let's make it explicit dependency

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like your option much more 👍 Wasn't aware that you can make a cartesian product of matrixes this way

C_COMPILER: gcc-9
CXX_COMPILER: g++-9

- ssl: ssl_ON
INSTALL_SSL: libssl-dev
EXTRA_CMAKE_FLAGS: -DWITH_OPENSSL=ON

- ssl: ssl_OFF
EXTRA_CMAKE_FLAGS: -DWITH_OPENSSL=OFF

steps:
- uses: actions/checkout@v2

- name: Install dependencies
run: sudo apt-get install -y cmake ${{ matrix.INSTALL }} ${{ inputs.extra_install }}
run: sudo apt-get install -y cmake ${{ matrix.INSTALL }} ${{ matrix.INSTALL_SSL }}

- name: Configure CMake
run: |
Expand All @@ -65,7 +57,7 @@ jobs:
-DCMAKE_CXX_COMPILER=${{ matrix.CXX_COMPILER}} \
-B ${{github.workspace}}/build \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_TESTS=ON \
${{ inputs.extra_cmake_flags }}
${{ matrix.EXTRA_CMAKE_FLAGS }}

- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target all
Expand All @@ -84,4 +76,4 @@ jobs:

- name: Test
working-directory: ${{github.workspace}}/build/ut
run: ./clickhouse-cpp-ut --gtest_filter="${{inputs.gtest_filter}}"
run: ./clickhouse-cpp-ut
16 changes: 0 additions & 16 deletions .github/workflows/linux_ssl.yml

This file was deleted.

42 changes: 27 additions & 15 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,54 @@ on:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_call:
inputs:
extra_cmake_flags:
required: false
type: string
extra_install:
required: false
type: string
gtest_filter:
required: false
type: string
default: "*"

env:
BUILD_TYPE: Release
CLICKHOUSE_USER: clickhouse_cpp_cicd
CLICKHOUSE_PASSWORD: clickhouse_cpp_cicd

jobs:
build:
runs-on: macos-latest

strategy:
fail-fast: false
matrix:
build: [nossl, ssl]
include:
- build: nossl
extra_cmake_flags: -DWITH_OPENSSL=OFF
extra_install:

- build: ssl
extra_cmake_flags: -DWITH_OPENSSL=ON -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl/
extra_install: openssl

steps:
- uses: actions/checkout@v2

- name: Install dependencies
run: brew install cmake ${{inputs.extra_install}}
run: brew install cmake ${{matrix.extra_install}}

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

- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target all

- name: Start tls offoader proxy
# that mimics non-secure clickhouse running on localhost
# by tunneling queries to remote tls server
# (needed because we can't start real clickhouse instance on macOS)
run: |
wget https://github.com/filimonov/go-tlsoffloader/releases/download/v0.1.2/go-tlsoffloader_0.1.2_Darwin_x86_64.tar.gz
tar -xvzf go-tlsoffloader_0.1.2_Darwin_x86_64.tar.gz
./go-tlsoffloader -l localhost:9000 -b github.demo.trial.altinity.cloud:9440 &

- name: Test
working-directory: ${{github.workspace}}/build/ut
env:
# It is impossible to start CH server in docker on macOS due to github actions limitations,
# so limit tests to ones that do no require server interaction.
GTEST_FILTER_ONLY_LOCAL: "-Client/*"
run: ./clickhouse-cpp-ut --gtest_filter="${{inputs.gtest_filter}}:${{env.GTEST_FILTER_ONLY_LOCAL}}"
run: ./clickhouse-cpp-ut
17 changes: 0 additions & 17 deletions .github/workflows/macos_ssl.yml

This file was deleted.

6 changes: 5 additions & 1 deletion bench/bench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
namespace clickhouse {

Client g_client(ClientOptions()
.SetHost("localhost")
.SetHost( getEnvOrDefault("CLICKHOUSE_HOST", "localhost"))
.SetPort( std::stoi(getEnvOrDefault("CLICKHOUSE_PORT", "9000")))
.SetUser( getEnvOrDefault("CLICKHOUSE_USER", "default"))
.SetPassword( getEnvOrDefault("CLICKHOUSE_PASSWORD", ""))
.SetDefaultDatabase(getEnvOrDefault("CLICKHOUSE_DB", "default"))
.SetPingBeforeQuery(false));

static void SelectNumber(benchmark::State& state) {
Expand Down
1 change: 1 addition & 0 deletions clickhouse/base/socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#endif

namespace clickhouse {

namespace {

class LocalNames : public std::unordered_set<std::string> {
Expand Down
7 changes: 7 additions & 0 deletions tests/simple/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,10 @@ TARGET_LINK_LIBRARIES (simple-test
clickhouse-cpp-lib
)

IF (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# there is a problem with __builtin_mul_overflow call at link time
# the error looks like: ... undefined reference to `__muloti4' ...
# caused by clang bug https://bugs.llvm.org/show_bug.cgi?id=16404
# explicit linking to compiler-rt allows to workaround the problem
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --rtlib=compiler-rt")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment that explains why this is required.

ENDIF ()
Loading