forked from aws/amazon-documentdb-odbc-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
227 lines (199 loc) · 7.27 KB
/
mac-debug-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
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
name: ODBC Driver for Mac (Debug)
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-debug:
runs-on: macos-11
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
pip3 install gcovr
# if action `EnricoMi/publish-unit-test-result-action/[email protected]`
# recognizes Python in Library/Developer/CommandLineTools instead of in /usr/local/bin/, then errors would occur
- name: set-PATH
run: |
echo "/Library/Developer/CommandLineTools/usr/bin" >> $GITHUB_PATH
echo "/usr/local/bin/" >> $GITHUB_PATH
- 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_debug64.sh
./build_mac_debug64.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
env:
RUN_CODE_COVERAGE: ${{ true }}
BOOST_TEST_CATCH_SYSTEM_ERRORS: no
- 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
python3 -m gcovr --exclude-directories cmake-build64/odbc-test/CMakeFiles/documentdb-odbc-tests.dir$ --cobertura --output coverage.cobertura.xml
- name: upload-coverage
if: always()
uses: actions/upload-artifact@v3
with:
name: code-coverage
path: coverage.cobertura.xml
- name: upload-test-report
if: always()
uses: EnricoMi/publish-unit-test-result-action/[email protected]
with:
check_name: "MacOS Big Sur 11 Debug Build Unit Test Results Check"
comment_title: "MacOS Big Sur 11 Debug 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-mac-debug
path: |
./odbc_test_result.xml
./build/odbc/logs/docdb_odbc_*.log
comment_PR_mac_coverage:
runs-on: ubuntu-latest
needs: build-mac-debug
steps:
- uses: actions/checkout@v3
with:
ref: ''
- name: Retrieve coverage
uses: actions/[email protected]
with:
name: code-coverage
- name: Code Coverage Badge
uses: irongut/[email protected]
with:
filename: coverage.cobertura.xml
badge: true
format: text
indicators: true
output: both
- name: Extract Code Coverage Badge
run: |
COVERAGE_BADGE=$(head -1 code-coverage-results.txt )
COVERAGE_BADGE="${COVERAGE_BADGE/'Code%20Coverage'/'macOS%20Code%20Coverage'}"
curl $COVERAGE_BADGE > .github/badges/coverage_badge_macOS.svg
- name: Commit Coverage Badge
if: github.event_name == 'pull_request'
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_options: '--allow-empty --no-verify'
commit_message: Commit Code Coverage Badge
file_pattern: '*.svg'
skip_fetch: false
skip_checkout: false
skip_dirty_check: false
- name: Code Coverage Summary Report
uses: irongut/[email protected]
with:
filename: coverage.cobertura.xml
badge: true
format: markdown
indicators: true
output: both
- name: Add Header for Code Coverage Summary Report
run: |
echo "## MacOS Big Sur 11 Debug Build Code Coverage Result" > coverage-cobertura.md
cat code-coverage-results.md >> coverage-cobertura.md
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request'
with:
header: macOS
recreate: true
path: coverage-cobertura.md
- 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