-
Notifications
You must be signed in to change notification settings - Fork 4
248 lines (215 loc) · 8.47 KB
/
release.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
name: Release Draft
# This workflow is triggered on creating tags
on:
push:
tags:
- "*.*.*"
env:
BUILD_TYPE: Release
jobs:
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-client
brew link --overwrite --force libiodbc
brew install openssl@3
rm -f /usr/local/lib/libssl.3.dylib
rm -f /usr/local/lib/libcrypto.3.dylib
ln -s /usr/local/opt/openssl@3/lib/libssl.3.dylib /usr/local/lib/
ln -s /usr/local/opt/openssl@3/lib/libcrypto.3.dylib /usr/local/lib/
curl -L https://dev.mysql.com/get/Downloads/MySQL-8.3/mysql-${{ vars.MYSQL_VERSION }}-macos14-x86_64.tar.gz -o mysql.tar.gz
tar -xzvf mysql.tar.gz
- name: Build and install AWS SDK C++
working-directory: ./scripts
run: |
./build_aws_sdk_unix.sh $BUILD_TYPE
- name: Create build environment
run: cmake -E make_directory ${{ github.workspace }}/build
- name: Configure CMake
run: cmake -S . -B build
-G "$CMAKE_GENERATOR"
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
-DMYSQLCLIENT_STATIC_LINKING=true
-DODBC_INCLUDES=$ODBC_DM_INCLUDES
-DCONNECTOR_PLATFORM=macos
-DBUNDLE_DEPENDENCIES=true
-DMYSQL_DIR=./mysql-${{ vars.MYSQL_VERSION }}-macos14-x86_64
- name: Build driver
working-directory: ${{ github.workspace }}/build
run: |
export LIBRARY_PATH=$LIBRARY_PATH:$(brew --prefix zstd)/lib/
cmake --build .
- name: Build installer
working-directory: ${{ github.workspace }}/build
if: success()
run: cpack .
- name: Upload macOS installer as artifact
if: success()
uses: actions/upload-artifact@v4
with:
name: installers-mac
path: ${{ github.workspace }}/build/aws-mysql-odbc-*.pkg
if-no-files-found: error
build-linux:
name: Linux
runs-on: ubuntu-latest
env:
CMAKE_GENERATOR: Unix Makefiles
CXX: g++-11
steps:
- name: Checkout source code
uses: actions/checkout@v4
# Configure build environment/dependencies
- name: Install build dependencies
run: sudo apt-get update && sudo apt-get install
g++-11
build-essential
libgtk-3-dev
unixodbc
unixodbc-dev
libcurl4-openssl-dev libssl-dev uuid-dev zlib1g-dev # AWS SDK dependencies
- name: Install MySQL client libs and include files
run: |
curl -L https://dev.mysql.com/get/Downloads/MySQL-8.3/mysql-${{ vars.MYSQL_VERSION }}-linux-glibc2.28-x86_64.tar.xz -o mysql.tar.gz
tar xf mysql.tar.gz
- name: Build and install AWS SDK C++
working-directory: ./scripts
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
-DWITH_UNIXODBC=1
-DCONNECTOR_PLATFORM=linux
-DMYSQL_DIR=./mysql-${{ vars.MYSQL_VERSION }}-linux-glibc2.28-x86_64/
-DBUNDLE_DEPENDENCIES=true
# Build driver
- name: Build driver
working-directory: ${{ github.workspace }}/build
shell: bash
run: cmake --build . --config $BUILD_TYPE
- name: Build installer
working-directory: ${{ github.workspace }}/build
if: success()
run: cpack .
- name: Upload Linux installer as artifact
if: success()
uses: actions/upload-artifact@v4
with:
name: installers-linux
path: ${{ github.workspace }}/build/aws-mysql-odbc-*.tar.gz
if-no-files-found: error
build-windows:
name: Windows
runs-on: windows-latest
env:
CMAKE_GENERATOR: Visual Studio 17 2022
WIX_DIR: "C:/Program Files (x86)/WiX Toolset v3.14/bin"
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.3/mysql-${{ vars.MYSQL_VERSION }}-winx64.zip -o mysql.zip
unzip -d C:/ mysql.zip
- name: Install OpenSSL 3
run: |
curl -L https://download.firedaemon.com/FireDaemon-OpenSSL/openssl-3.3.1.zip -o openssl3.zip
unzip -d C:/ openssl3.zip
cp -r C:/openssl-3/x64/bin/libssl-3-x64.dll C:/Windows/System32/
cp -r C:/openssl-3/x64/bin/libcrypto-3-x64.dll C:/Windows/System32/
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
- name: Build and install AWS SDK C++
working-directory: ./scripts
run: |
.\build_aws_sdk_win.ps1 x64 ${{ env.BUILD_TYPE}} ON "${{env.CMAKE_GENERATOR}}"
- name: Setup nmake
uses: ilammy/msvc-dev-cmd@v1
- name: Run build installer script
run: |
.\build_installer.ps1 x64 ${{ env.BUILD_TYPE}} "${{env.CMAKE_GENERATOR}}" C:/mysql-${{ vars.MYSQL_VERSION }}-winx64 "${{env.WIX_DIR}}" C:/openssl-3/x64/include/
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4.0.2
with:
role-skip-session-tagging: true
aws-access-key-id: ${{ secrets.AWS_BUILD_KEY }}
aws-secret-access-key: ${{ secrets.AWS_BUILD_SECRET_KEY }}
aws-region: us-west-2
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-external-id: ${{ secrets.AWS_ROLE_EXTERNAL_ID }}
role-duration-seconds: 3600
- name: Run signer script
shell: pwsh
working-directory: ./scripts
run: |
choco upgrade jq -y
. ".\sign_installer.ps1"
Invoke-SignInstaller ${{ github.workspace }}\wix winx64a ${{github.ref_name}} ${{ secrets.AWS_UNSIGNED_BUCKET }} ${{ secrets.AWS_SIGNED_BUCKET }} ${{ secrets.AWS_S3_KEY }}aws-mysql-odbc-${{github.ref_name}}-winx64a.msi
- name: Upload Windows installer as artifact
if: success()
uses: actions/upload-artifact@v4
with:
name: installers-windows
path: ${{ github.workspace }}/wix/*.msi
if-no-files-found: error
draft-release:
name: Create Draft Release
runs-on: ubuntu-latest
needs: [build-mac, build-linux, build-windows]
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Download all installers
uses: actions/download-artifact@v4.1.7
with:
path: installers
pattern: installers-*
merge-multiple: true
# Get tag version for release
- name: Set Version Env Variable
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: 'Get Release Details'
run: |
export RELEASE_DETAILS="$(awk -vN=2 'n<N;/^## /{++n}' CHANGELOG.md)"
export RELEASE_DETAILS="$(sed '${/^# /d;}' <<< "$RELEASE_DETAILS")"
export RELEASE_DETAILS="$(sed '$d' <<< "$RELEASE_DETAILS")"
touch RELEASE_DETAILS.md
echo "$RELEASE_DETAILS" > RELEASE_DETAILS.md
- name: Upload to Draft Release
uses: ncipollo/release-action@v1
with:
draft: true
name: "AWS ODBC Driver for MySQL - v${{ env.RELEASE_VERSION }}"
bodyFile: RELEASE_DETAILS.md
artifacts: "*/*.pkg, */*.tar.gz, */*.msi"
token: ${{ secrets.GITHUB_TOKEN }}