Skip to content
This repository was archived by the owner on Aug 2, 2022. It is now read-only.

Commit 0f7c261

Browse files
authored
ODBC: improve Windows build process (#661)
* improve Windows build process - combine build code into one script for easier edits - introduced UNITY build for AWS SDK * update CI scripts * workflow updates * more workflow updates * workflow updates * workflow updates * update WinArch for VLD dll * print build_installer args * use Windows path separator & print CI output args for debugging * use Powershell envar syntax * workflow & ci script updates * update cmake path for 32-bit install * fix uplaod step path names * adding Env prefix for artifact steps * hardcode upload step paths * add link to custom test dataset * copy build script upgrades to release workflow
1 parent d7b1c04 commit 0f7c261

22 files changed

+550
-612
lines changed

.github/workflows/sql-odbc-main.yml

+25-42
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ name: Open Distro for Elasticsearch ODBC Driver
22

33
on: [push, pull_request]
44

5+
env:
6+
CI_OUTPUT_PATH: "sql-odbc/ci-output"
7+
ODBC_LIB_PATH: "./build/odbc/lib"
8+
ODBC_BIN_PATH: "./build/odbc/bin"
9+
ODBC_BUILD_PATH: "./build/odbc/build"
10+
AWS_SDK_INSTALL_PATH: "./build/aws-sdk/install"
11+
512
jobs:
613
build-mac:
714
runs-on: macos-latest
@@ -43,21 +50,21 @@ jobs:
4350
- name: create-output
4451
if: success()
4552
run: |
46-
mkdir build
53+
mkdir build-output
4754
mkdir test-output
4855
mkdir installer
49-
cp ./lib64/*.dylib build
50-
cp ./lib64/*.a build
51-
cp $(ls -d bin64/* | grep -v "\.") build
52-
cp ./cmake-build64/*.pkg installer
56+
cp ./build/odbc/lib/*.dylib build-output/
57+
cp ./build/odbc/lib/*.a build-output/
58+
cp ./cmake-build64/*.pkg installer/
59+
# cp $(ls -d ./build/odbc/bin/* | grep -v "\.") build-output
5360
# cp ./bin64/*.html test-output
5461
# cp ./bin64/*.log test-output
5562
- name: upload-build
5663
if: success()
5764
uses: actions/upload-artifact@v1
5865
with:
5966
name: mac64-build
60-
path: sql-odbc/build
67+
path: sql-odbc/build-output
6168
- name: upload-installer
6269
if: success()
6370
uses: actions/upload-artifact@v1
@@ -85,46 +92,34 @@ jobs:
8592
- name: build-installer
8693
if: success()
8794
run: |
88-
$prefix_path = (pwd).path
89-
cd cmake-build32
90-
cmake ..\\src -D CMAKE_INSTALL_PREFIX=$prefix_path\AWSSDK\bin -D BUILD_WITH_TESTS=OFF
91-
msbuild .\PACKAGE.vcxproj -p:Configuration=Release
92-
cd ..
95+
.\scripts\build_installer.ps1 Release Win32 .\src $Env:ODBC_BUILD_PATH $Env:AWS_SDK_INSTALL_PATH
9396
#- name: test
9497
# run: |
9598
# cp .\\libraries\\VisualLeakDetector\\bin32\\*.* .\\bin32\\Release
9699
# cp .\\libraries\\VisualLeakDetector\\lib32\\*.lib .\\lib32\\Release
97100
# .\run_test_runner.bat
98-
- name: create-output
101+
- name: prepare-output
99102
if: always()
100103
run: |
101-
mkdir build
102-
mkdir test-output
103-
mkdir installer
104-
cp .\\bin32\\Release\\*.dll build
105-
cp .\\bin32\\Release\\*.exe build
106-
cp .\\lib32\\Release\\*.lib build
107-
cp .\\cmake-build32\\*.msi installer
108-
# cp .\\bin32\\Release\\*.log test-output
109-
# cp .\\bin32\\Release\\*.html test-output
104+
.\scripts\prepare_ci_output.ps1 $Env:ODBC_BIN_PATH $Env:ODBC_LIB_PATH $Env:ODBC_BUILD_PATH
110105
- name: upload-build
111106
if: always()
112107
uses: actions/upload-artifact@v1
113108
with:
114109
name: windows32-build
115-
path: sql-odbc/build
110+
path: sql-odbc/ci-output/build
116111
- name: upload-installer
117112
if: always()
118113
uses: actions/upload-artifact@v1
119114
with:
120115
name: windows32-installer
121-
path: sql-odbc/installer
116+
path: sql-odbc/ci-output/installer
122117
#- name: upload-test-results
123118
# if: always()
124119
# uses: actions/upload-artifact@v1
125120
# with:
126121
# name: windows-test-results
127-
# path: test-output
122+
# path: $CI_OUTPUT_PATH/test
128123
build-windows64:
129124
runs-on: windows-latest
130125
defaults:
@@ -140,43 +135,31 @@ jobs:
140135
- name: build-installer
141136
if: success()
142137
run: |
143-
$prefix_path = (pwd).path
144-
cd cmake-build64
145-
cmake ..\\src -D CMAKE_INSTALL_PREFIX=$prefix_path\AWSSDK\bin -D BUILD_WITH_TESTS=OFF
146-
msbuild .\PACKAGE.vcxproj -p:Configuration=Release
147-
cd ..
138+
.\scripts\build_installer.ps1 Release x64 .\src $Env:ODBC_BUILD_PATH $Env:AWS_SDK_INSTALL_PATH
148139
#- name: test
149140
# run: |
150141
# cp .\\libraries\\VisualLeakDetector\\bin64\\*.* .\\bin64\\Release
151142
# cp .\\libraries\\VisualLeakDetector\\lib64\\*.lib .\\lib64\\Release
152143
# .\run_test_runner.bat
153-
- name: create-output
144+
- name: prepare-output
154145
if: always()
155146
run: |
156-
mkdir build
157-
mkdir test-output
158-
mkdir installer
159-
cp .\\bin64\\Release\\*.dll build
160-
cp .\\bin64\\Release\\*.exe build
161-
cp .\\lib64\\Release\\*.lib build
162-
cp .\\cmake-build64\\*.msi installer
163-
# cp .\\bin64\\Release\\*.log test-output
164-
# cp .\\bin64\\Release\\*.html test-output
147+
.\scripts\prepare_ci_output.ps1 $Env:ODBC_BIN_PATH $Env:ODBC_LIB_PATH $Env:ODBC_WIN_BUILD_PATH
165148
- name: upload-build
166149
if: always()
167150
uses: actions/upload-artifact@v1
168151
with:
169152
name: windows64-build
170-
path: sql-odbc/build
153+
path: sql-odbc/ci-output/build
171154
- name: upload-installer
172155
if: always()
173156
uses: actions/upload-artifact@v1
174157
with:
175158
name: windows64-installer
176-
path: sql-odbc/installer
159+
path: sql-odbc/ci-output/installer
177160
#- name: upload-test-results
178161
# if: always()
179162
# uses: actions/upload-artifact@v1
180163
# with:
181164
# name: windows-test-results
182-
# path: test-output
165+
# path: sql-odbc/ci-output/test-output

.github/workflows/sql-odbc-release-workflow.yml

+30-51
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ on:
55
tags:
66
- 'v*'
77

8+
env:
9+
CI_OUTPUT_PATH: "sql-odbc/ci-output"
10+
ODBC_LIB_PATH: "./build/odbc/lib"
11+
ODBC_BIN_PATH: "./build/odbc/bin"
12+
ODBC_BUILD_PATH: "./build/odbc/build"
13+
AWS_SDK_INSTALL_PATH: "./build/aws-sdk/install"
14+
815
jobs:
916
build-mac:
1017
runs-on: macos-latest
@@ -35,48 +42,38 @@ jobs:
3542
brew install curl
3643
brew install cmake
3744
brew install libiodbc
38-
- name: aws-sdk-cpp-setup
39-
run: |
40-
sh aws_sdk_cpp_setup.sh
41-
- name: configure
42-
run: |
43-
prefix_path=$(pwd)
44-
mkdir cmake-build
45-
cd cmake-build
46-
cmake ../src -DCMAKE_INSTALL_PREFIX=$prefix_path/AWSSDK/ -DCMAKE_BUILD_TYPE=Release -DBUILD_ONLY="core" -DCUSTOM_MEMORY_MANAGEMENT="OFF" -DENABLE_RTTI="OFF" -DENABLE_TESTING="OFF"
47-
cd ..
48-
- name: build-driver
45+
- name: configure-and-build-driver
4946
run: |
50-
cmake --build cmake-build
47+
./build_mac_release64.sh
5148
- name: build-installer
5249
if: success()
5350
run: |
54-
cd cmake-build
51+
cd cmake-build64
5552
cmake ../src
5653
make
5754
cpack .
5855
cd ..
5956
- name: create-output
6057
if: success()
6158
run: |
62-
mkdir build
59+
mkdir build-output
6360
mkdir test-output
6461
mkdir installer
65-
cp ./lib64/*.dylib build
66-
cp ./lib64/*.a build
67-
cp $(ls -d bin64/* | grep -v "\.") build
68-
cp ./cmake-build/*.pkg installer
62+
cp ./build/odbc/lib/*.dylib build-output/
63+
cp ./build/odbc/lib/*.a build-output/
64+
cp ./cmake-build64/*.pkg installer/
65+
# cp $(ls -d bin64/* | grep -v "\.") build
6966
- name: upload-build
7067
if: success()
7168
uses: actions/upload-artifact@v1
7269
with:
73-
name: mac-build
74-
path: sql-odbc/build
70+
name: mac64-build
71+
path: sql-odbc/build-output
7572
- name: upload-installer
7673
if: success()
7774
uses: actions/upload-artifact@v1
7875
with:
79-
name: mac-installer
76+
name: mac64-installer
8077
path: sql-odbc/installer
8178
- name: upload-artifacts-s3
8279
if: success()
@@ -106,37 +103,28 @@ jobs:
106103
- name: build-installer
107104
if: success()
108105
run: |
109-
cd cmake-build32
110-
cmake ..\\src -D CMAKE_INSTALL_PREFIX=$prefix_path\AWSSDK\ -D BUILD_WITH_TESTS=OFF
111-
msbuild .\PACKAGE.vcxproj -p:Configuration=Release
112-
cd ..
113-
- name: create-output
106+
.\scripts\build_installer.ps1 Release Win32 .\src $Env:ODBC_BUILD_PATH $Env:AWS_SDK_INSTALL_PATH
107+
- name: prepare-output
114108
if: always()
115109
run: |
116-
mkdir build
117-
mkdir test-output
118-
mkdir installer
119-
cp .\\bin32\\Release\\*.dll build
120-
cp .\\bin32\\Release\\*.exe build
121-
cp .\\lib32\\Release\\*.lib build
122-
cp .\\cmake-build32\\*.msi installer
110+
.\scripts\prepare_ci_output.ps1 $Env:ODBC_BIN_PATH $Env:ODBC_LIB_PATH $Env:ODBC_BUILD_PATH
123111
- name: upload-build
124112
if: always()
125113
uses: actions/upload-artifact@v1
126114
with:
127115
name: windows32-build
128-
path: sql-odbc/build
116+
path: sql-odbc/ci-output/build
129117
- name: upload-installer
130118
if: always()
131119
uses: actions/upload-artifact@v1
132120
with:
133121
name: windows32-installer
134-
path: sql-odbc/installer
122+
path: sql-odbc/ci-output/installer
135123
- name: upload-artifacts-s3
136124
if: success()
137125
shell: bash
138126
run: |
139-
cd installer
127+
cd ci-output/installer
140128
windows_installer=`ls -1t *.msi | grep "Open Distro for Elasticsearch SQL ODBC Driver" | head -1`
141129
echo $windows_installer
142130
aws s3 cp "$windows_installer" s3://artifacts.opendistroforelasticsearch.amazon.com/downloads/elasticsearch-clients/opendistro-sql-odbc/windows/
@@ -161,37 +149,28 @@ jobs:
161149
- name: build-installer
162150
if: success()
163151
run: |
164-
cd cmake-build64
165-
cmake ..\\src -D CMAKE_INSTALL_PREFIX=$prefix_path\AWSSDK\ -D BUILD_WITH_TESTS=OFF
166-
msbuild .\PACKAGE.vcxproj -p:Configuration=Release
167-
cd ..
168-
- name: create-output
152+
.\scripts\build_installer.ps1 Release x64 .\src $Env:ODBC_BUILD_PATH $Env:AWS_SDK_INSTALL_PATH
153+
- name: prepare-output
169154
if: always()
170155
run: |
171-
mkdir build
172-
mkdir test-output
173-
mkdir installer
174-
cp .\\bin64\\Release\\*.dll build
175-
cp .\\bin64\\Release\\*.exe build
176-
cp .\\lib64\\Release\\*.lib build
177-
cp .\\cmake-build64\\*.msi installer
156+
.\scripts\prepare_ci_output.ps1 $Env:ODBC_BIN_PATH $Env:ODBC_LIB_PATH $Env:ODBC_WIN_BUILD_PATH
178157
- name: upload-build
179158
if: always()
180159
uses: actions/upload-artifact@v1
181160
with:
182161
name: windows64-build
183-
path: sql-odbc/build
162+
path: sql-odbc/ci-output/build
184163
- name: upload-installer
185164
if: always()
186165
uses: actions/upload-artifact@v1
187166
with:
188167
name: windows64-installer
189-
path: sql-odbc/installer
168+
path: sql-odbc/ci-output/installer
190169
- name: upload-artifacts-s3
191170
if: success()
192171
shell: bash
193172
run: |
194-
cd installer
173+
cd ci-output/installer
195174
windows_installer=`ls -1t *.msi | grep "Open Distro for Elasticsearch SQL ODBC Driver" | head -1`
196175
echo $windows_installer
197176
aws s3 cp "$windows_installer" s3://artifacts.opendistroforelasticsearch.amazon.com/downloads/elasticsearch-clients/opendistro-sql-odbc/windows/

sql-odbc/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ CMakeCache.txt
5454
CPackConfig.cmake
5555
CPackSourceConfig.cmake
5656
CTestTestfile.cmake
57+
/build/
58+
/sdk-build32/
5759
/sdk-build64/
60+
/cmake-build32/
5861
/cmake-build64/
5962
/src/PowerBIConnector/bin/Debug/
6063
/src/PowerBIConnector/obj/

0 commit comments

Comments
 (0)