From 8698ad5b1ea1051dcd82f3ffceab5a460c3d16f9 Mon Sep 17 00:00:00 2001 From: Vasily Nemkov Date: Mon, 17 Jan 2022 17:01:43 +0300 Subject: [PATCH 01/14] Test multi-dimensional matrix --- .github/workflows/linux.yml | 46 ++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index e7da5111..fcf65c93 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -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 @@ -26,28 +14,30 @@ 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: [on, 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-ssl + INSTALL: gcc-9 g++-9 + C_COMPILER: gcc-9 + CXX_COMPILER: g++-9 + + - compiler: gcc-9 INSTALL: gcc-9 g++-9 C_COMPILER: gcc-9 CXX_COMPILER: g++-9 @@ -56,7 +46,12 @@ jobs: - 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 }} + if [[ '${{ matrix.ssl }}' = 'on' ]] + then + sudo apt-get install -y libssl-dev + fi - name: Configure CMake run: | @@ -65,8 +60,8 @@ jobs: -DCMAKE_CXX_COMPILER=${{ matrix.CXX_COMPILER}} \ -B ${{github.workspace}}/build \ -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_TESTS=ON \ - ${{ inputs.extra_cmake_flags }} - + -DWITH_OPENSSL=${{matrix.ssl}} \ + ${{ matrix.extra_cmake_flags }} - name: Build run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target all @@ -81,7 +76,6 @@ jobs: clickhouse-client=${{env.CH_SERVER_VERSION}} \ clickhouse-common-static=${{env.CH_SERVER_VERSION}} sudo service clickhouse-server start - - name: Test working-directory: ${{github.workspace}}/build/ut - run: ./clickhouse-cpp-ut --gtest_filter="${{inputs.gtest_filter}}" + run: ./clickhouse-cpp-ut From ad4592f672f5b85bfb805813895d337539c0026a Mon Sep 17 00:00:00 2001 From: Vasily Nemkov Date: Mon, 17 Jan 2022 17:11:07 +0300 Subject: [PATCH 02/14] Better target names and removed excess target --- .github/workflows/linux.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index fcf65c93..a2aba997 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -15,7 +15,7 @@ jobs: strategy: matrix: compiler: [clang-6, gcc-7, gcc-8, gcc-9] - ssl: [on, off] + ssl: [ssl_ON, ssl_OFF] include: - compiler: clang-6 INSTALL: clang-6.0 @@ -32,11 +32,6 @@ jobs: C_COMPILER: gcc-8 CXX_COMPILER: g++-8 - - compiler: gcc-9-ssl - INSTALL: gcc-9 g++-9 - C_COMPILER: gcc-9 - CXX_COMPILER: g++-9 - - compiler: gcc-9 INSTALL: gcc-9 g++-9 C_COMPILER: gcc-9 @@ -48,13 +43,15 @@ jobs: - name: Install dependencies run: | sudo apt-get install -y cmake ${{ matrix.INSTALL }} - if [[ '${{ matrix.ssl }}' = 'on' ]] + if [[ '${{ matrix.ssl }}' = 'ssl_ON' ]] then + echo "Installing SSL headers and other stuff" sudo apt-get install -y libssl-dev fi - name: Configure CMake run: | + echo ${${{matrix.ssl}}/"#ssl_"/string} cmake \ -DCMAKE_C_COMPILER=${{ matrix.C_COMPILER}} \ -DCMAKE_CXX_COMPILER=${{ matrix.CXX_COMPILER}} \ @@ -62,6 +59,7 @@ jobs: -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_TESTS=ON \ -DWITH_OPENSSL=${{matrix.ssl}} \ ${{ matrix.extra_cmake_flags }} + - name: Build run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target all @@ -76,6 +74,7 @@ jobs: clickhouse-client=${{env.CH_SERVER_VERSION}} \ clickhouse-common-static=${{env.CH_SERVER_VERSION}} sudo service clickhouse-server start + - name: Test working-directory: ${{github.workspace}}/build/ut run: ./clickhouse-cpp-ut From c98ae575a87339295622dc575a81a83fc548024a Mon Sep 17 00:00:00 2001 From: Vasily Nemkov Date: Mon, 17 Jan 2022 17:19:56 +0300 Subject: [PATCH 03/14] Delete linux_ssl.yml --- .github/workflows/linux_ssl.yml | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 .github/workflows/linux_ssl.yml diff --git a/.github/workflows/linux_ssl.yml b/.github/workflows/linux_ssl.yml deleted file mode 100644 index 7d182b43..00000000 --- a/.github/workflows/linux_ssl.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Linux-ssl -# Almost the same as regular Linux builds, BUT with enabled SSL support, requires OpenSSL installed - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build-and-test: - uses: ClickHouse/clickhouse-cpp/.github/workflows/linux.yml@master - with: - extra_cmake_flags: -DWITH_OPENSSL=ON - extra_install: libssl-dev -# gtest_filter: "-*LocalhostTLS*" From d585b372e24574bf0b27dd55856c8b74f805997d Mon Sep 17 00:00:00 2001 From: Vasily Nemkov Date: Mon, 17 Jan 2022 17:20:28 +0300 Subject: [PATCH 04/14] Fixed ssl dependency instalation --- .github/workflows/linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index a2aba997..19e2d767 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -43,7 +43,7 @@ jobs: - name: Install dependencies run: | sudo apt-get install -y cmake ${{ matrix.INSTALL }} - if [[ '${{ matrix.ssl }}' = 'ssl_ON' ]] + if [[ ${{ matrix.ssl }} = 'ssl_ON' ]] then echo "Installing SSL headers and other stuff" sudo apt-get install -y libssl-dev From 9e8164df1135134f5876ada065184c5fa6c48739 Mon Sep 17 00:00:00 2001 From: Vasily Nemkov Date: Mon, 17 Jan 2022 17:28:09 +0300 Subject: [PATCH 05/14] ssl build fixes Simplified installing `libssl-dev` Proper cmake option for ssl --- .github/workflows/linux.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 19e2d767..6451e6fa 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -36,6 +36,9 @@ jobs: INSTALL: gcc-9 g++-9 C_COMPILER: gcc-9 CXX_COMPILER: g++-9 + + - ssl: ssl_ON + INSTALL: ${{ matrix.INSTALL }} libssl-dev steps: - uses: actions/checkout@v2 @@ -43,11 +46,6 @@ jobs: - name: Install dependencies run: | sudo apt-get install -y cmake ${{ matrix.INSTALL }} - if [[ ${{ matrix.ssl }} = 'ssl_ON' ]] - then - echo "Installing SSL headers and other stuff" - sudo apt-get install -y libssl-dev - fi - name: Configure CMake run: | @@ -57,7 +55,7 @@ jobs: -DCMAKE_CXX_COMPILER=${{ matrix.CXX_COMPILER}} \ -B ${{github.workspace}}/build \ -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_TESTS=ON \ - -DWITH_OPENSSL=${{matrix.ssl}} \ + -DWITH_OPENSSL=${${{matrix.ssl }}/"#ssl_"/} \ ${{ matrix.extra_cmake_flags }} - name: Build From 0fc4cbb712aaffe533c3ebfabb3bb18ab4193f55 Mon Sep 17 00:00:00 2001 From: Vasily Nemkov Date: Mon, 17 Jan 2022 17:33:05 +0300 Subject: [PATCH 06/14] Update linux.yml --- .github/workflows/linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 6451e6fa..96f4d7e3 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -38,7 +38,7 @@ jobs: CXX_COMPILER: g++-9 - ssl: ssl_ON - INSTALL: ${{ matrix.INSTALL }} libssl-dev + INSTALL: libssl-dev steps: - uses: actions/checkout@v2 From 11b5062879af52c459faa46e13f5bc2414c97ad5 Mon Sep 17 00:00:00 2001 From: Vasily Nemkov Date: Mon, 17 Jan 2022 17:39:20 +0300 Subject: [PATCH 07/14] Update linux.yml --- .github/workflows/linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 96f4d7e3..45116ef6 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -38,7 +38,7 @@ jobs: CXX_COMPILER: g++-9 - ssl: ssl_ON - INSTALL: libssl-dev + INSTALL: $INSTALL libssl-dev steps: - uses: actions/checkout@v2 From fa918839332c257341c373fd020f5273ac846bc7 Mon Sep 17 00:00:00 2001 From: Vasily Nemkov Date: Mon, 17 Jan 2022 17:41:16 +0300 Subject: [PATCH 08/14] Update linux.yml --- .github/workflows/linux.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 45116ef6..89b45fc4 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -38,14 +38,13 @@ jobs: CXX_COMPILER: g++-9 - ssl: ssl_ON - INSTALL: $INSTALL libssl-dev + INSTALL_SSL: libssl-dev steps: - uses: actions/checkout@v2 - name: Install dependencies - run: | - sudo apt-get install -y cmake ${{ matrix.INSTALL }} + run: sudo apt-get install -y cmake ${{ matrix.INSTALL }} ${{ matrix.INSTALL_SSL }} - name: Configure CMake run: | From 491c7f69cae0f5b5d9cc5b3a88e92b60576ba203 Mon Sep 17 00:00:00 2001 From: Vasily Nemkov Date: Mon, 17 Jan 2022 17:57:34 +0300 Subject: [PATCH 09/14] attempt to properly enable ssl --- .github/workflows/linux.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 89b45fc4..14c68bac 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -54,8 +54,7 @@ jobs: -DCMAKE_CXX_COMPILER=${{ matrix.CXX_COMPILER}} \ -B ${{github.workspace}}/build \ -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_TESTS=ON \ - -DWITH_OPENSSL=${${{matrix.ssl }}/"#ssl_"/} \ - ${{ matrix.extra_cmake_flags }} + -DWITH_OPENSSL=$(echo ${{ matrix.ssl}} | cut -c 5-) - name: Build run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target all From e3bf24a9851d7a543562fa4dc94402fd9ca7ea43 Mon Sep 17 00:00:00 2001 From: Vasily Nemkov Date: Mon, 17 Jan 2022 18:21:21 +0300 Subject: [PATCH 10/14] Suppressing GCC false error ``` Parameterized test suite ReadonlyClientTest is defined via TEST_P, but never instantiated. None of the test cases will run. Either no INSTANTIATE_TEST_SUITE_P is provided or the only ones provided expand to nothing. Ideally, TEST_P definitions should only ever be included as part of binaries that intend to use them. (As opposed to, for example, being placed in a library that may be linked in to get other utilities.) To suppress this error for this test suite, insert the following line (in a non-header) in the namespace it is defined in: GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(ReadonlyClientTest); ``` --- ut/readonly_client_test.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ut/readonly_client_test.cpp b/ut/readonly_client_test.cpp index 17bf7d36..181a25de 100644 --- a/ut/readonly_client_test.cpp +++ b/ut/readonly_client_test.cpp @@ -18,6 +18,8 @@ void ReadonlyClientTest::TearDown() { client_.reset(); } +// Sometimes gtest fails to detect that this test is instantiated elsewhere, suppress the error explicitly. +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(ReadonlyClientTest); TEST_P(ReadonlyClientTest, Select) { const auto & queries = std::get<1>(GetParam()); From a2c56da0091a0cbc3f4953fac77fcdd9c8a3423b Mon Sep 17 00:00:00 2001 From: Vasily Nemkov Date: Mon, 17 Jan 2022 18:26:08 +0300 Subject: [PATCH 11/14] Update connection_failed_client_test.cpp --- ut/connection_failed_client_test.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/ut/connection_failed_client_test.cpp b/ut/connection_failed_client_test.cpp index 697e9a93..82ab5a09 100644 --- a/ut/connection_failed_client_test.cpp +++ b/ut/connection_failed_client_test.cpp @@ -11,6 +11,7 @@ namespace { using namespace clickhouse; } +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(ConnectionFailedClientTest); TEST_P(ConnectionFailedClientTest, ValidateConnectionError) { const auto & client_options = std::get<0>(GetParam()); From a36a1b1e8bb9d49db13db5a1c5f922b2de657d9f Mon Sep 17 00:00:00 2001 From: Vasily Nemkov Date: Mon, 17 Jan 2022 18:48:00 +0300 Subject: [PATCH 12/14] Update linux.yml --- .github/workflows/linux.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 14c68bac..e64b8406 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -36,9 +36,13 @@ jobs: INSTALL: gcc-9 g++-9 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 @@ -48,13 +52,12 @@ jobs: - name: Configure CMake run: | - echo ${${{matrix.ssl}}/"#ssl_"/string} cmake \ -DCMAKE_C_COMPILER=${{ matrix.C_COMPILER}} \ -DCMAKE_CXX_COMPILER=${{ matrix.CXX_COMPILER}} \ -B ${{github.workspace}}/build \ -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_TESTS=ON \ - -DWITH_OPENSSL=$(echo ${{ matrix.ssl}} | cut -c 5-) + ${{ matrix.EXTRA_CMAKE_FLAGS }} - name: Build run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target all From debbb1bb87ec78ed88e0c0a7a5ffb6d769401510 Mon Sep 17 00:00:00 2001 From: Vasily Nemkov Date: Mon, 17 Jan 2022 18:48:26 +0300 Subject: [PATCH 13/14] Delete macos_ssl.yml --- .github/workflows/macos_ssl.yml | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 .github/workflows/macos_ssl.yml diff --git a/.github/workflows/macos_ssl.yml b/.github/workflows/macos_ssl.yml deleted file mode 100644 index 08a69272..00000000 --- a/.github/workflows/macos_ssl.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: macOS-ssl -# Almost the same as regular macOS builds, BUT with enabled SSL support, requires OpenSSL installed via Homebrew (openssl@1.1) - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build-and-test: - uses: ClickHouse/clickhouse-cpp/.github/workflows/macos.yml@master - with: - extra_cmake_flags: -DWITH_OPENSSL=ON -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl/ - extra_install: openssl - # There is no CH server running locally, so disable tests that try to connect to it. - gtest_filter: "-*Client*:*Local*:*ColumnPerformanceTest*" From 2a39527ed83b513f36588fa5bc1b1d09b609d4c2 Mon Sep 17 00:00:00 2001 From: Vasily Nemkov Date: Mon, 17 Jan 2022 18:53:35 +0300 Subject: [PATCH 14/14] Update macos.yml --- .github/workflows/macos.yml | 46 +++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 134da3b7..9f45e0fa 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -5,42 +5,58 @@ 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: + ssl: [ssl_ON, ssl_OFF] + include: + - build: ssl_OFF + EXTRA_CMAKE_FLAGS: -DWITH_OPENSSL=OFF + + - build: ssl_ON + EXTRA_CMAKE_FLAGS: -DWITH_OPENSSL=ON -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl/ + INSTALL_SSL: openssl + steps: - uses: actions/checkout@v2 - name: Install dependencies - run: brew install cmake ${{inputs.extra_install}} + run: brew install cmake ${{matrix.INSTALL_SSL}} - 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