forked from aws/amazon-documentdb-odbc-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
182 lines (172 loc) · 5.84 KB
/
mac-build.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
name: ODBC Driver for Mac
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
env:
CI_OUTPUT_PATH: "ci-output"
ODBC_LIB_PATH: "${{github.workspace}}/build/odbc/lib"
ODBC_BIN_PATH: "${{github.workspace}}/build/odbc/bin"
ODBC_BUILD_PATH: "${{github.workspace}}/build/odbc/build"
DOCUMENTDB_HOME: "${{github.workspace}}/build/odbc/bin"
DOC_DB_KEYPAIR: ${{secrets.DOC_DB_KEYPAIR}}
DOC_DB_USER_NAME: ${{secrets.DOC_DB_USER_NAME}}
DOC_DB_PASSWORD: ${{secrets.DOC_DB_PASSWORD}}
DOC_DB_USER: ${{secrets.DOC_DB_USER}}
DOC_DB_HOST: ${{secrets.DOC_DB_HOST}}
DOC_DB_LOCAL_PORT: 27019
DOC_DB_REMOTE_PORT: 27017
DOC_DB_PRIV_KEY_FILE: ~/certs/docdb-sshtunnel.pem
DOC_DB_ODBC_INTEGRATION_TEST: 1
DOC_DB_LOG_PATH: "${{github.workspace}}/build/odbc/logs"
DOC_DB_LOG_LEVEL: "debug"
ODBCINSTINI: "${{github.workspace}}/build/odbc/lib/documentdb-odbc-install.ini"
ODBCINI: "${{github.workspace}}/odbc.ini"
jobs:
build-mac:
runs-on: macos-11
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/develop' }}
steps:
- uses: actions/checkout@v2
- name: Get Java distribution
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '17'
architecture: x64
- name: run-cppcheck
run: |
brew install cppcheck
sh run_cppcheck.sh
- name: upload-cppcheck-results
if: failure()
uses: actions/upload-artifact@v3
with:
name: cppcheck-results
path: cppcheck-results.log
- name: Extract key-pair into file
run: |
mkdir ~/certs
echo "${{env.DOC_DB_KEYPAIR}}" > ${{env.DOC_DB_PRIV_KEY_FILE}}
chmod 400 ${{env.DOC_DB_PRIV_KEY_FILE}}
- name: get-dependencies
run: |
chmod +x scripts/install_dependencies_mac.sh
./scripts/install_dependencies_mac.sh
- name: Update environment with JDBC_DRIVER_VERSION
run: |
read -r JDBC_DRIVER_VERSION < ./src/JDBC_DRIVER_VERSION.txt
echo "JDBC_DRIVER_VERSION=$JDBC_DRIVER_VERSION" >> $GITHUB_ENV
- name: Cache DocumentDB JDBC JAR
id: cache-documentdb-jdbc-jar
uses: actions/cache@v3
with:
path: |
cache/jar
key: cache-documentdb-jdbc-jar-${{env.JDBC_DRIVER_VERSION}}
- name: Download DocumentDB JDBC JAR
if: steps.cache-documentdb-jdbc-jar.outputs.cache-hit != 'true'
run: |
mkdir -p cache/jar
cd cache/jar
wget https://github.com/aws/amazon-documentdb-jdbc-driver/releases/download/v${{env.JDBC_DRIVER_VERSION}}/documentdb-jdbc-${{env.JDBC_DRIVER_VERSION}}-all.jar
- name: Install DocumentDB JDBC JAR
run: |
mkdir -p ${{env.ODBC_BIN_PATH}}/libs
cp cache/jar/documentdb-jdbc-${{env.JDBC_DRIVER_VERSION}}-all.jar ${{env.ODBC_BIN_PATH}}/libs
- name: configure-and-build-driver
run: |
chmod +x build_mac_release64.sh
./build_mac_release64.sh
env:
OPENSSL_ROOT_DIR: /usr/local/opt/openssl
# - name: prepare-dsn
# run: |
# sudo mkdir /Library/ODBC
# sudo cp ./src/Tests/Tests/odbc-mac.ini /Library/ODBC/odbc.ini
# sudo cp ./src/Tests/Tests/odbcinst-mac.ini /Library/ODBC/odbcinst.ini
# mkdir ${{ github.workspace }}/odbc-logs
- name: register-odbc-driver
run: |
chmod +x scripts/register_driver_unix.sh
./scripts/register_driver_unix.sh
- name: Import test data
run: |
chmod +x ./src/odbc-test/scripts/import_test_data.sh
./src/odbc-test/scripts/import_test_data.sh
- name: run-tests
id: runtests
run: |
mkdir -p "${{env.DOC_DB_LOG_PATH}}"
ssh -f -N -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i ${{env.DOC_DB_PRIV_KEY_FILE}} -L${{env.DOC_DB_LOCAL_PORT}}:${{secrets.DOC_DB_HOST}}:${{env.DOC_DB_REMOTE_PORT}} ${{secrets.DOC_DB_USER}}
./build/odbc/bin/documentdb-odbc-tests --catch_system_errors=false
- name: upload-test-report
if: always()
uses: EnricoMi/publish-unit-test-result-action/[email protected]
with:
check_name: "MacOS Big Sur 11 Build Unit Test Results Check"
comment_title: "MacOS Big Sur 11 Build Unit Test Results"
files: ./odbc_test_result.xml
- name: upload-test-file
if: always() && (steps.runtests.outcome == 'failure')
uses: actions/upload-artifact@v3
with:
name: odbc-test-results
path: |
./odbc_test_result.xml
./build/odbc/logs/docdb_odbc_*.log
# - name: print-memory-leak-logs
# if: always()
# run: |
# cat ./leaks_*
# - name: upload-test-logs
# if: failure()
# uses: actions/upload-artifact@v3
# with:
# name: test-logs-mac64
# path: |
# ${{ github.workspace }}/odbc-logs/
# ${{ github.workspace }}/leaks_
# - name: test
# run: |
# bash ./run_test_runner.sh
# - name: build-installer
# if: success()
# run: |
# cd cmake-build64
# cmake ../src
# make
# cpack .
# cd ..
# - name: create-output
# if: success()
# run: |
# mkdir build-output
# mkdir test-output
# mkdir installer
# cp ./build/odbc/lib/*.dylib build-output/
# cp ./build/odbc/lib/*.a build-output/
# cp ./cmake-build64/*.pkg installer/
# - name: upload-build
# if: success()
# uses: actions/upload-artifact@v3
# with:
# name: mac64-build
# path: build-output
# - name: upload-installer
# if: success()
# uses: actions/upload-artifact@v3
# with:
# name: mac64-installer
# path: installer
# - name: upload-test-results
# if: success()
# uses: actions/upload-artifact@v3
# with:
# name: mac-test-results
# path: test-output