diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index e7da5111..e64b8406 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,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 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: | @@ -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 @@ -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 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*" 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 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*" 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()); 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());