Skip to content

Commit 5615582

Browse files
committed
Proper source and library version
Added version.h -- master-copy of the version data of the library, which defines multiple macros, including CLICKHOUSE_CPP_VERSION Added version.cmake -- that sets project and library version info according to version.h, also reminds to update version upon new github release. Added method Client::GetVersion() that returns version info at run-time
1 parent 901f609 commit 5615582

File tree

11 files changed

+468
-273
lines changed

11 files changed

+468
-273
lines changed

.github/workflows/linux.yml

Lines changed: 58 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ on:
88
pull_request:
99
branches: [ master ]
1010

11+
release:
12+
types:
13+
- published
14+
- prereleased
15+
1116
env:
1217
BUILD_TYPE: Release
1318
CLICKHOUSE_SERVER_IMAGE: "clickhouse/clickhouse-server:22.3"
@@ -65,54 +70,57 @@ jobs:
6570
runs-on: ${{matrix.os}}
6671

6772
steps:
68-
- uses: actions/checkout@v2
69-
70-
- name: Install dependencies
71-
run: |
72-
sudo apt-get update && \
73-
sudo apt-get install -y \
74-
docker \
73+
- uses: actions/checkout@v4
74+
with:
75+
fetch-depth: 100
76+
fetch-tags: true
77+
78+
- name: Install dependencies
79+
run: |
80+
sudo apt-get update && \
81+
sudo apt-get install -y \
82+
docker \
83+
cmake \
84+
${{matrix.COMPILER_INSTALL}} \
85+
${{matrix.DEPENDENCIES_INSTALL}}
86+
87+
- name: Install dependencies - Docker
88+
run: |
89+
sudo apt remove -y docker docker-engine docker.io containerd runc
90+
sudo apt install -y apt-transport-https ca-certificates curl gnupg lsb-release
91+
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
92+
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
93+
sudo apt update -q
94+
sudo apt install docker-ce docker-ce-cli containerd.io
95+
96+
- name: Configure project
97+
run: |
98+
cmake \
99+
-D CMAKE_C_COMPILER=${{matrix.C_COMPILER}} \
100+
-D CMAKE_CXX_COMPILER=${{matrix.CXX_COMPILER}} \
101+
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
102+
-D BUILD_TESTS=ON \
103+
${{matrix.SSL_CMAKE_OPTION}} \
104+
${{matrix.DEPENDENCIES_CMAKE_OPTIONS}} \
105+
-S ${{github.workspace}} \
106+
-B ${{github.workspace}}/build
107+
108+
- name: Build project
109+
run: |
75110
cmake \
76-
${{matrix.COMPILER_INSTALL}} \
77-
${{matrix.DEPENDENCIES_INSTALL}}
78-
79-
- name: Install dependencies - Docker
80-
run: |
81-
sudo apt remove -y docker docker-engine docker.io containerd runc
82-
sudo apt install -y apt-transport-https ca-certificates curl gnupg lsb-release
83-
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
84-
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
85-
sudo apt update -q
86-
sudo apt install docker-ce docker-ce-cli containerd.io
87-
88-
- name: Configure project
89-
run: |
90-
cmake \
91-
-D CMAKE_C_COMPILER=${{matrix.C_COMPILER}} \
92-
-D CMAKE_CXX_COMPILER=${{matrix.CXX_COMPILER}} \
93-
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
94-
-D BUILD_TESTS=ON \
95-
${{matrix.SSL_CMAKE_OPTION}} \
96-
${{matrix.DEPENDENCIES_CMAKE_OPTIONS}} \
97-
-S ${{github.workspace}} \
98-
-B ${{github.workspace}}/build
99-
100-
- name: Build project
101-
run: |
102-
cmake \
103-
--build ${{github.workspace}}/build \
104-
--config ${{env.BUILD_TYPE}} \
105-
--target all
106-
107-
- name: Test - Start ClickHouse server in background
108-
run: |
109-
docker pull ${CLICKHOUSE_SERVER_IMAGE}
110-
docker run -d --name clickhouse -p 9000:9000 ${CLICKHOUSE_SERVER_IMAGE}
111-
docker ps -a
112-
docker stats -a --no-stream
113-
## Check and wait until CH is ready to accept connections
114-
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'
115-
116-
- name: Test
117-
working-directory: ${{github.workspace}}/build/ut
118-
run: ./clickhouse-cpp-ut
111+
--build ${{github.workspace}}/build \
112+
--config ${{env.BUILD_TYPE}} \
113+
--target all
114+
115+
- name: Test - Start ClickHouse server in background
116+
run: |
117+
docker pull ${CLICKHOUSE_SERVER_IMAGE}
118+
docker run -d --name clickhouse -p 9000:9000 ${CLICKHOUSE_SERVER_IMAGE}
119+
docker ps -a
120+
docker stats -a --no-stream
121+
## Check and wait until CH is ready to accept connections
122+
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'
123+
124+
- name: Test
125+
working-directory: ${{github.workspace}}/build/ut
126+
run: ./clickhouse-cpp-ut

.github/workflows/macos.yml

Lines changed: 40 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ on:
77
branches: [ master ]
88
pull_request:
99
branches: [ master ]
10+
release:
11+
types:
12+
- published
13+
- prereleased
1014

1115
env:
1216
BUILD_TYPE: Release
@@ -31,41 +35,44 @@ jobs:
3135
SSL_INSTALL: openssl
3236

3337
steps:
34-
- uses: actions/checkout@v2
38+
- uses: actions/checkout@v4
39+
with:
40+
fetch-depth: 100
41+
fetch-tags: true
3542

36-
- name: Install dependencies
37-
run: brew install cmake ${{matrix.SSL_INSTALL}}
43+
- name: Install dependencies
44+
run: brew install cmake ${{matrix.SSL_INSTALL}}
3845

39-
- name: Configure CMake
40-
run: |
41-
cmake \
42-
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
43-
-D BUILD_TESTS=ON \
44-
${{matrix.SSL_CMAKE_OPTION}} \
45-
-S ${{github.workspace}} \
46-
-B ${{github.workspace}}/build
46+
- name: Configure CMake
47+
run: |
48+
cmake \
49+
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
50+
-D BUILD_TESTS=ON \
51+
${{matrix.SSL_CMAKE_OPTION}} \
52+
-S ${{github.workspace}} \
53+
-B ${{github.workspace}}/build
4754
48-
- name: Build
49-
run: |
50-
cmake \
51-
--build ${{github.workspace}}/build \
52-
--config ${{env.BUILD_TYPE}} \
53-
--target all
55+
- name: Build
56+
run: |
57+
cmake \
58+
--build ${{github.workspace}}/build \
59+
--config ${{env.BUILD_TYPE}} \
60+
--target all
5461
55-
- name: Start tls offoader proxy
56-
# that mimics non-secure clickhouse running on localhost
57-
# by tunneling queries to remote tls server
58-
# (needed because we can't start real clickhouse instance on macOS)
59-
run: |
60-
wget https://github.com/filimonov/go-tlsoffloader/releases/download/v0.1.2/go-tlsoffloader_0.1.2_Darwin_x86_64.tar.gz
61-
tar -xvzf go-tlsoffloader_0.1.2_Darwin_x86_64.tar.gz
62-
./go-tlsoffloader -l localhost:9000 -b github.demo.trial.altinity.cloud:9440 &
62+
- name: Start tls offoader proxy
63+
# that mimics non-secure clickhouse running on localhost
64+
# by tunneling queries to remote tls server
65+
# (needed because we can't start real clickhouse instance on macOS)
66+
run: |
67+
wget https://github.com/filimonov/go-tlsoffloader/releases/download/v0.1.2/go-tlsoffloader_0.1.2_Darwin_x86_64.tar.gz
68+
tar -xvzf go-tlsoffloader_0.1.2_Darwin_x86_64.tar.gz
69+
./go-tlsoffloader -l localhost:9000 -b github.demo.trial.altinity.cloud:9440 &
6370
64-
- name: Test
65-
working-directory: ${{github.workspace}}/build/ut
66-
env:
67-
# It is impossible to start CH server in docker on macOS due to github actions limitations,
68-
# so we use remote server to execute tests, some do not allow some features for anonymoust/free users:
69-
# - system.query_log used by 'Client/ClientCase.Query_ID'
70-
GTEST_FILTER: "-Client/ClientCase.Query_ID*:Client/ClientCase.TracingContext/*"
71-
run: ./clickhouse-cpp-ut ${GTEST_FILTER}
71+
- name: Test
72+
working-directory: ${{github.workspace}}/build/ut
73+
env:
74+
# It is impossible to start CH server in docker on macOS due to github actions limitations,
75+
# so we use remote server to execute tests, some do not allow some features for anonymoust/free users:
76+
# - system.query_log used by 'Client/ClientCase.Query_ID'
77+
GTEST_FILTER: "-Client/ClientCase.Query_ID*:Client/ClientCase.TracingContext/*"
78+
run: ./clickhouse-cpp-ut ${GTEST_FILTER}

.github/workflows/windows_mingw.yml

Lines changed: 45 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ on:
88
pull_request:
99
branches: [ master ]
1010

11+
release:
12+
types:
13+
- published
14+
- prereleased
15+
1116
env:
1217
BUILD_TYPE: Release
1318
CLICKHOUSE_USER: clickhouse_cpp_cicd
@@ -49,44 +54,48 @@ jobs:
4954
shell: msys2 {0}
5055

5156
steps:
52-
- uses: actions/checkout@v2
53-
- uses: msys2/setup-msys2@v2
54-
with:
55-
msystem: ${{ matrix.sys }}
56-
update: true
57-
install: >-
58-
mingw-w64-${{matrix.env}}-cmake
59-
mingw-w64-${{matrix.env}}-make
60-
mingw-w64-${{matrix.env}}-gcc
61-
mingw-w64-${{matrix.env}}-openssl
62-
mingw-w64-${{matrix.env}}-ninja
63-
mingw-w64-${{matrix.env}}-wget
64-
mingw-w64-${{matrix.env}}-ca-certificates
65-
tar
57+
- uses: actions/checkout@v4
58+
with:
59+
fetch-depth: 100
60+
fetch-tags: true
61+
- uses: msys2/setup-msys2@v2
62+
with:
63+
msystem: ${{ matrix.sys }}
64+
update: true
65+
install: >-
66+
mingw-w64-${{matrix.env}}-cmake
67+
mingw-w64-${{matrix.env}}-make
68+
mingw-w64-${{matrix.env}}-gcc
69+
mingw-w64-${{matrix.env}}-openssl
70+
mingw-w64-${{matrix.env}}-ninja
71+
mingw-w64-${{matrix.env}}-wget
72+
mingw-w64-${{matrix.env}}-ca-certificates
73+
tar
6674
67-
- name: Configure CMake
68-
run: cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_TESTS=ON
69-
# -DWITH_OPENSSL=ON was not able to make it work (some strange issues with CA paths, need debug)
75+
- name: Configure CMake
76+
run: cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_TESTS=ON -DCHECK_VERSION=OFF
77+
# -DWITH_OPENSSL=ON was not able to make it work (some strange issues with CA paths, need debug)
78+
# -DCHECK_VERSION=OFF since it requires git, which can't be found from within cmake for some reason.
7079

71-
- name: Build
72-
run: cmake --build build --config ${{env.BUILD_TYPE}} --target all
80+
- name: Build
81+
run: cmake --build build --config ${{env.BUILD_TYPE}} --target all
7382

74-
- name: Start tls offoader proxy
75-
# that mimics non-secure clickhouse running on localhost
76-
# by tunneling queries to remote tls server
77-
# (needed because we can't start real clickhouse instance on windows)
78-
run: |
79-
wget https://github.com/filimonov/go-tlsoffloader/releases/download/v0.1.2/go-tlsoffloader_0.1.2_Windows_x86_64.tar.gz
80-
tar -xvzf go-tlsoffloader_0.1.2_Windows_x86_64.tar.gz
81-
./go-tlsoffloader.exe -l localhost:9000 -b github.demo.trial.altinity.cloud:9440 &
83+
- name: Start tls offoader proxy
84+
# that mimics non-secure clickhouse running on localhost
85+
# by tunneling queries to remote tls server
86+
# (needed because we can't start real clickhouse instance on windows)
87+
run: |
88+
wget https://github.com/filimonov/go-tlsoffloader/releases/download/v0.1.2/go-tlsoffloader_0.1.2_Windows_x86_64.tar.gz
89+
tar -xvzf go-tlsoffloader_0.1.2_Windows_x86_64.tar.gz
90+
./go-tlsoffloader.exe -l localhost:9000 -b github.demo.trial.altinity.cloud:9440 &
8291
83-
- name: Test
84-
env:
85-
# It is impossible to start CH server in docker on Windows due to github actions limitations,
86-
# so we use remote server to execute tests, some do not allow some features for anonymoust/free users:
87-
# - system.query_log used by 'Client/ClientCase.Query_ID'
88-
GTEST_FILTER: "-Client/ClientCase.Query_ID*:Client/ClientCase.TracingContext/*"
89-
run: ./build/ut/clickhouse-cpp-ut.exe ${GTEST_FILTER}
92+
- name: Test
93+
env:
94+
# It is impossible to start CH server in docker on Windows due to github actions limitations,
95+
# so we use remote server to execute tests, some do not allow some features for anonymoust/free users:
96+
# - system.query_log used by 'Client/ClientCase.Query_ID'
97+
GTEST_FILTER: "-Client/ClientCase.Query_ID*:Client/ClientCase.TracingContext/*"
98+
run: ./build/ut/clickhouse-cpp-ut.exe ${GTEST_FILTER}
9099

91-
- name: Test (simple)
92-
run: ./build/tests/simple/simple-test.exe
100+
- name: Test (simple)
101+
run: ./build/tests/simple/simple-test.exe

.github/workflows/windows_msvc.yml

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ on:
88
pull_request:
99
branches: [ master ]
1010

11+
release:
12+
types:
13+
- published
14+
- prereleased
15+
1116
env:
1217
BUILD_TYPE: Release
1318
CLICKHOUSE_USER: clickhouse_cpp_cicd
@@ -36,31 +41,34 @@ jobs:
3641
runs-on: windows-latest
3742

3843
steps:
39-
- uses: actions/checkout@v2
40-
- uses: ilammy/msvc-dev-cmd@v1
44+
- uses: actions/checkout@v4
45+
with:
46+
fetch-depth: 100
47+
fetch-tags: true
48+
- uses: ilammy/msvc-dev-cmd@v1
4149

42-
- name: Configure CMake
43-
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_TESTS=ON
50+
- name: Configure CMake
51+
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_TESTS=ON
4452

45-
- name: Build
46-
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
53+
- name: Build
54+
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
4755

48-
- name: Start tls offoader proxy
49-
shell: bash
50-
# that mimics non-secure clickhouse running on localhost
51-
# by tunneling queries to remote tls server
52-
# (needed because we can't start real clickhouse instance on windows)
53-
run: |
54-
choco install wget
55-
wget https://github.com/filimonov/go-tlsoffloader/releases/download/v0.1.2/go-tlsoffloader_0.1.2_Windows_x86_64.tar.gz
56-
tar -xvzf go-tlsoffloader_0.1.2_Windows_x86_64.tar.gz
57-
./go-tlsoffloader.exe -l localhost:9000 -b github.demo.trial.altinity.cloud:9440 &
56+
- name: Start tls offoader proxy
57+
shell: bash
58+
# that mimics non-secure clickhouse running on localhost
59+
# by tunneling queries to remote tls server
60+
# (needed because we can't start real clickhouse instance on windows)
61+
run: |
62+
choco install wget
63+
wget https://github.com/filimonov/go-tlsoffloader/releases/download/v0.1.2/go-tlsoffloader_0.1.2_Windows_x86_64.tar.gz
64+
tar -xvzf go-tlsoffloader_0.1.2_Windows_x86_64.tar.gz
65+
./go-tlsoffloader.exe -l localhost:9000 -b github.demo.trial.altinity.cloud:9440 &
5866
59-
- name: Test
60-
env:
61-
# It is impossible to start CH server in docker on Windows due to github actions limitations,
62-
# so we use remote server to execute tests, some do not allow some features for anonymoust/free users:
63-
# - system.query_log used by 'Client/ClientCase.Query_ID'
64-
GTEST_FILTER: "-Client/ClientCase.Query_ID*:Client/ClientCase.TracingContext/*"
65-
working-directory: ${{github.workspace}}/build/ut
66-
run: Release\clickhouse-cpp-ut.exe "${{env.GTEST_FILTER}}"
67+
- name: Test
68+
env:
69+
# It is impossible to start CH server in docker on Windows due to github actions limitations,
70+
# so we use remote server to execute tests, some do not allow some features for anonymoust/free users:
71+
# - system.query_log used by 'Client/ClientCase.Query_ID'
72+
GTEST_FILTER: "-Client/ClientCase.Query_ID*:Client/ClientCase.TracingContext/*"
73+
working-directory: ${{github.workspace}}/build/ut
74+
run: Release\clickhouse-cpp-ut.exe "${{env.GTEST_FILTER}}"

0 commit comments

Comments
 (0)