-
Notifications
You must be signed in to change notification settings - Fork 5
254 lines (227 loc) · 8.57 KB
/
main.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
name: Community Tests
on:
push:
branches:
- main
pull_request:
branches:
- '*'
paths-ignore:
- '**/*.md'
- '**/*.jpg'
- '**/README.txt'
- '**/LICENSE.txt'
- 'docs/**'
- 'ISSUE_TEMPLATE/**'
- '**/remove-old-artifacts.yml'
env:
BUILD_TYPE: Release
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@v4
# # Configure build environment/dependencies
# - name: Install MySQL client libs
# run: |
# curl -L https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-${{ vars.MYSQL_VERSION }}-winx64.zip -o mysql.zip
# unzip -d C:/ mysql.zip
# - name: Add msbuild to PATH
# uses: microsoft/setup-msbuild@v2
# - name: Cache AWS SDK libraries
# id: cache-dynamic-aws-sdk
# uses: actions/cache@v4
# 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_win.ps1 x64 ${{ env.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
# -G "$CMAKE_GENERATOR"
# -DMYSQL_SQL="C:/mysql-${{ vars.MYSQL_VERSION }}-winx64"
# -DCMAKE_BUILD_TYPE=$BUILD_TYPE
# -DMYSQLCLIENT_STATIC_LINKING=TRUE
# # Configure test environment
# - name: Build Driver and Copy files
# shell: bash
# working-directory: ${{ github.workspace }}/build
# run: |
# cmake --build . --config $BUILD_TYPE
# cp -r lib/Release/* C:/Windows/System32/
# cp -r bin/Release/* C:/Windows/System32/
# - name: Add DSN to registry
# shell: bash
# working-directory: C:/Windows/System32
# run: |
# ./myodbc-installer -d -a -n "AWS ODBC Driver for MySQL" -t "DRIVER=awsmysqlodbca.dll;SETUP=awsmysqlodbcS.dll"
# ./myodbc-installer -s -a -c2 -n "test" -t "DRIVER=AWS ODBC Driver for MySQL;SERVER=localhost;DATABASE=test;UID=root;PWD="
# - name: Start MySQL server for tests
# if: success()
# shell: bash
# run: |
# $MYSQL_DIR/bin/mysqld --initialize-insecure --console
# $MYSQL_DIR/bin/mysqld --console &
# sleep 20
# $MYSQL_DIR/bin/mysql -u root -e "create database test"
# # Test driver
# - name: Run community tests
# if: success()
# working-directory: ${{ github.workspace }}/build/test
# shell: bash
# run: ctest -C $BUILD_TYPE --output-on-failure
# env:
# TEST_DSN: test
# TEST_UID: root
# TEST_DATABASE: test
# TEST_DRIVER: AWS ODBC Driver for MySQL
# # Upload artifacts
# - name: Upload build artifacts - Binaries
# if: always()
# uses: actions/upload-artifact@v4
# with:
# name: windows-sln
# path: ${{ github.workspace }}/build/MySQL_Connector_ODBC.sln
# - name: Upload build artifacts - Binaries
# if: always()
# uses: actions/upload-artifact@v4
# with:
# name: windows-binaries
# path: ${{ github.workspace }}/build/bin/
# - name: Upload build artifacts - Libraries
# if: always()
# uses: actions/upload-artifact@v4
# with:
# name: windows-community-libraries
# path: ${{ github.workspace }}/build/lib/
# - name: Upload community test artifacts
# if: always()
# uses: actions/upload-artifact@v4
# with:
# name: windows-community-results
# path: ${{ github.workspace }}/build/test/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@v4
# 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@8.0 mysql-client@8.0
brew link --overwrite --force libiodbc
brew link --overwrite --force mysql@8.0
echo 'export PATH="/usr/local/opt/mysql@8.0/bin:$PATH"' >> /Users/runner/.bash_profile
echo 'export PATH="/usr/local/opt/mysql-client@8.0/bin:$PATH"' >> /Users/runner/.bash_profile
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/
brew link --overwrite --force openssl@1.1
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@v4
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 $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=$BUILD_TYPE
-DMYSQLCLIENT_STATIC_LINKING=true
-DODBC_INCLUDES=$ODBC_DM_INCLUDES
-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 .
- name: copy AWS SDK libraries to driver library
run: |
cp ./aws_sdk/install/lib/*.dylib ./build/lib/
# Configure test environment
- name: Start MySQL server for tests
if: success()
working-directory: ${{ github.workspace }}/test/docker
shell: bash
run: |
mysql.server start
mysql -u root -e "create database test"
# Test driver
- name: Run driver tests
if: success()
working-directory: ${{ github.workspace }}/build/test
shell: bash
run: |
ctest --output-on-failure
env:
TEST_DSN: awsmysqlodbca
TEST_UID: root
TEST_PASSWORD:
TEST_DRIVER: ${{ github.workspace }}/build/lib/awsmysqlodbca.dylib
ODBCINI: ${{ github.workspace }}/build/test/odbc.ini
ODBCINSTINI: ${{ github.workspace }}/build/test/odbcinst.ini
# Upload artifacts
- name: Upload build artifacts - Binaries
if: always()
uses: actions/upload-artifact@v4
with:
name: macos-community-binaries
path: ${{ github.workspace }}/build/bin/
- name: Upload build artifacts - Libraries
if: always()
uses: actions/upload-artifact@v4
with:
name: macos-libraries
path: ${{ github.workspace }}/build/lib/
- name: Upload test artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: macos-community-results
path: ${{ github.workspace }}/build/test/Testing/Temporary/LastTest.log