Repository navigation
288 lines (246 loc) · 11.2 KB
/
Copy pathmacOS.yml
File metadata and controls
288 lines (246 loc) · 11.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
name: Build and Test - macOS
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * 1'
push:
branches: [ master ]
pull_request:
branches: [ '**' ]
release:
types:
- created
concurrency:
group: macos-${{ github.head_ref }}
cancel-in-progress: true
env:
CLICKHOUSE_SERVER_IMAGE: "yandex/clickhouse-server:20.3"
defaults:
run:
shell: bash
working-directory: run
jobs:
build_and_test:
env:
CLOUD_TESTS_ENABLED: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_HOST_SMT != '' }}
strategy:
fail-fast: false
matrix:
os: [macos-latest]
odbc_provider: [UnixODBC]
compiler: [AppleClang]
build_type: [Debug, Release]
runtime_link: [dynamic-runtime]
third_parties: [bundled-third-parties]
runs-on: ${{ matrix.os }}
steps:
- name: Create directories
working-directory: ${{ github.workspace }}
run: |
mkdir -p ${{ github.workspace }}/run
mkdir -p ${{ github.workspace }}/build
mkdir -p ${{ github.workspace }}/prefix
mkdir -p ${{ github.workspace }}/install
mkdir -p ${{ github.workspace }}/package
- name: Clone the repo
uses: actions/checkout@v4
with:
path: source
submodules: true
- name: Install dependencies - Common
run: |
brew remove -f --ignore-dependencies -q libiodbc unixodbc freetds php node composer
brew install git cmake perl python openssl poco icu4c binutils curl
pip3 install --break-system-packages --user 'testflows==1.6.56'
- name: Install dependencies - UnixODBC
if: ${{ matrix.odbc_provider == 'UnixODBC' }}
run: |
brew install unixodbc
pip3 install --break-system-packages --user pyodbc
# Right now folly fails to compile and link against brew's clang & libcpp versions 11-14
# Since Clang is removed from list of compilers in matrix, this will not be executed.
# - name: Install dependencies - Clang
# if: ${{ matrix.compiler == 'Clang' }}
# run: brew install llvm
- name: Install dependencies - GCC
if: ${{ matrix.compiler == 'GCC' }}
run: |
brew install gcc gdb
export COMPILER_PATH=$(brew prefix gcc)/bin
- name: Start ClickHouse server in background
run: |
curl https://clickhouse.com | bash
sudo ./clickhouse install
sudo ./clickhouse start
- name: Configure
run: |
dsn_list=(
"ClickHouse DSN (ANSI)"
"ClickHouse DSN (Unicode)"
"ClickHouse DSN (ANSI) ZSTD"
"ClickHouse DSN (Unicode) ZSTD"
"ClickHouse AWS ANSI ZSTD"
"ClickHouse AWS Unicode ZSTD"
)
dsn_string=$(IFS=';'; echo "${dsn_list[*]}")
CC=${{ fromJSON('{"AppleClang": "cc", "Clang": "/usr/local/opt/llvm/bin/clang", "GCC": "$COMPILER_PATH/gcc-11"}')[matrix.compiler] }} \
CXX=${{ fromJSON('{"AppleClang": "c++", "Clang": "/usr/local/opt/llvm/bin/clang++", "GCC": "$COMPILER_PATH/g++-11"}')[matrix.compiler] }} \
cmake -S ${{ github.workspace }}/source -B ${{ github.workspace }}/build \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DODBC_PROVIDER=${{ matrix.odbc_provider }} \
-DICU_ROOT="$(brew --prefix icu4c)" \
-DOPENSSL_ROOT_DIR="$(brew --prefix openssl)" \
-DCH_ODBC_RUNTIME_LINK_STATIC=${{ fromJSON('{"static-runtime": "ON", "dynamic-runtime": "OFF"}')[matrix.runtime_link] }} \
-DCH_ODBC_PREFER_BUNDLED_THIRD_PARTIES=${{ fromJSON('{"bundled-third-parties": "ON", "system-third-parties": "OFF"}')[matrix.third_parties] }} \
-DTEST_DSN_LIST="$dsn_string" \
-DBUILD_TESTING=YES
- name: Build
run: cmake --build ${{ github.workspace }}/build --config ${{ matrix.build_type }}
- name: Package
run: cmake --build ${{ github.workspace }}/build --config ${{ matrix.build_type }} --target package
- name: List artifacts
run: |
echo REF: ${{ github.ref }}
ls -lahR ${{ github.workspace }}/build/
- name: Upload the artifacts
# if: ${{ matrix.compiler == 'AppleClang' && matrix.odbc_provider == 'iODBC' && matrix.build_type == 'Release' }}
uses: actions/upload-artifact@v4
with:
name: clickhouse-odbc-macos-${{ matrix.compiler }}-${{ matrix.odbc_provider }}-${{ matrix.build_type }}
path: ${{ github.workspace }}/build/clickhouse-odbc-*
- name: Test - Run C++ unit tests
working-directory: ${{ github.workspace }}/build
run: ctest --output-on-failure --build-config ${{ matrix.build_type }} -R '.*-ut.*'
- name: Create Test Database
if: ${{ env.CLOUD_TESTS_ENABLED == 'true' && matrix.build_type == 'Release' }}
run: |
timestamp=$(date +%s)
database="test${timestamp}000_odbc_macos_${{ matrix.build_type }}"
echo "TEST_DATABASE=$database" >> $GITHUB_ENV
curl --fail-with-body -X POST \
"https://${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_HOST_SMT }}:8443/?query=" \
-u "default:${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_PASSWORD_SMT }}" \
-d "create database $database"
- name: Prepare ODBC ini configs
run: |
export ODBCSYSINI=${{ github.workspace }}/run
export ODBCINSTINI=.odbcinst.ini
export ODBCINI=$ODBCSYSINI/.odbc.ini
cat > $ODBCSYSINI/.odbcinst.ini <<-EOF
[ODBC]
Trace = 1
TraceFile = ${{ github.workspace }}/run/odbc-driver-manager-trace.log
Debug = 1
DebugFile = ${{ github.workspace }}/run/odbc-driver-manager-debug.log
[ODBC Drivers]
ClickHouse ODBC Driver (ANSI) = Installed
ClickHouse ODBC Driver (Unicode) = Installed
[ClickHouse ODBC Driver (ANSI)]
Driver = ${{ github.workspace }}/build/driver/libclickhouseodbc.dylib
Setup = ${{ github.workspace }}/build/driver/libclickhouseodbc.dylib
UsageCount = 1
[ClickHouse ODBC Driver (Unicode)]
Driver = ${{ github.workspace }}/build/driver/libclickhouseodbcw.dylib
Setup = ${{ github.workspace }}/build/driver/libclickhouseodbcw.dylib
UsageCount = 1
EOF
cat > $ODBCSYSINI/.odbc.ini <<-EOF
[ODBC]
Trace = 1
TraceFile = ${{ github.workspace }}/run/odbc-driver-manager-trace.log
Debug = 1
DebugFile = ${{ github.workspace }}/run/odbc-driver-manager-debug.log
[ODBC Data Sources]
ClickHouse DSN (ANSI) = ClickHouse ODBC Driver (ANSI)
ClickHouse DSN (Unicode) = ClickHouse ODBC Driver (Unicode)
[ClickHouse DSN (ANSI)]
Driver = ClickHouse ODBC Driver (ANSI)
Description = Test DSN for ClickHouse ODBC Driver (ANSI)
Url = http://localhost:8123
DriverLog = yes
DriverLogFile = ${{ github.workspace }}/run/clickhouse-odbc-driver.log
Compression = 0
[ClickHouse DSN (Unicode)]
Driver = ClickHouse ODBC Driver (Unicode)
Description = Test DSN for ClickHouse ODBC Driver (Unicode)
Url = http://localhost:8123
DriverLog = yes
DriverLogFile = ${{ github.workspace }}/run/clickhouse-odbc-driver-w.log
Compression = 0
[ClickHouse DSN (ANSI) ZSTD]
Driver = ClickHouse ODBC Driver (ANSI)
Description = Test DSN for ClickHouse ODBC Driver (ANSI)
Url = http://localhost:8123
DriverLog = yes
DriverLogFile = ${{ github.workspace }}/run/clickhouse-odbc-driver.log
Compression = 1
[ClickHouse DSN (Unicode) ZSTD]
Driver = ClickHouse ODBC Driver (Unicode)
Description = Test DSN for ClickHouse ODBC Driver (Unicode)
Url = http://localhost:8123
DriverLog = yes
DriverLogFile = ${{ github.workspace }}/run/clickhouse-odbc-driver-w.log
Compression = 1
[ClickHouse AWS Unicode ZSTD]
Driver = ClickHouse ODBC Driver (Unicode)
Description = Test DSN for ClickHouse ODBC Driver (Unicode)
Url = https://${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_HOST_SMT }}:8443/?database=$TEST_DATABASE
Username = default
Password = ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_PASSWORD_SMT }}
DriverLog = yes
DriverLogFile = ${{ github.workspace }}/run/clickhouse-odbc-driver.log
Compression = 1
[ClickHouse AWS ANSI ZSTD]
Driver = ClickHouse ODBC Driver (ANSI)
Description = Test DSN for ClickHouse ODBC Driver (ANSI)
Url = https://${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_HOST_SMT }}:8443/?database=$TEST_DATABASE
Username = default
Password = ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_PASSWORD_SMT }}
DriverLog = yes
DriverLogFile = ${{ github.workspace }}/run/clickhouse-odbc-driver-w.log
Compression = 1
EOF
- name: Test - Run C++ integration tests
working-directory: ${{ github.workspace }}/build
env:
DSN: "ClickHouse DSN (ANSI)"
ODBCSYSINI: "" # Must be set for `ODBCINSTINI` and `ODBCINI` to work
ODBCINSTINI: ${{ github.workspace }}/run/.odbcinst.ini
ODBCINI: ${{ github.workspace }}/run/.odbc.ini
run: |
if [[ "${{ matrix.odbc_provider }}" == "iODBC" ]]; then
export GTEST_FILTER="-PerformanceTest.*"
fi
ctest --output-on-failure --build-config ${{ matrix.build_type }} -E '(.*-ut.*|-dsn-[45]$)'
- name: Test - Run C++ integration tests in the Cloud
working-directory: ${{ github.workspace }}/build
if: ${{ env.CLOUD_TESTS_ENABLED == 'true' && matrix.build_type == 'Release' }}
env:
DSN: "ClickHouse DSN (ANSI)"
ODBCSYSINI: "" # Must be set for `ODBCINSTINI` and `ODBCINI` to work
ODBCINSTINI: ${{ github.workspace }}/run/.odbcinst.ini
ODBCINI: ${{ github.workspace }}/run/.odbc.ini
GTEST_FILTER: -AuthenticationTest.PasswordEncoding:PerformanceTest*:DateTime*:ScalarFunctionsTest.CONVERT
run: |
ctest --output-on-failure --build-config ${{ matrix.build_type }} -R '.*-dsn-[45]'
- name: Upload artifacts as release assets
if: ${{ github.event_name == 'release' && matrix.build_type == 'Release' }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ github.workspace }}/build/clickhouse-odbc-*
overwrite: true
tag: ${{ github.ref }}
file_glob: true
- name: Drop Test Database
if: always() && env.CLOUD_TESTS_ENABLED == 'true' && env.TEST_DATABASE != ''
run: |
curl -X POST \
"https://${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_HOST_SMT }}:8443/?query=" \
-u "default:${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_PASSWORD_SMT }}" \
-d "select name from system.tables where database = '$TEST_DATABASE'"
curl -X POST \
"https://${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_HOST_SMT }}:8443/?query=" \
-u "default:${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_PASSWORD_SMT }}" \
-d "drop database if exists $TEST_DATABASE"