-
Notifications
You must be signed in to change notification settings - Fork 4
326 lines (288 loc) · 10.8 KB
/
failover.yml
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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
name: Failover Unit Tests
on:
push:
branches:
- main
pull_request:
branches:
- '*'
paths-ignore:
- '**/*.md'
- '**/*.jpg'
- '**/README.txt'
- '**/LICENSE.txt'
- 'docs/**'
- 'ISSUE_TEMPLATE/**'
- '**/remove-old-artifacts.yml'
env:
LINUX_BUILD_TYPE: Release
WINDOWS_BUILD_TYPE: Debug
MAC_BUILD_TYPE: Debug
jobs:
build-windows:
name: Windows
runs-on: windows-2019
env:
CMAKE_GENERATOR: Visual Studio 16 2019
MYSQL_DIR: C:/mysql-${{ vars.MYSQL_VERSION }}-winx64
steps:
- name: Checkout source code
uses: actions/checkout@v2
# Configure build environment/dependencies
- name: Install MySQL client libs and include files
run: |
curl -L https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-${{ vars.MYSQL_VERSION }}-winx64.zip -o mysql.zip
curl -L https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-${{ vars.MYSQL_VERSION }}-winx64-debug-test.zip -o mysql-debug.zip
unzip -d C:/ mysql.zip
mkdir C:/mysql-${{ vars.MYSQL_VERSION }}-winx64-debug
unzip -d C:/mysql-${{ vars.MYSQL_VERSION }}-winx64-debug mysql-debug.zip
mv -Force C:/mysql-${{ vars.MYSQL_VERSION }}-winx64-debug/mysql-${{ vars.MYSQL_VERSION }}-winx64/lib/debug/mysqlclient.lib C:/mysql-${{ vars.MYSQL_VERSION }}-winx64/lib/mysqlclient.lib
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.1
- name: Cache AWS SDK libraries
id: cache-static-aws-sdk
uses: actions/cache@v3
with:
path: |
aws_sdk
key: ${{ runner.os }}-aws-sdk-static-lib
- name: Build and install AWS SDK C++
working-directory: ./scripts
if: steps.cache-static-aws-sdk.outputs.cache-hit != 'true'
run: |
.\build_aws_sdk_win.ps1 x64 ${{ env.WINDOWS_BUILD_TYPE}} ON "${{env.CMAKE_GENERATOR}}"
- name: Create build environment
shell: bash
run: cmake -E make_directory ${{ github.workspace }}/build
- name: Configure CMake
shell: bash
run: cmake -S . -B build -A x64
-G "$CMAKE_GENERATOR"
-DCMAKE_BUILD_TYPE=$WINDOWS_BUILD_TYPE
-DMYSQLCLIENT_STATIC_LINKING=TRUE
-DENABLE_UNIT_TESTS=TRUE
-DENABLE_INTEGRATION_TESTS=FALSE
# Configure test environment
- name: Build Driver
shell: bash
working-directory: ${{ github.workspace }}/build
run: |
cmake --build . --config $WINDOWS_BUILD_TYPE
- name: Run failover tests
if: always()
working-directory: ${{ github.workspace }}/build/unit_testing
run: |
set PATH=${{ github.workspace }}/build/lib/${{env.WINDOWS_BUILD_TYPE}};%PATH%
ctest -C $WINDOWS_BUILD_TYPE --output-on-failure
- name: Check memory leaks
if: always()
working-directory: ${{ github.workspace }}/build/unit_testing/Testing/Temporary
run: |
$is_leaking = Select-String -Path ./LastTest.log -Pattern 'leak' -SimpleMatch
if ($is_leaking) {echo $is_leaking; exit 1;}
# Upload artifacts
- name: Upload build artifacts - Binaries
if: always()
uses: actions/upload-artifact@v2
with:
name: windows-failover-sln
path: ${{ github.workspace }}/build/MySQL_Connector_ODBC.sln
- name: Upload build artifacts - Binaries
if: always()
uses: actions/upload-artifact@v2
with:
name: windows-failover-binaries
path: ${{ github.workspace }}/build/bin/
- name: Upload build artifacts - Libraries
if: always()
uses: actions/upload-artifact@v2
with:
name: windows-failover-libraries
path: ${{ github.workspace }}/build/lib/
- name: Upload failover test artifacts
if: always()
uses: actions/upload-artifact@v2
with:
name: windows-failover-results
path: ${{ github.workspace }}/build/unit_testing/Testing/Temporary/LastTest.log
build-linux:
name: Linux
runs-on: ubuntu-20.04
env:
CMAKE_GENERATOR: Unix Makefiles
CXX: g++-7
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Install gcc7
run: sudo apt install g++-7
# Configure build environment/dependencies
- name: Install MySQL client libs & other dependencies
run: sudo apt-get update && sudo apt-get install
build-essential
libgtk-3-dev
libmysqlclient-dev
unixodbc
unixodbc-dev
libcurl4-openssl-dev libssl-dev uuid-dev zlib1g-dev # AWS SDK dependencies
- name: Cache AWS SDK libraries
id: cache-dynamic-aws-sdk
uses: actions/cache@v3
with:
path: |
aws_sdk
key: ${{ runner.os }}-aws-sdk-dynamic-lib
- name: Build and install AWS SDK C++
working-directory: ./scripts
if: steps.cache-dynamic-aws-sdk.outputs.cache-hit != 'true'
run: |
./build_aws_sdk_unix.sh $LINUX_BUILD_TYPE
- name: Create build environment
shell: bash
run: cmake -E make_directory ${{ github.workspace }}/build
- name: Configure CMake
shell: bash
run: cmake -S . -B build
-G "$CMAKE_GENERATOR"
-DCMAKE_BUILD_TYPE=$LINUX_BUILD_TYPE
-DMYSQLCLIENT_STATIC_LINKING=true
-DWITH_UNIXODBC=1
-DENABLE_UNIT_TESTS=TRUE
-DENABLE_INTEGRATION_TESTS=FALSE
- name: copy AWS SDK libraries to driver library
run: |
cp ./aws_sdk/install/lib/*.so ./build/lib/
# Build driver
- name: Build driver
working-directory: ${{ github.workspace }}/build
shell: bash
run: make -j4
# Test driver
- name: Run failover tests on Linux
if: success()
working-directory: ${{ github.workspace }}/build/unit_testing
shell: bash
run: ctest --output-on-failure
# Upload artifacts
- name: Upload build artifacts - Binaries
if: always()
uses: actions/upload-artifact@v2
with:
name: linux-failover-binaries
path: ${{ github.workspace }}/build/bin/
- name: Upload build artifacts - Libraries
if: always()
uses: actions/upload-artifact@v2
with:
name: linux-failover-libraries
path: ${{ github.workspace }}/build/lib/
- name: Upload test artifacts
if: always()
uses: actions/upload-artifact@v2
with:
name: linux-failover-results
path: ${{ github.workspace }}/build/unit_testing/Testing/Temporary/LastTest.log
build-mac:
name: MacOS
runs-on: macos-13
env:
CMAKE_GENERATOR: Unix Makefiles
ODBC_DM_INCLUDES: /usr/local/include
steps:
- name: Checkout source code
uses: actions/checkout@v2
# Configure build environment/dependencies
# Removing some /usr/local/bin files to avoid symlink issues wih brew update
- name: Install MySQL client libs & other dependencies
run: |
rm '/usr/local/bin/2to3'
rm '/usr/local/bin/2to3-3.11'
rm '/usr/local/bin/idle3'
rm '/usr/local/bin/idle3.11'
rm '/usr/local/bin/pydoc3'
rm '/usr/local/bin/pydoc3.11'
rm '/usr/local/bin/python3'
rm '/usr/local/bin/python3-config'
rm '/usr/local/bin/python3.11'
rm '/usr/local/bin/python3.11-config'
brew update
brew unlink unixodbc
brew install libiodbc mysql-client
brew link --overwrite --force libiodbc
brew install openssl@1.1
rm -f /usr/local/lib/libssl.1.1.dylib
rm -f /usr/local/lib/libcrypto.1.1.dylib
ln -s /usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib /usr/local/lib/
ln -s /usr/local/opt/openssl@1.1/lib/libcrypto.1.1.dylib /usr/local/lib/
curl -L https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-${{ vars.MYSQL_VERSION }}-macos13-x86_64.tar.gz -o mysql.tar.gz
tar -xzvf mysql.tar.gz
- name: Cache AWS SDK libraries
id: cache-dynamic-aws-sdk
uses: actions/cache@v3
with:
path: |
aws_sdk
key: ${{ runner.os }}-aws-sdk-dynamic-lib
- name: Build and install AWS SDK C++
working-directory: ./scripts
if: steps.cache-dynamic-aws-sdk.outputs.cache-hit != 'true'
run: |
./build_aws_sdk_unix.sh $MAC_BUILD_TYPE
- name: Create build environment
shell: bash
run: cmake -E make_directory ${{ github.workspace }}/build
- name: Configure CMake
shell: bash
run: cmake -S . -B build
-G "$CMAKE_GENERATOR"
-DCMAKE_BUILD_TYPE=$MAC_BUILD_TYPE
-DMYSQLCLIENT_STATIC_LINKING=true
-DODBC_INCLUDES=$ODBC_DM_INCLUDES
-DENABLE_UNIT_TESTS=TRUE
-DENABLE_INTEGRATION_TESTS=FALSE
-DMYSQL_DIR=./mysql-${{ vars.MYSQL_VERSION }}-macos13-x86_64
# Build driver
- name: Build driver
working-directory: ${{ github.workspace }}/build
shell: bash
run: |
export LIBRARY_PATH=$LIBRARY_PATH:$(brew --prefix zstd)/lib/
cmake --build .
# Test driver
- name: Run driver tests
if: success()
working-directory: ${{ github.workspace }}/build/unit_testing
shell: bash
run: ctest --output-on-failure
- name: Check memory leaks
if: always()
working-directory: ${{ github.workspace }}/build/unit_testing/bin
run: |
leaks -atExit -- ./unit_testing > ../leaks_unit_testing.txt
export is_leaking=$?
if (( $is_leaking != 0 )); then echo $is_leaking; exit 1; else echo "no memory leaks"; fi;
# Upload artifacts
- name: Upload build artifacts - Binaries
if: always()
uses: actions/upload-artifact@v2
with:
name: macos-binaries
path: ${{ github.workspace }}/build/bin/
- name: Upload build artifacts - Libraries
if: always()
uses: actions/upload-artifact@v2
with:
name: macos-libraries
path: ${{ github.workspace }}/build/lib/
- name: Upload test artifacts
if: always()
uses: actions/upload-artifact@v2
with:
name: macos-failover-results
path: ${{ github.workspace }}/build/unit_testing/Testing/Temporary/LastTest.log
- name: Upload memory leaks check
if: always()
uses: actions/upload-artifact@v2
with:
name: macos-memory-leaks-results
path: ${{ github.workspace }}/build/unit_testing/leaks_unit_testing.txt