Skip to content

Commit

Permalink
Merge pull request #348 from ClickHouse/clickhouse_cpp_version
Browse files Browse the repository at this point in the history
Clickhouse cpp version
  • Loading branch information
Enmk authored Dec 5, 2023
2 parents 901f609 + 5615582 commit db374b8
Show file tree
Hide file tree
Showing 11 changed files with 468 additions and 273 deletions.
108 changes: 58 additions & 50 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ on:
pull_request:
branches: [ master ]

release:
types:
- published
- prereleased

env:
BUILD_TYPE: Release
CLICKHOUSE_SERVER_IMAGE: "clickhouse/clickhouse-server:22.3"
Expand Down Expand Up @@ -65,54 +70,57 @@ jobs:
runs-on: ${{matrix.os}}

steps:
- uses: actions/checkout@v2

- name: Install dependencies
run: |
sudo apt-get update && \
sudo apt-get install -y \
docker \
- uses: actions/checkout@v4
with:
fetch-depth: 100
fetch-tags: true

- name: Install dependencies
run: |
sudo apt-get update && \
sudo apt-get install -y \
docker \
cmake \
${{matrix.COMPILER_INSTALL}} \
${{matrix.DEPENDENCIES_INSTALL}}
- name: Install dependencies - Docker
run: |
sudo apt remove -y docker docker-engine docker.io containerd runc
sudo apt install -y apt-transport-https ca-certificates curl gnupg lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update -q
sudo apt install docker-ce docker-ce-cli containerd.io
- name: Configure project
run: |
cmake \
-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 \
${{matrix.SSL_CMAKE_OPTION}} \
${{matrix.DEPENDENCIES_CMAKE_OPTIONS}} \
-S ${{github.workspace}} \
-B ${{github.workspace}}/build
- name: Build project
run: |
cmake \
${{matrix.COMPILER_INSTALL}} \
${{matrix.DEPENDENCIES_INSTALL}}
- name: Install dependencies - Docker
run: |
sudo apt remove -y docker docker-engine docker.io containerd runc
sudo apt install -y apt-transport-https ca-certificates curl gnupg lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update -q
sudo apt install docker-ce docker-ce-cli containerd.io
- name: Configure project
run: |
cmake \
-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 \
${{matrix.SSL_CMAKE_OPTION}} \
${{matrix.DEPENDENCIES_CMAKE_OPTIONS}} \
-S ${{github.workspace}} \
-B ${{github.workspace}}/build
- name: Build project
run: |
cmake \
--build ${{github.workspace}}/build \
--config ${{env.BUILD_TYPE}} \
--target all
- name: Test - Start ClickHouse server in background
run: |
docker pull ${CLICKHOUSE_SERVER_IMAGE}
docker run -d --name clickhouse -p 9000:9000 ${CLICKHOUSE_SERVER_IMAGE}
docker ps -a
docker stats -a --no-stream
## Check and wait until CH is ready to accept connections
docker exec clickhouse bash -c 'for i in {1..10}; do echo checking if clickhouse server is started attempt \#$i; if ( grep -q "<Information> Application: Ready for connections." /var/log/clickhouse-server/clickhouse-server.log ); then echo seems like clickhouse server is started; exit 0; fi; sleep 1; done; exit -1'
- name: Test
working-directory: ${{github.workspace}}/build/ut
run: ./clickhouse-cpp-ut
--build ${{github.workspace}}/build \
--config ${{env.BUILD_TYPE}} \
--target all
- name: Test - Start ClickHouse server in background
run: |
docker pull ${CLICKHOUSE_SERVER_IMAGE}
docker run -d --name clickhouse -p 9000:9000 ${CLICKHOUSE_SERVER_IMAGE}
docker ps -a
docker stats -a --no-stream
## Check and wait until CH is ready to accept connections
docker exec clickhouse bash -c 'for i in {1..10}; do echo checking if clickhouse server is started attempt \#$i; if ( grep -q "<Information> Application: Ready for connections." /var/log/clickhouse-server/clickhouse-server.log ); then echo seems like clickhouse server is started; exit 0; fi; sleep 1; done; exit -1'
- name: Test
working-directory: ${{github.workspace}}/build/ut
run: ./clickhouse-cpp-ut
73 changes: 40 additions & 33 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
branches: [ master ]
pull_request:
branches: [ master ]
release:
types:
- published
- prereleased

env:
BUILD_TYPE: Release
Expand All @@ -31,41 +35,44 @@ jobs:
SSL_INSTALL: openssl

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 100
fetch-tags: true

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

- name: Configure CMake
run: |
cmake \
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-D BUILD_TESTS=ON \
${{matrix.SSL_CMAKE_OPTION}} \
-S ${{github.workspace}} \
-B ${{github.workspace}}/build
- name: Configure CMake
run: |
cmake \
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-D BUILD_TESTS=ON \
${{matrix.SSL_CMAKE_OPTION}} \
-S ${{github.workspace}} \
-B ${{github.workspace}}/build
- name: Build
run: |
cmake \
--build ${{github.workspace}}/build \
--config ${{env.BUILD_TYPE}} \
--target all
- 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: 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 we use remote server to execute tests, some do not allow some features for anonymoust/free users:
# - system.query_log used by 'Client/ClientCase.Query_ID'
GTEST_FILTER: "-Client/ClientCase.Query_ID*:Client/ClientCase.TracingContext/*"
run: ./clickhouse-cpp-ut ${GTEST_FILTER}
- 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 we use remote server to execute tests, some do not allow some features for anonymoust/free users:
# - system.query_log used by 'Client/ClientCase.Query_ID'
GTEST_FILTER: "-Client/ClientCase.Query_ID*:Client/ClientCase.TracingContext/*"
run: ./clickhouse-cpp-ut ${GTEST_FILTER}
81 changes: 45 additions & 36 deletions .github/workflows/windows_mingw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ on:
pull_request:
branches: [ master ]

release:
types:
- published
- prereleased

env:
BUILD_TYPE: Release
CLICKHOUSE_USER: clickhouse_cpp_cicd
Expand Down Expand Up @@ -49,44 +54,48 @@ jobs:
shell: msys2 {0}

steps:
- uses: actions/checkout@v2
- uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.sys }}
update: true
install: >-
mingw-w64-${{matrix.env}}-cmake
mingw-w64-${{matrix.env}}-make
mingw-w64-${{matrix.env}}-gcc
mingw-w64-${{matrix.env}}-openssl
mingw-w64-${{matrix.env}}-ninja
mingw-w64-${{matrix.env}}-wget
mingw-w64-${{matrix.env}}-ca-certificates
tar
- uses: actions/checkout@v4
with:
fetch-depth: 100
fetch-tags: true
- uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.sys }}
update: true
install: >-
mingw-w64-${{matrix.env}}-cmake
mingw-w64-${{matrix.env}}-make
mingw-w64-${{matrix.env}}-gcc
mingw-w64-${{matrix.env}}-openssl
mingw-w64-${{matrix.env}}-ninja
mingw-w64-${{matrix.env}}-wget
mingw-w64-${{matrix.env}}-ca-certificates
tar
- name: Configure CMake
run: cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_TESTS=ON
# -DWITH_OPENSSL=ON was not able to make it work (some strange issues with CA paths, need debug)
- 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.

- name: Build
run: cmake --build build --config ${{env.BUILD_TYPE}} --target all
- name: Build
run: cmake --build 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 windows)
run: |
wget https://github.com/filimonov/go-tlsoffloader/releases/download/v0.1.2/go-tlsoffloader_0.1.2_Windows_x86_64.tar.gz
tar -xvzf go-tlsoffloader_0.1.2_Windows_x86_64.tar.gz
./go-tlsoffloader.exe -l localhost:9000 -b github.demo.trial.altinity.cloud:9440 &
- 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 windows)
run: |
wget https://github.com/filimonov/go-tlsoffloader/releases/download/v0.1.2/go-tlsoffloader_0.1.2_Windows_x86_64.tar.gz
tar -xvzf go-tlsoffloader_0.1.2_Windows_x86_64.tar.gz
./go-tlsoffloader.exe -l localhost:9000 -b github.demo.trial.altinity.cloud:9440 &
- name: Test
env:
# It is impossible to start CH server in docker on Windows due to github actions limitations,
# so we use remote server to execute tests, some do not allow some features for anonymoust/free users:
# - system.query_log used by 'Client/ClientCase.Query_ID'
GTEST_FILTER: "-Client/ClientCase.Query_ID*:Client/ClientCase.TracingContext/*"
run: ./build/ut/clickhouse-cpp-ut.exe ${GTEST_FILTER}
- name: Test
env:
# It is impossible to start CH server in docker on Windows due to github actions limitations,
# so we use remote server to execute tests, some do not allow some features for anonymoust/free users:
# - system.query_log used by 'Client/ClientCase.Query_ID'
GTEST_FILTER: "-Client/ClientCase.Query_ID*:Client/ClientCase.TracingContext/*"
run: ./build/ut/clickhouse-cpp-ut.exe ${GTEST_FILTER}

- name: Test (simple)
run: ./build/tests/simple/simple-test.exe
- name: Test (simple)
run: ./build/tests/simple/simple-test.exe
56 changes: 32 additions & 24 deletions .github/workflows/windows_msvc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ on:
pull_request:
branches: [ master ]

release:
types:
- published
- prereleased

env:
BUILD_TYPE: Release
CLICKHOUSE_USER: clickhouse_cpp_cicd
Expand Down Expand Up @@ -36,31 +41,34 @@ jobs:
runs-on: windows-latest

steps:
- uses: actions/checkout@v2
- uses: ilammy/msvc-dev-cmd@v1
- uses: actions/checkout@v4
with:
fetch-depth: 100
fetch-tags: true
- uses: ilammy/msvc-dev-cmd@v1

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

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

- name: Start tls offoader proxy
shell: bash
# 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 windows)
run: |
choco install wget
wget https://github.com/filimonov/go-tlsoffloader/releases/download/v0.1.2/go-tlsoffloader_0.1.2_Windows_x86_64.tar.gz
tar -xvzf go-tlsoffloader_0.1.2_Windows_x86_64.tar.gz
./go-tlsoffloader.exe -l localhost:9000 -b github.demo.trial.altinity.cloud:9440 &
- name: Start tls offoader proxy
shell: bash
# 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 windows)
run: |
choco install wget
wget https://github.com/filimonov/go-tlsoffloader/releases/download/v0.1.2/go-tlsoffloader_0.1.2_Windows_x86_64.tar.gz
tar -xvzf go-tlsoffloader_0.1.2_Windows_x86_64.tar.gz
./go-tlsoffloader.exe -l localhost:9000 -b github.demo.trial.altinity.cloud:9440 &
- name: Test
env:
# It is impossible to start CH server in docker on Windows due to github actions limitations,
# so we use remote server to execute tests, some do not allow some features for anonymoust/free users:
# - system.query_log used by 'Client/ClientCase.Query_ID'
GTEST_FILTER: "-Client/ClientCase.Query_ID*:Client/ClientCase.TracingContext/*"
working-directory: ${{github.workspace}}/build/ut
run: Release\clickhouse-cpp-ut.exe "${{env.GTEST_FILTER}}"
- name: Test
env:
# It is impossible to start CH server in docker on Windows due to github actions limitations,
# so we use remote server to execute tests, some do not allow some features for anonymoust/free users:
# - system.query_log used by 'Client/ClientCase.Query_ID'
GTEST_FILTER: "-Client/ClientCase.Query_ID*:Client/ClientCase.TracingContext/*"
working-directory: ${{github.workspace}}/build/ut
run: Release\clickhouse-cpp-ut.exe "${{env.GTEST_FILTER}}"
Loading

0 comments on commit db374b8

Please sign in to comment.